In this section, we discuss techniques to build Web3 application.
Here we identified three approaches:
This approach involves generating source Go ABI from solidity contract using a Geth tool call abigen.
Step 1: Build an image containing abigen
by running the command: ./scripts/ops.sh image build:node
.
Step 2: Using the HelloWorld
solidity contract as an example, the proceess for generating a Go ABI is here. To see a working example of a generated binding, run the command ./scripts/ops.sh solidity abi
and this will generate a packge internal/hello
.
Step 3: Build application capable of interacting with a deployed contract is to be able to connect to a node in the Ethereum network. You need to dial a connection. Here is the step:
import "github.com/ethereum/go-ethereum/ethclient"
nodeurl := "<url to node>"
conn, err := ethclient.Dial(nodeurl)
// Generated factory
contract, err := hello.NewHelloWorld("<contract address>", conn)