Running smart contract locally
Prerequisites
Ensure mini-ola is installed correctly:
If this command fails, see Setting up your environment.
Interacting with a smart contract locally
You can write Ola smart contracts using Ola-lang and compile them with olatte, Taking the vote_simple.ola contract as an example:
This command will generate a bin file and an abi file; the bin file is used for the deployment of the contract:
address: The address where you want the smart contract to be deployed. When not specified, an address will be generated randomly.
db: Path of your local storage. When not specified, a "db" folder will be created in current working directory.
The contract has been deployed. You can send transactions using invoke:
These two transactions initialized the proposal number and cast a vote for the fourth proposal.
When using invoke, you can specify parameters: db, caller, nonce, block, timestamp. For detailed explanations of these parameters, you can check the following command:
Finally, you can use the call command to check the contract state:
Similarly, you can view specific parameters through the command:
Last updated