分享个用Golang编写的比特币客户端连接库chainlibs/gobtclib

开源项目地址:https://github.com/chainlibs/gobtclib

gobtclib项目是golang调用比特币json-rpc的一个库,已支持多个接口调用。

GetBlockCount
GetBestBlockHash
GetDifficulty
GetBlockHash
GetBlockHeaderVerbose
GetBlockChainInfo
GetBlockVerbose
GetBlockVerboseTx
VerifyChain
VerifyChainLevel
VerifyChainBlocks
GetRawMempool
GetRawMempoolVerbose
GetMempoolEntry
GetTxOut

代码示例:


func GetBlockCountTest() {
    cli = client.NewClient(cfg).Startup()
    defer cli.Shutdown()
	blockCount, err := cli.GetBlockCount()
	if err != nil {
		log.Fatal("", "error", err)
	}
	log.Info("GetBlockCount", "count", blockCount)
}

更多示例代码参考:https://github.com/chainlibs/gobtclib/tree/master/examples

 

 

你可能感兴趣的:(Chainlibs,Bitcoin比特币)