Skip to content

Latest commit

 

History

History
48 lines (29 loc) · 2.14 KB

doc.md

File metadata and controls

48 lines (29 loc) · 2.14 KB

Application development

In this section, we discuss techniques to build Web3 application.

Here we identified three approaches:

Web3.js - Javascript API Libraries

JSON-RPC API

Go ABI from Solidity

This approach involves generating source Go ABI from solidity contract using a Geth tool call abigen.

Working example

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)

References