Dero Virtual Machine Light Version A standalone version of the Stargate Testnet DVM, working in a offline mode.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
b9ron 1428c4e0e6 version 0.0.7 3 months ago
config version 0.0.7 3 months ago
examples version 0.0.7 3 months ago
log version 0.0.7 3 months ago
prompt version 0.0.7 3 months ago
unit version 0.0.7 3 months ago
vm version 0.0.7 3 months ago
.gitignore version 0.0.7 3 months ago
LICENSE version 0.0.7 3 months ago
README.md version 0.0.7 3 months ago
VERSION version 0.0.7 3 months ago
main.go version 0.0.7 3 months ago

README.md

DERO Virtual Machine Light

ABOUT DVM Light

DVM Light is a standalone version of Dero Stargate Testnet Virtual Machine designed for accelerate the development of Smart Contract on the DERO Network in an offline environement. ( See more: https://git.dero.io/DeroProject/dvm_doc )

Installation From Source

  1. Install Golang, minimum Golang 1.10.3 required.
  2. Run the command go get git.dero.io/b9ron/dvml
  3. Add some dvm-basic file in the dvml folder.
  4. Finally run or compile with: go run dvml.go or go build

Usage

Linux:

./dvml --help

Windows:

dvml.exe --help

Requirment

  1. Each dvm-basic file need a mandatory function Initialize() Uint64 that return a Uint64 0 .
  2. Only public function will be executed (the first letter must be an Upper Case)
  3. Before using LOAD(data) instruction, data need to be initialized in Initialize() function with STORE(data,value) instruction.

String value

10 STORE(name, "Alice")

Uint64 value

10 STORE(balance, 0)

Minimalistic Initialize function

Function Initialize() Uint64
20 RETURN 0
End Function

Examples for lottery.bas

For the signature: Function TuneLotteryParameters(input Uint64, lotteryeveryXdeposit Uint64, lotterygiveback Uint64) Uint64

(dvml) run TuneLotteryParameters 10000 5 8800

For the signature: Function TransferOwnership(newowner String) Uint64

(dvml) run TransferOwnership dEToNFYEXufYzcs64qnfocZ48nvmbxbKR1x2MZBqbrHn5dULSfRRdN3d4EsbwKLGeHE5k3Vrh77BWFufe2gBcrDF57PqDCaJoc

Changelog

0.0.7:

  • New entry ExpectedStates (SC states) in the JSON test file allow to check the SC states modified with STORE(key) DVM function. (see the examples folder)
  • New command generate file will generate a JSON test file_generated.json based on the current SC loaded. (Only ExpectedResult (function output) are generated)
  • New command balance will show the SC balance and current user balance.
  • Fix on the SEND_DERO_TO_ADDRESS allow to sendback to the owner the correct ammount of Dero without crash.
  • Update to MIT Licence

0.0.6b:

  • Colors are disabled by default due to windows cmd has an issue diplaying AINSI characters, you have to use the flag -colors to enable the color mode.
  • New way to launch dvml using sc et test flags.

0.0.6:

  • You can check stored state in Dero SC.
  • You can launch the test script without using the menu, just by running dvml file.bas file.json
  • Fix golang imports

0.0.5:

  • Add the support of the Unit Testing for Dero Smart Contracts with the command tests file that load a JSON file with unit tests parameters. (see the examples folder)
  • Each time you launch the dvml a new SCID BLID and TXID will be generated (They are seeds for the RANDOM() function).
  • Every seconds the BLID and the BLOCKHEIGHT will be incremented to simulate a DeroDag with 1 second time block.

0.0.4:

  • You can use the instruction SEND_DERO_TO_ADDRESS in smart contract without crashing the DVML, but you need to send some DEROs to the smart contract using a function with an a argument named value and an amount in uint64.

0.0.3:

  • help display Help and Usage information.
  • account display 10 generated accounts (0 to 9), with the command account 9 you can select the account number 9. (usefuf for the DVM SIGNER() instruction.)
  • signer or whoami display the current address of the SIGNER().
  • storage show the data stored with the DVM STORE() instruction.

** KNOWN BUG : SEND_DERO_TO_ADDRESS doesn’t work yet! **

0.0.2:

  • You can execute multiple functions without losing the context with the command run.
  • You can list the fonctions inside the SC with their arguments using the command list.
  • A prompt has been added ( press q or quit for exit.)

0.0.1:

  • Only one function at the time
  • Initial release

Donations

DERO:

dERoNFYEXufYzcs64qnfocZ48nvmbxbKR1x2MZBqbrHn5dULSfRRdN3d4EsbwKLGeHE5k3Vrh77BWFufe2gBcrDF57PqDCaJoc