geth-ethclient-starter

command module
v0.0.0-...-bbe122e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 9 Imported by: 0

README

Geth ethclient Starter

A comprehensive guide to using the ethclient package from Geth (go-ethereum) to build Ethereum applications with Go.

🛠 Built With

Go Badge Geth Badge

⚙️ 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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL