Tyrese-BlockStacker / Web3_Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Logo

Web3 Go

Ethereum Dapp Go API, inspired by web3.js.
Report Bug · Pull Request

WEBSITE LISTENSE

Introduction

This is the Ethereum Golang API which connects to the Generic JSON-RPC spec.

You need to run a local or remote Ethereum node to use this library.

Client

go get github.com/6boris/web3-go
package main

import (
  "context"
  "fmt"
  "github.com/6boris/web3-go/client"
  "github.com/6boris/web3-go/pkg/otel"
)

func main() { 
  otel.InitProvider()
  ec := client.NewPool(client.GetDefaultConfPool())
  chainID := int64(1)
  v, err := ec.GetClient(chainID).ClientVersion(context.Background())
  if err != nil {
    panic(err)
  }
  fmt.Println(fmt.Sprintf("ChainID:%d ClientVersion:%s", chainID, v))
}


/*
Output:
    ChainID:1 ClientVersion:Geth/v1.11.5-omnibus-65be78cc/linux-amd64/go1.19.7
*/

Development Trips

  • Client
    • Base Method
      • eth_chainId
      • web3_clientVersion
      • eth_gasPrice
      • eth_blockNumber
      • eth_getBalance
      • ...
    • Middleware
      • LoadBalance
      • Monitor
      • CircuitBreaker
  • Other ...

Community

  • web3.js Ethereum JavaScript API.
  • Web3j Web3 Java Ethereum Ðapp API.
  • Web3.py A Python library for interacting with Ethereum.

Provider

Dev tool

About

License:Apache License 2.0


Languages

Language:Go 98.7%Language:Makefile 1.3%