Simulator
We recommend that you prepare a solc compiler before using the contract simulator.
If you do not want to prepare the solc compiler, it is necessary to prepare a Remix online environment or Remix local browser.
Example
Compile the contract simulator
The code is in https://github.com/seeleteam/go-seele
Copy the solc compiler to this path, and copy the solidity file in it too.
A simple smart contract example
Smart contract source code:
SimpleStorage.sol:
Create the contract in the simulator with solidity file
When a smart contract created successfully, the contract address will be stored.
Call the contract in simulator
Use the global contract address (if -c not specified) and set(21) function to call contract.
Verify the set function:
A simple smart contract example that relies on Remix
1. Prepare Remix
Remix-IDE is a browser based IDE for solidity development, you can use the online version at http://remix.ethereum.org/, or download it from https://github.com/ethereum/remix-ide to install it locally.
The following demonstration is done using the online version.
2. Compile Contract
Prepare the smart contract source code:
3. Deploy Contract
4. Create and deploy contract in contract simulator
Run the following commands to change into go-seele/cmd/vm directory, then run the command go build.
Create and deploy contract using the input hex string acquired from step three.
The string "Succeed to create contract!" means creation is successful, the deployment address might be different from the address above but that will not affect anything.
5. Test Set Function
Then switch back to the contract simulator to execute the contract.
The string "Succeed to call contract!" indicates function call successful.
6. Test get Function
Switch to contract simulator, then call the get function.
When the string "Succeed to call contract!" is shown and the result is 21, then the function is running correctly!
Last updated