Skip to content

Latest commit

 

History

History
87 lines (60 loc) · 2.48 KB

README.md

File metadata and controls

87 lines (60 loc) · 2.48 KB

My playground project to learn Rust and blockchain development

Learning Rust and Blockchain development on Ethereum using lessons from:

stack: Rust, Actix, Ethers-rs, Solidity, Foundry, Tailwind (DaisyUI), Tera, HTMX

Set-up

  • 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 AND ACCOUNT in the .envrc file and update the env vars with direnv allow

Interact with the testnet

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

Run the app

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