Learning Rust and Blockchain development on Ethereum using lessons from:
stack: Rust, Actix, Ethers-rs, Solidity, Foundry, Tailwind (DaisyUI), Tera, HTMX
- install Foundry, Solidity (solc), Tailwind and Direnv
make prepare-env
- optionally install web3 CLI to interract with the Anvil testnet (
cast
also works)
make install-web3cli
- start the Anvil local testnet
make start-testnet
- see the accounts and private keys on the start-up output and update
PRIVATE_KEY
ANDACCOUNT
in the.envrc
file and update the env vars withdirenv allow
Use the Makefile targets to interract with the Smart Contracts.
- deploy contract from a lab (e.g. Lab1)
make lab1-deploy
- export the returned contract address to the
CONTRACT_ADDRESS_THEBLOCKCHAINMESSENGER
env var, or do the two steps in a single step:
export CONTRACT_ADDRESS_THEBLOCKCHAINMESSENGER=$(make lab1-deploy)
- get the transaction details
make get-tx TX_HASH=0x5a6f304960784db9bee2df3de0c8e91b4afdfda748fa3fb80527baa786e53fab
- call contract method
make lab1-updateTheMessage MSG="Hello World!"
- get the last contract data or at a given block
make lab1-get-data
make lab1-get-data-at-block BLOCK_NR=1
- get the account balance
make get-balance
You can use already deployed Smart Contracts by setting the contract addresses in the .envrc
file and enabling them with direnv allow
.
- start the app
make run
-
open the page on localhost:8080
-
open Lab1 (The Blockchain Messenger), wait until the contract gets deployed (in case you didn't set the contract address in
.envrc
) and submit a new transaction