How to deploy a smart contract¶
Quick guide to deploying a smart contract to VeChainThor blockchain:
Requires Connex (find out here Compatible Clients or What is Connex?)
It’s recommended to use VeChain IDE via Sync for the smart contract development.
Open VIDE in the Connex environment (visit https://vechainstore.com/ide)
A sample contract is available (ballot.sol), this contract is very basic. The goal is to quickly start to create and to interact with a smart contract on VeChainThor blockchain.
“caption”: “VIDE: Solidity Editor”
Compile contracts: in the
Compile tab click on
Start to compile button
Deploy contracts: in the
Run tab select the contract you want to deploy (eg Ballot), the constructor of Ballot contract needs a parameter is number of proposals (_numProposals: type uint8). Give any value and click on
“caption”: “VIDE: Run tab”
Running transactions: in the
Run tab after deploying a successful contract and confirmed, in the
Deployed Contracts table will appear the
Ballot contract and its address
Interacting with an instance
This new instance contains 4 actions which corresponds to the 4 functions (giveRightToVote, delegate, vote, winningProposal). Clicking on giveRightToVote, delegate or vote will create a new transaction.
giveRightToVote: Give $(toVoter) the right to vote on this ballot, may only be called by $(chairperson) is also the creator of the contract.
delegate: Delegate your vote to the voter $(to).
vote: Give a single vote to proposal $(toProposal).
winningProposal will not execute a transaction (blue action), not modify the state (variable value) of this instance.
winningProposal is constant you can see the return value just below the action.