Skip to content

hunterlong/insight

Repository files navigation

Bitcore Insight API - Golang

A small golang package to help you use your bitcore insight API with Golang.

Go Report Card Build Status Godoc

Connect to Insight API

// import "github.com/hunterlong/insight"

bitcoin := insight.New("https://insight.bitpay.com/api")

// err := bitcoin.Ping()  // test insight API connection
// bitcoin.SetThreads(16) // set multiple threads to download transactions faster

Get Block Hash

block := bitcoin.NewBlock(532833) // you can use Block Height
block := bitcoin.NewBlock("0000000000000000003221e76df18226231f8e33694f40318051ec688decd6b0") // or hash
block := bitcoin.NewBlock(nil) // or get the latest block

Fetch Bitcoin Block

transactions := block.Transactions()
// transactions.ToJSON()

Get Balance for Address

address := bitcoin.NewAddress("3KJrsjfg1dD6CrsTeHdHVH3KqMpvL2XWQn")
balance := address.Balance()

Get Address UTXO's

utxos := address.UTXO()

Get Server Sync Status

sync := bitcoin.Sync()
// sync.Status
// sync.BlockChainHeight

Releases

No releases published

Packages

No packages published

Languages