Geth ethclient Starter
A comprehensive guide to using the ethclient
package from Geth (go-ethereum) to build Ethereum applications with Go.
🛠 Built With
⚙️ Run Locally
Clone the project:
git clone https://github.com/tr1sm0s1n/geth-ethclient-starter.git
cd geth-ethclient-starter
Use AetherGuild submodule for simulated blockchain:
git submodule update --init --recursive
cd aetherguild && make
Generate address-key pair:
go run cmd/accounts/generator.go
Visit Druid Faucet to get test ether.
Export private key as env variable:
export PRIVATE_KEY=<private-key>
Install abigen
:
go install github.com/ethereum/go-ethereum/cmd/abigen@latest
Generate Go binding for the contract:
abigen --bin contract/output/Cert/Cert.bin --abi contract/output/Cert/Cert_abi.json --pkg contract --type Cert --out contract/Cert.go
Deploy the contract:
go run cmd/contracts/deploy.go
Export contract address as env variable:
export CONTRACT_ADDRESS=<contract-address>
Run event listener for the contract:
go run cmd/events/listener.go
Run CLI instigator for contract (export values if needed):
go run .
Send a blob transaction to the simulation (optional):
go run cmd/transactions/blob.go
Use graphql/queries
to get balance, blocks and receipts via GraphQL UI.