Golang: Read, Write and Subscribe to Ethereum Smart Contracts with Geth
Get, set and use subscriptions to monitor for smart contract events using Golang and Geth (Go Ethereum client library).
Solidity Contract verified on Goerli testnet:
https://goerli.etherscan.io/address/0xdbaa7dfbd9125b7a43457d979b1f8a1bd8687f37#code
Go get/set/subscribe script:
https://github.com/MarcusWentz/Web3_Get_Set_Contract_Metamask/blob/main/Scripts/go/getSetEvent.go
Geth interaction smart contract documentation: https://goethereumbook.org/smart-contract-write/
Video image:
https://docs.google.com/presentation/d/17XPBYmMM1LljPpDSRPF1CCKnIyBsdAXuZi1VMZ4mUVY/edit?usp=sharing
Steps for preparing Go contract interaction:
Step 1: Create abi file by running: solc --abi Store.sol (save output to Store_sol_Store.abi)
Step 2: Create bin file by running: solc --bin Store.sol (save output to Store_sol_Store.bin)
Step 3: Remove comments above the abi and bin files.
Step 4: Generate Go contract interaction file by running: abigen --bin=Store_sol_Store.bin --abi=Store_sol_Store.abi --pkg=main --out=Store.g
Step 5: Run: StoreTest.go Store.go