Please visit our website at zondax.ch
This is the first smart contract you should check in order to learn how to create your own one. It implements:
- Save a counter to storage
- Load data from storage
- Create a constructor
- Export a basic method
It was built using the FVM SDK for AssemblyScript. Please, go to the project in order to know more about it.
You just need to run these two steps:
make deps
make build
The binary file you need to use it release-final.wasm
.
In order to run it on a lotus node, first you will need to deploy one. Please, refer to this repo.
kubectl config use-context sandbox
kubectl -n filecoin-node cp build/final-release.wasm <pod-name>:/tmp/fil-actor-hello-world-as.wasm
lotus chain install-actor <path-to-binary>
lotus chain create-actor <actor-id-from-previous-step>
On the tests/browser
folder, you will find a web page ready to allow you to interact with the smart contract. In order to
run it, please you need to set the an .env
file with the required values. And now run:
yarn install
yarn dev
A web server will be listening to requests on localhost:3000
. In order to install and instantiate the smart contract, please follow these to steps:
lotus chain invoke <address-id-from-create-actor-step> 2
Please, follow the flow the web page offers you in order to run the say_hello method. The only thing you need to keep in mind is the fact you will need to install and instantiate the smart contract first.
Be sure to have Cargo
installed.
cd tests/local-vm
cargo r