A Golang client library to communicate with Ethereum RPC server.
- Implements most of JSON-RPC methods and several client-specific methods.
- Provides a high-level interface to propose/get validators on Istanbul blockchain.
- Provides a high-level interface to create private contracts on Quorum blockchain.
package main
import (
"context"
"fmt"
"github.com/getamis/eth-client/client"
)
func main() {
url := "http://127.0.0.1:8545"
client, err := client.Dial(url)
if err != nil {
fmt.Println("Failed to dial, url: ", url, ", err: ", err)
return
}
err = client.StartMining(context.Background())
if err != nil {
fmt.Println("Failed to start mining, err: ", err)
return
}
fmt.Println("start mining")
}
- admin_addPeer
- admin_adminPeers
- admin_nodeInfo
- eth_blockNumber
- eth_sendRawTransaction
- eth_getBlockByHash
- eth_getBlockByNumber
- eth_getBlockByHash
- eth_getBlockByNumber
- eth_getTransactionByHash
- eth_getBlockTransactionCountByHash
- eth_getTransactionByBlockHashAndIndex
- eth_getTransactionReceipt
- eth_syncing
- eth_getBalance
- eth_getStorageAt
- eth_getCode
- eth_getBlockTransactionCountByNumber
- eth_call
- eth_gasPrice
- eth_estimateGas
- eth_sendRawTransaction
- miner_startMining
- miner_stopMining
- net_version
- logs
- newHeads
- eth_getLogs
To use these methods, make sure that
- Server is running on Istanbul consensus.
- Connect to server through
istanbul.Dial
function (not the original Geth client).
Methods:
- istanbul_getValidators
- istanbul_propose
To use these methods, make sure that
- Server is running on Quorum blockchain
- Connect to server through
quorum.Dial
function (not the original Geth client).
Methods:
- quorum_privateContract
- quorum_contract
Feel free to contribute to this repository.
- Fork it!
- Create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request