您正在查看: Ethereum-开源推荐 分类下的文章

以太坊观察者

https://github.com/HydroProtocol/ethereum-watcher

ethereum-watcher是用Golang编写的以太坊区块链的事件监听器。使用以太坊观察器,您可以监视和跟踪以太坊区块链上发生的当前或历史事件。

背景

与以太坊区块链交互的许多应用程序需要知道链上何时发生特定动作,但无法直接访问链上数据。ethereum-watcher充当应用程序和链之间的接口:从区块链收集指定的数据,以便应用程序可以与链上事件进行更无缝的交互。

特征

插件友好。您可以轻松地向以太坊观察者添加一个插件,以侦听任何类型的链上事件。
叉公差。如果发生派生,则将一条还原消息发送给订户。

简单的以太坊API以获取您的ERC20代币余额以及有用的信息

https://github.com/hunterlong/tokenbalance

import (
    "github.com/hunterlong/tokenbalance"
)

func main() {
    // connect to your Geth Server
    configs = &tokenbalance.Config{
         GethLocation: "https://eth.coinapp.io",
         Logs:         true,
    }
    configs.Connect()

    // insert a Token Contract address and Wallet address
    contract := "0x86fa049857e0209aa7d9e616f7eb3b3b78ecfdb0"
    wallet := "0xbfaa1a1ea534d35199e84859975648b59880f639"

    // query the blockchain and wallet details
    token, err := tokenbalance.New(contract, wallet)

    // Token Balance will respond back useful things
    token.BalanceString()  // "600000.0"
    token.ETHString()      // "1.020095885777777767"
    token.Name             // "OmiseGO"
    token.Symbol           // "OMG"
    token.Decimals         // 18
    token.Balance          // big.Int() (token balance)
    token.ETH              // big.Int() (ether balance)
}