Smart Contract client in multi languages
- JS: use ethers.js
- Rust: use ethers-rs
- Python: use web3.py
- Foundry
- Ethers-rs
- Ethers.js
- web3.py
Compile & Deploy contract
anvil
ETH_FROM=<account address from anvil>
- deploy contract to local net
cd contracts/
forge create src/Contract.sol:SimpleStorage --constructor-args 123 --unlocked --from $ETH_FROM
SIMPLE_STORAGE=<your deployed address>
cast --to-dec $(cast call $SIMPLE_STORAGE "get()")
> 123
cast send $SIMPLE_STORAGE "set(uint256)" 321 --from $ETH_FROM
cast --to-dec $(cast call $SIMPLE_STORAGE "get()")
> 321
- Copy abi from
contracts/out/Contract.sol/SimpleStorage.json
to clients/abis/SimpleStorage.json
cd clients/rust/
cargo run
cd clients/js/
yarn
node index.js
cd clients/py/
# recommend to use virtual env to run
pip install -r requirements.txt
python main.py