MCPcopy Index your code
hub / github.com/blockcypher/gobcy

github.com/blockcypher/gobcy @v2.0.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.0.5 ↗ · + Follow
96 symbols 302 edges 12 files 82 documented · 85%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

gobcy

A Go wrapper for the BlockCypher API. Targeting support for Bitcoin (main and testnet3) and BlockCypher's internal testnet, but others (Litecoin, Dogecoin) should work too. The wrapper works also for some query for Ethereum but the compatibility is not fully guaranteed.

Configuration

Import the package like so:

import "github.com/blockcypher/gobcy/v2"

Then initiate an API struct with your credentials:

//explicitly
bc := gobcy.API{}
bc.Token = "your-api-token-here"
bc.Coin = "btc" //options: "btc","bcy","ltc","doge","eth"
bc.Chain = "main" //depending on coin: "main","test3","test"

//using a struct literal
bc := gobcy.API{"your-api-token-here","btc","main"}

//query away
fmt.Println(bc.GetChain())
fmt.Println(bc.GetBlock(300000,"",nil))

Usage

Check the "types.go" file for information on the return types. Almost all API calls are supported, with a few dropped to reduce complexity. If an API call supports URL parameters, it will likely appear as a params map[string]string variable in the API method. You can check the docs for supported URL flags.

Speaking of API docs, you can check out BlockCypher's documentation here. We've also heavily commented the code following Golang convention, so you might also find the GoDoc quite useful. The gobcy_test.go file also shows most of the API calls in action.

Testing

The aforementioned gobcy_test.go file contains a number of tests to ensure the wrapper is functioning properly. If you run it yourself, you'll have to insert a valid API token; you may also want to generate a new token, as the test POSTs and DELETEs WebHooks and Payment Forwarding requests.

Core symbols most depended-on inside this repo

buildURL
called by 46
gobcy.go
getResponse
called by 23
gobcy.go
postResponse
called by 17
gobcy.go
deleteResponse
called by 6
gobcy.go
GetBlock
called by 5
blockchain.go
respErrorMaker
called by 4
gobcy.go
Faucet
called by 4
address.go
GenAddrKeychain
called by 3
address.go

Shape

Method 52
Struct 24
Function 20

Languages

Go100%

Modules by API surface

types.go21 symbols
gobcy_test.go13 symbols
tx.go10 symbols
gobcy.go9 symbols
address.go9 symbols
wallet.go8 symbols
asset.go6 symbols
payfwd.go5 symbols
hdwallet.go5 symbols
hook.go4 symbols
meta.go3 symbols
blockchain.go3 symbols

For agents

$ claude mcp add gobcy \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact