For developing smart contracts I've chosen foundry. Follow the instructions to install foundry via foundryup:
- anvil (local Ethereum node, akin to Ganache)
- forge (Ethereum testing framework, like Truffle)
To run anvil, run:
docker-compose up
To compile smart contracts, run:
forge build
To test smart contracts, run:
forge test
To test smart contracts and see logs, gas usage etc, run:
forge test -vvvvv
To generate rust bindings for smart contracts, run:
forge bind \
--bindings-path ../organisation/src/transport/ethereum \
--module \
--overwrite
To implement a prototype of an organisation/peer, I've chosen rust.
There's a neat little script that runs a couple of peers and a coordinator simultaneously. It requires tmux.
./run-dev.sh
To run unit tests, run:
cargo test
To run integration tests, run:
cargo integration-tests
To generate gRPC code, run:
cargo build --features gen-proto
To control log level output use env variable RUST_LOG
for example:
export RUST_LOG=INFO
To control backtrace level use env variable RUST_BACKTRACE
for example:
export RUST_BACKTRACE=full
To run application via docker, run:
docker build -t organisation .
dokcer run organisation
For building docker images, I use buildkit. To enable it:
export DOCKER_BUILDKIT=1