Documentation ¶
Overview ¶
Package gobcy implements a wrapper for the http://www.blockcypher.com API. You can use it to interact with addresses, transactions, and blocks from various blockchains, including Bitcoin's main and test3 chains, and the BlockCypher test chain.
Please note: we assume you use are using a 64-bit architecture for deployment, which automatically makes `int` types 64-bit. Without 64-bit ints, some values might overflow on certain calls, depending on the blockchain you are querying. If you are using a 32-bit system, you can change all `int` types to `int64` to explicitly work around this issue.
Index ¶
- type API
- func (api *API) AddAddrWallet(name string, addrs []string, omitAddr bool) (wal Wallet, err error)
- func (api *API) CreateHDWallet(req HDWallet) (wal HDWallet, err error)
- func (api *API) CreateHook(hook Hook) (result Hook, err error)
- func (api *API) CreatePayFwd(payment PayFwd) (result PayFwd, err error)
- func (api *API) CreateWallet(req Wallet) (wal Wallet, err error)
- func (api *API) DecodeTX(hex string) (trans TXSkel, err error)
- func (api *API) DeleteAddrWallet(name string, addrs []string) (err error)
- func (api *API) DeleteHDWallet(name string) (err error)
- func (api *API) DeleteHook(id string) (err error)
- func (api *API) DeleteMeta(hash string, kind string) (err error)
- func (api *API) DeletePayFwd(id string) (err error)
- func (api *API) DeleteWallet(name string) (err error)
- func (api *API) DeriveAddrHDWallet(name string, count int, isSub bool, subchainIndex int) (wal HDWallet, err error)
- func (api *API) Faucet(a AddrKeychain, amount int) (txhash string, err error)
- func (api *API) GenAddrKeychain() (pair AddrKeychain, err error)
- func (api *API) GenAddrMultisig(multi AddrKeychain) (addr AddrKeychain, err error)
- func (api *API) GenAddrWallet(name string) (wal Wallet, addr AddrKeychain, err error)
- func (api *API) GenAssetKeychain() (pair AddrKeychain, err error)
- func (api *API) GetAddr(hash string) (addr Addr, err error)
- func (api *API) GetAddrBal(hash string) (addr Addr, err error)
- func (api *API) GetAddrBalCustom(hash string, omitWalletAddr bool) (addr Addr, err error)
- func (api *API) GetAddrCustom(hash string, unspent bool, confirms int, before int, after int, limit int, ...) (addr Addr, err error)
- func (api *API) GetAddrFull(hash string) (addr Addr, err error)
- func (api *API) GetAddrFullCustom(hash string, hex bool, confirms int, before int, after int, limit int, ...) (addr Addr, err error)
- func (api *API) GetAddrFullNext(this Addr) (next Addr, err error)
- func (api *API) GetAddrHDWallet(name string, used bool, unused bool, zero bool, nonzero bool) (addrs HDWallet, err error)
- func (api *API) GetAddrNext(this Addr) (next Addr, err error)
- func (api *API) GetAddrWallet(name string, used bool, unused bool, zero bool, nonzero bool) (addrs []string, err error)
- func (api *API) GetAssetAddr(assetID, oapAddr string) (addr Addr, err error)
- func (api *API) GetAssetTX(assetID, hash string) (tx OAPTX, err error)
- func (api *API) GetBlock(height int, hash string) (block Block, err error)
- func (api *API) GetBlockNextTXs(this Block) (next Block, err error)
- func (api *API) GetBlockPage(height int, hash string, txstart int, limit int) (block Block, err error)
- func (api *API) GetChain() (chain Blockchain, err error)
- func (api *API) GetHDWallet(name string) (wal HDWallet, err error)
- func (api *API) GetHook(id string) (hook Hook, err error)
- func (api *API) GetMeta(hash string, kind string, private bool) (meta map[string]string, err error)
- func (api *API) GetPayFwd(id string) (payment PayFwd, err error)
- func (api *API) GetTX(hash string) (tx TX, err error)
- func (api *API) GetTXConf(hash string) (conf TXConf, err error)
- func (api *API) GetTXCustom(hash string, limit int, instart int, outstart int, includeHex bool, ...) (tx TX, err error)
- func (api *API) GetUnTX() (txs []TX, err error)
- func (api *API) GetWallet(name string) (wal Wallet, err error)
- func (api *API) IssueAsset(issue OAPIssue) (tx OAPTX, err error)
- func (api *API) ListAssetTXs(assetID string) (txs []string, err error)
- func (api *API) ListHDWallets() (names []string, err error)
- func (api *API) ListHooks() (hooks []Hook, err error)
- func (api *API) ListPayFwds() (payments []PayFwd, err error)
- func (api *API) ListWallets() (names []string, err error)
- func (api *API) NewTX(trans TX, verify bool) (skel TXSkel, err error)
- func (api *API) PushTX(hex string) (trans TXSkel, err error)
- func (api *API) PutMeta(hash string, kind string, private bool, meta map[string]string) (err error)
- func (api *API) SendMicro(mic MicroTX) (result MicroTX, err error)
- func (api *API) SendTX(skel TXSkel) (trans TXSkel, err error)
- func (api *API) TransferAsset(issue OAPIssue, assetID string) (tx OAPTX, err error)
- type Addr
- type AddrKeychain
- type Block
- type Blockchain
- type HDWallet
- type Hook
- type MicroTX
- type NullData
- type OAPIssue
- type OAPTX
- type PayFwd
- type Payback
- type TX
- type TXConf
- type TXInput
- type TXOutput
- type TXRef
- type TXSkel
- type Wallet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
Token, Coin, Chain string
}
API stores your BlockCypher Token, and the coin/chain you're querying. Coins can be "btc","bcy","ltc", and "doge". Chains can be "main", "test3", or "test", depending on the Coin. Check http://dev.blockcypher.com/ for more information. All your credentials are stored within an API struct, as are many of the API methods. You can allocate an API struct like so:
bc = gobcy.API{"your-api-token","btc","main"}
Then query as you like:
chain = bc.GetChain()
func (*API) AddAddrWallet ¶
AddAddrWallet adds a slice of addresses to a named Wallet, associated with the API token/coin/chain. In addition to your list of addresses to add, takes one additional parameter:
"omitAddr," if true will omit wallet addresses in your response. Useful to speed up the API call for larger wallets.
func (*API) CreateHDWallet ¶
CreateHDWallet creates a public-address watching HDWallet associated with this token/coin/chain, usable anywhere in the API where an Address might be used (just use the wallet name instead). For example, with checking a wallet name balance:
addr, err := api.GetAddrBal("your-hd-wallet-name")
func (*API) CreateHook ¶
CreateHook creates a new WebHook associated with your API.Token, and returns a WebHook with a BlockCypher-assigned id.
func (*API) CreatePayFwd ¶ added in v1.0.1
CreatePayFwd creates a new PayFwd forwarding request associated with your API.Token, and returns a PayFwd with a BlockCypher-assigned id.
func (*API) CreateWallet ¶
CreateWallet creates a public-address watching wallet associated with this token/coin/chain, usable anywhere in the API where an Address might be used (just use the wallet name instead). For example, with checking a wallet name balance:
addr, err := api.GetAddrBal("your-wallet-name")
func (*API) DecodeTX ¶
DecodeTX takes a hex-encoded transaction string and decodes it into a TX object, without sending it along to the Coin/Chain network.
func (*API) DeleteAddrWallet ¶
DeleteAddrWallet deletes a slice of addresses associated with a named Wallet, associated with the API token/coin/chain.
func (*API) DeleteHDWallet ¶
DeleteHDWallet deletes a named HDWallet associated with the API token/coin/chain.
func (*API) DeleteHook ¶
DeleteHook deletes a WebHook notification from BlockCypher's database, based on its id.
func (*API) DeleteMeta ¶ added in v1.1.0
DeleteMeta deletes ALL PRIVATE BlockCypher-stored metadata associated with the hash of the given blockchain object. "Kind" describes the blockchain object you're querying:
"addr" (for an address) "tx" (for a transaction) "block" (for a block)
Public metadata cannot be deleted; it is immutable.
func (*API) DeletePayFwd ¶ added in v1.0.1
DeletePayFwd deletes a PayFwd request from BlockCypher's database, based on its id.
func (*API) DeleteWallet ¶
DeleteWallet deletes a named wallet associated with the API token/coin/chain.
func (*API) DeriveAddrHDWallet ¶
func (api *API) DeriveAddrHDWallet(name string, count int, isSub bool, subchainIndex int) (wal HDWallet, err error)
DeriveAddrHDWallet derives a new address within the named Wallet, associated with the API token/coin/chain. It will only return a partial HDWallet, ONLY containing the new address derived. Has two parameters: "count," number of addresses to derive. Default is one. "isSub," true if deriving an address on a subchain.
if false, address will be generated on the first chain in the HDWallet.
"subchainIndex," Derives address(es) on this specific subchain. Only used
if isSubchain is true.
func (*API) Faucet ¶
func (api *API) Faucet(a AddrKeychain, amount int) (txhash string, err error)
Faucet funds the AddrKeychain with an amount. Only works on BlockCypher's Testnet and Bitcoin Testnet3. Returns the transaction hash funding your AddrKeychain.
func (*API) GenAddrKeychain ¶
func (api *API) GenAddrKeychain() (pair AddrKeychain, err error)
GenAddrKeychain generates a public/private key pair for use with transactions within the specified coin/chain. Please note that this call must be made over SSL, and it is not recommended to keep large amounts in these addresses, or for very long.
func (*API) GenAddrMultisig ¶
func (api *API) GenAddrMultisig(multi AddrKeychain) (addr AddrKeychain, err error)
GenAddrMultisig generates a P2SH multisignature address using an array of PubKeys and the ScriptType from a AddrKeychain. Other fields are ignored, and the ScriptType must be a "multisig-n-of-m" type. Returns an AddrKeychain with the same PubKeys, ScriptType, and the proper P2SH address in the AddrKeychain's address field.
func (*API) GenAddrWallet ¶
func (api *API) GenAddrWallet(name string) (wal Wallet, addr AddrKeychain, err error)
GenAddrWallet generates a new address within the named Wallet, associated with the API token/coin/chain. Also returns the private/WIF/public key of address via an Address Keychain.
func (*API) GenAssetKeychain ¶ added in v1.1.0
func (api *API) GenAssetKeychain() (pair AddrKeychain, err error)
GenAssetKeychain generates a public/private key pair, alongside an associated OAPAddress for use in the Asset API.
func (*API) GetAddr ¶
GetAddr returns information for a given public address, including a slice of confirmed and unconfirmed transaction outpus via the TXRef arrays in the Address type. Returns more information than GetAddrBal, but slightly slower.
func (*API) GetAddrBal ¶
GetAddrBal returns balance information for a given public address. Fastest Address API call, but does not include transaction details.
func (*API) GetAddrBalCustom ¶
GetAddrBalCustom returns balance information for a given public address. Fastest Address API call, but does not include transaction details. Takes one additional parameter compared to GetAddrBal:
"omitWalletAddr," if true will omit wallet addresses if you're querying a wallet instead of an address. Useful to speed up the API call for larger wallets.
func (*API) GetAddrCustom ¶
func (api *API) GetAddrCustom(hash string, unspent bool, confirms int, before int, after int, limit int, omitWalletAddr bool, includeConfidence bool) (addr Addr, err error)
GetAddrCustom returns information for a given public address, including a slice of confirmed and unconfirmed transaction outpus via the TXRef arrays in the Address type. Takes 5 additional parameters compared to GetAddr:
"unspent," which if true will only return TXRefs that are unpsent outputs (UTXOs). "confirms," which will only return TXRefs that have reached this number of confirmations or more. Set it to 0 to ignore this parameter. "before," which will only return transactions below this height in the blockchain. Useful for paging. Set it to 0 to ignore this parameter. "after," which will only return transaction above this height in the blockchain. Useful for paging. Set it to 0 to ignore this parameter. "limit," which return this number of TXRefs per call. The default is 50, maximum is 200. Set it to 0 to ignore this parameter and use the API-set default. "omitWalletAddr," if true will omit wallet addresses if you're querying a wallet instead of an address. Useful to speed up the API call for larger wallets. "includeConfidence," if true, includes confidence information for unconfirmed transactions.
func (*API) GetAddrFull ¶
GetAddrFull returns information for a given public address, including a slice of TXs associated with this address. Returns more data than GetAddr since it includes full transactions, but slowest Address query.
func (*API) GetAddrFullCustom ¶
func (api *API) GetAddrFullCustom(hash string, hex bool, confirms int, before int, after int, limit int, omitWalletAddr bool, includeConfidence bool) (addr Addr, err error)
GetAddrFullCustom returns information for a given public address, including a slice of TXs associated with this address. Returns more data than GetAddr since it includes full transactions, but slower. Takes 4 additional parameters compared to GetAddrFull:
"hex," which if true will return the full hex-encoded raw transaction for each TX. False by default. "confirms," which will only return TXRefs that have reached this number of confirmations or more. Set it to 0 to ignore this parameter. "before," which will only return transactions below this height in the blockchain. Useful for paging. Set it to 0 to ignore this parameter. "after," which will only return transaction above this height in the blockchain. Useful for paging. Set it to 0 to ignore this parameter. "limit," which return this number of TXs per call. The default is 10, maximum is 50. Set it to 0 to ignore this parameter and use the API-set default. "omitWalletAddr," if true will omit wallet addresses if you're querying a wallet instead of an address. Useful to speed up the API call for larger wallets. "includeConfidence," if true, includes confidence information for unconfirmed transactions.
func (*API) GetAddrFullNext ¶ added in v1.1.0
GetAddrFullNext returns a given Addr's next page of TXs, if Addr.HasMore is true. If HasMore is false, will return an error. It assumes default API flags, like GetAddrFull.
func (*API) GetAddrHDWallet ¶
func (api *API) GetAddrHDWallet(name string, used bool, unused bool, zero bool, nonzero bool) (addrs HDWallet, err error)
GetAddrHDWallet returns addresses associated with a named HDWallet, associated with the API token/coin/chain. Offers 4 parameters for customization:
"used," if true will return only used addresses "unused," if true will return only unused addresses "zero", if true will return only zero balance addresses "nonzero", if true will return only nonzero balance addresses
"used" and "unused" cannot be true at the same time; the SDK will throw an error. "zero" and "nonzero" cannot be true at the same time; the SDK will throw an error.
func (*API) GetAddrNext ¶ added in v1.1.0
GetAddrNext returns a given Addr's next page of TXRefs, if Addr.HasMore is true. If HasMore is false, will return an error. It assumes default API flags, like GetAddr.
func (*API) GetAddrWallet ¶
func (api *API) GetAddrWallet(name string, used bool, unused bool, zero bool, nonzero bool) (addrs []string, err error)
GetAddrWallet returns a slice of addresses associated with a named Wallet, associated with the API token/coin/chain. Offers 4 parameters for customization:
"used," if true will return only used addresses "unused," if true will return only unused addresses "zero", if true will return only zero balance addresses "nonzero", if true will return only nonzero balance addresses
"used" and "unused" cannot be true at the same time; the SDK will throw an error. "zero" and "nonzero" cannot be true at the same time; the SDK will throw an error.
func (*API) GetAssetAddr ¶ added in v1.1.0
GetAssetAddr returns an Addr associated with the given assetID and oapAddr. Note that while it returns an Address, anything that would have represented "satoshis" now represents "amount of asset."
func (*API) GetAssetTX ¶ added in v1.1.0
GetAssetTX returns a OAPTX associated with the given assetID and transaction hash.
func (*API) GetBlock ¶
GetBlock returns a Block based on either height or hash. If both height and hash are sent, it will throw an error.
func (*API) GetBlockNextTXs ¶
GetBlockNextTXs returns the the next page of TXids based on the NextTXs URL in this Block. If NextTXs is empty, this will return an error.
func (*API) GetBlockPage ¶
func (api *API) GetBlockPage(height int, hash string, txstart int, limit int) (block Block, err error)
GetBlockPage returns a Block based on either height or hash, and includes custom variables for txstart/limit of txs. If both height and hash are sent, it will throw an error. If txstart/limit = 0, it will use the API-defaults for both.
func (*API) GetChain ¶
func (api *API) GetChain() (chain Blockchain, err error)
GetChain returns the current state of the configured Coin/Chain.
func (*API) GetHDWallet ¶
GetHDWallet gets a HDWallet based on its name and the associated API token/coin/chain.
func (*API) GetMeta ¶ added in v1.1.0
GetMeta gets BlockCypher-stored metadata associated with the hash of the given blockchain object. "Kind" describes the blockchain object you're querying:
"addr" (for an address) "tx" (for a transaction) "block" (for a block)
If private is false, will retrieve publicly stored metadata. If private is true, will retrieve privately stored metadata associated with your token.
func (*API) GetTXConf ¶
GetTXConf returns a TXConf containing a float [0,1] that represents BlockCypher's confidence that an unconfirmed transaction won't be successfully double-spent against. If the confidence is 1, the transaction has already been confirmed.
func (*API) GetTXCustom ¶ added in v1.1.1
func (api *API) GetTXCustom(hash string, limit int, instart int, outstart int, includeHex bool, includeConfidence bool) (tx TX, err error)
GetTXCustom returns a TX represented by the passed hash, but takes additional parameters compared to GetTX:
"limit," limits number of inputs/outputs. If not set, defaults to 20. Set it 0 to ignore this parameter. "instart," filters TX to only include inputs starting at this index. Set it 0 to ignore this parameter. "outstart", filters TX to only include outputs starting at this index. Set it 0 to ignore this parameter. "includeHex", if true, includes raw-encoded hex transaction. "includeConfidence," if true, includes confidence information for unconfirmed transactions.
func (*API) GetWallet ¶
GetWallet gets a Wallet based on its name, the associated API token/coin/chain, and whether it's an HD wallet or not.
func (*API) IssueAsset ¶ added in v1.1.0
IssueAsset issues new assets onto an Open Asset Address, using a private key associated with a funded address on the underlying blockchain.
func (*API) ListAssetTXs ¶ added in v1.1.0
ListAssetTXs lists the transaction hashes associated with the given assetID.
func (*API) ListHDWallets ¶
ListHDWallets lists all known HDWallets associated with this token/coin/chain.
func (*API) ListPayFwds ¶ added in v1.0.1
ListPayFwds returns a PayFwds slice associated with your API.Token.
func (*API) ListWallets ¶
ListWallets lists all known Wallets associated with this token/coin/chain.
func (*API) NewTX ¶
NewTX takes a partially formed TX and returns a TXSkel with the data that needs to be signed. Can use TempNewTX or TempMultiTX to streamline input transaction, or customize transaction as described in the BlockCypher docs: http://dev.blockcypher.com/#customizing-transaction-requests If verify is true, will include "ToSignTX," which can be used to locally verify the "ToSign" data is valid.
func (*API) PushTX ¶
PushTX takes a hex-encoded transaction string and pushes it directly to the Coin/Chain network.
func (*API) PutMeta ¶ added in v1.1.0
PutMeta puts BlockCypher-stored metadata associated with the hash of the given blockchain object. "Kind" describes the blockchain object you're querying:
"addr" (for an address) "tx" (for a transaction) "block" (for a block)
If private is false, will set publicly stored metadata. If private is true, will set privately stored metadata associated with your token.
func (*API) SendMicro ¶
SendMicro sends a Micro through the Coin/Chain network. It will return a Micro with a proper hash if it successfully sent. If using public (instead of private) keys, you'll need to sign the returned Micro (using the *Micro.Sign method) and run SendMicro again with the signed data, which will then return a proper hash.
type Addr ¶
type Addr struct { Address string `json:"address,omitempty"` Wallet Wallet `json:"wallet,omitempty"` HDWallet HDWallet `json:"hd_wallet,omitempty"` TotalReceived int `json:"total_received"` TotalSent int `json:"total_sent"` Balance int `json:"balance"` UnconfirmedBalance int `json:"unconfirmed_balance"` FinalBalance int `json:"final_balance"` NumTX int `json:"n_tx"` UnconfirmedNumTX int `json:"unconfirmed_n_tx"` FinalNumTX int `json:"final_n_tx"` TXs []TX `json:"txs,omitempty"` TXRefs []TXRef `json:"txrefs,omitempty"` UnconfirmedTXRefs []TXRef `json:"unconfirmed_txrefs,omitempty"` HasMore bool `json:"hasMore,omitempty"` }
Addr represents information about the state of a public address.
type AddrKeychain ¶
type AddrKeychain struct { Address string `json:"address,omitempty"` Private string `json:"private,omitempty"` Public string `json:"public,omitempty"` Wif string `json:"wif,omitempty"` PubKeys []string `json:"pubkeys,omitempty"` ScriptType string `json:"script_type,omitempty"` OriginalAddress string `json:"original_address,omitempty"` OAPAddress string `json:"oap_address,omitempty"` }
AddrKeychain represents information about a generated public-private key pair from BlockCypher's address generation API. Large amounts are not recommended to be stored with these addresses.
type Block ¶
type Block struct { Hash string `json:"hash"` Height int `json:"height"` Depth int `json:"depth"` Chain string `json:"chain"` Total int `json:"total"` Fees int `json:"fees"` Ver int `json:"ver"` Time time.Time `json:"time"` ReceivedTime time.Time `json:"received_time"` RelayedBy string `json:"relayed_by,omitempty"` Bits int `json:"bits"` Nonce int `json:"nonce"` NumTX int `json:"n_tx"` PrevBlock string `json:"prev_block"` MerkleRoot string `json:"mrkl_root"` TXids []string `json:"txids"` NextTXs string `json:"next_txids"` }
Block represents information about the state of a given block in a blockchain.
type Blockchain ¶
type Blockchain struct { Name string `json:"name"` Height int `json:"height"` Hash string `json:"hash"` Time time.Time `json:"time"` PrevHash string `json:"previous_hash"` PeerCount int `json:"peer_count"` HighFee int `json:"high_fee_per_kb"` MediumFee int `json:"medium_fee_per_kb"` LowFee int `json:"low_fee_per_kb"` UnconfirmedCount int `json:"unconfirmed_count"` LastForkHeight int `json:"last_fork_height"` LastForkHash string `json:"last_fork_hash"` }
Blockchain represents information about the state of a blockchain.
type HDWallet ¶
type HDWallet struct { Name string `json:"name,omitempty"` ExtPubKey string `json:"extended_public_key,omitempty"` SubchainIndexes []int `json:"subchain_indexes,omitempty"` Chains []struct { ChainAddr []struct { Address string `json:"address,omitempty"` Path string `json:"path,omitempty"` Public string `json:"public,omitempty"` } `json:"chain_addresses,omitempty"` Index int `json:"index,omitempty"` } `json:"chains,omitempty"` }
HDWallet represents information about a Hierarchical Deterministic (HD) wallet. Like regular Wallets, HDWallets can be used wherever an address can be used within the API.
type Hook ¶
type Hook struct { ID string `json:"id,omitempty"` Event string `json:"event"` Hash string `json:"hash,omitempty"` WalletName string `json:"wallet_name,omitempty"` Address string `json:"address,omitempty"` Confirmations int `json:"confirmations,omitempty"` Confidence float32 `json:"confidence,omitempty"` Script string `json:"script,omitempty"` URL string `json:"url,omitempty"` CallbackErrs int `json:"callback_errors,omitempty"` }
Hook represents a WebHook/WebSockets event. BlockCypher supports the following events:
Event = "unconfirmed-tx" Event = "new-block" Event = "confirmed-tx" Event = "tx-confirmation" Event = "double-spend-tx" Event = "tx-confidence"
Hash, Address, and Script are all optional; creating a WebHook with any of them will filter the resulting notifications, if appropriate. ID is returned by BlockCyphers servers after Posting a new WebHook; you shouldn't manually generate this field.
type MicroTX ¶
type MicroTX struct { //Only one of Pubkey/Private/Wif is required Pubkey string `json:"from_pubkey,omitempty"` Priv string `json:"from_private,omitempty"` Wif string `json:"from_wif,omitempty"` ToAddr string `json:"to_address"` Value int `json:"value_satoshis"` ChangeAddr string `json:"change_address,omitempty"` Wait bool `json:"wait_guarantee,omitempty"` ToSign []string `json:"tosign,omitempty"` Signatures []string `json:"signatures,omitempty"` Hash string `json:"hash,omitempty"` Inputs []struct { PrevHash string `json:"prev_hash"` OutputIndex int `json:"output_index"` } `json:"inputs,omitempty"` Outputs []struct { Value int `json:"value"` Address string `json:"address"` } `json:"outputs,omitempty"` Fees int `json:"fees,omitempty"` }
MicroTX represents a microtransaction. For small-value transactions, BlockCypher will sign the transaction on your behalf, with your private key (if provided). Setting a separate change address is recommended. Where your application model allows it, consider only using public keys with microtransactions, and sign the microtransaction with your private key (without sending to BlockCypher's server).
type NullData ¶
type NullData struct { Data string `json:"data"` Encoding string `json:"encoding,omitempty"` Hash string `json:"hash,omitempty"` }
NullData represents the call and return to BlockCypher's Data API, allowing you to embed up to 80 bytes into a blockchain via an OP_RETURN.
type OAPIssue ¶ added in v1.1.0
type OAPIssue struct { Priv string `json:"from_private"` ToAddr string `json:"to_address"` Amount int `json:"amount"` Metadata string `json:"metadata,omitempty"` }
OAPIssue represents a request for issuance or transfer of an Open Asset on a blockchain.
type OAPTX ¶ added in v1.1.0
type OAPTX struct { Ver int `json:"ver"` AssetID string `json:"assetid"` Hash string `json:"hash"` Confirmed time.Time `json:"confirmed,omitempty"` Received time.Time `json:"received"` Metadata string `json:"oap_meta,omitempty"` DoubleSpend bool `json:"double_spend"` Inputs []struct { PrevHash string `json:"prev_hash"` OutputIndex int `json:"output_index"` OAPAddress string `json:"address"` OutputValue int `json:"output_value"` } `json:"inputs"` Outputs []struct { OAPAddress string `json:"address"` Value int `json:"value"` OrigOutputIndex int `json:"original_output_index"` } `json:"outputs"` }
OAPTX represents an Open Asset protocol transaction, generated when issuing or transferring assets.
type PayFwd ¶
type PayFwd struct { ID string `json:"id,omitempty"` Destination string `json:"destination"` InputAddr string `json:"input_address,omitempty"` ProcessAddr string `json:"process_fees_address,omitempty"` ProcessPercent float64 `json:"process_fees_percent,omitempty"` ProcessValue int `json:"process_fees_satoshis,omitempty"` CallbackURL string `json:"callback_url,omitempty"` EnableConfirm bool `json:"enable_confirmations,omitempty"` MiningFees int `json:"mining_fees_satoshis,omitempty"` TXHistory []string `json:"transactions,omitempty"` }
PayFwd represents a reference to a Payment Forwarding request.
type Payback ¶
type Payback struct { Value int `json:"value"` Destination string `json:"destination"` DestHash string `json:"transaction_hash"` InputAddr string `json:"input_address"` InputHash string `json:"input_transaction_hash"` }
Payback represents a Payment Forwarding Callback. It's more fun to call it a "payback."
type TX ¶
type TX struct { BlockHash string `json:"block_hash,omitempty"` BlockHeight int `json:"block_height,omitempty"` Hash string `json:"hash,omitempty"` Addresses []string `json:"addresses,omitempty"` Total int `json:"total,omitempty"` Fees int `json:"fees,omitempty"` Size int `json:"size"` Preference string `json:"preference,omitempty"` RelayedBy string `json:"relayed_by,omitempty"` Received time.Time `json:"received,omitempty"` Confirmed time.Time `json:"confirmed,omitempty"` Confirmations int `json:"confirmations,omitempty"` Confidence float64 `json:"confidence,omitempty"` Ver int `json:"ver,omitempty"` LockTime int `json:"lock_time,omitempty"` DoubleSpend bool `json:"double_spend,omitempty"` DoubleOf string `json:"double_of,omitempty"` ReceiveCount int `json:"receive_count,omitempty"` VinSize int `json:"vin_sz,omitempty"` VoutSize int `json:"vout_sz,omitempty"` Hex string `json:"hex,omitempty"` DataProtocol string `json:"data_protocol,omitempty"` ChangeAddress string `json:"change_address,omitempty"` NextInputs string `json:"next_inputs,omitempty"` NextOutputs string `json:"next_outputs,omitempty"` Inputs []TXInput `json:"inputs"` Outputs []TXOutput `json:"outputs"` }
TX represents information about the state of a given transaction in a blockchain.
func TempMultiTX ¶
func TempMultiTX(inAddr string, outAddr string, amount int, n int, pubkeys []string) (trans TX, err error)
TempMultiTX creates a skeleton multisig transaction, suitable for use in NewTX. If outAddr == "", then the returned TX will be a skeleton to fund a multisig address. If inAddr == "", then the returned TX will be a skeleton to send from a multisig address (/series of public keys). n represents the number of valid signatures required, and m is derived from the number of pubkeys.
type TXConf ¶
type TXConf struct { Age int `json:"age_millis"` ReceiveCount int `json:"receive_count,omitempty"` Confidence float64 `json:"confidence"` TXHash string `json:"txhash"` }
TXConf represents information about the confidence of an unconfirmed transaction.
type TXInput ¶
type TXInput struct { PrevHash string `json:"prev_hash,omitempty"` OutputIndex int `json:"output_index,omitempty"` OutputValue int `json:"output_value,omitempty"` Addresses []string `json:"addresses"` Sequence int `json:"sequence,omitempty"` ScriptType string `json:"script_type,omitempty"` Script string `json:"script,omitempty"` Age int `json:"age,omitempty"` WalletName string `json:"wallet_name,omitempty"` }
TXInput represents the state of a transaction input
type TXOutput ¶
type TXOutput struct { SpentBy string `json:"spent_by,omitempty"` Value int `json:"value"` Addresses []string `json:"addresses"` ScriptType string `json:"script_type,omitempty"` Script string `json:"script,omitempty"` DataHex string `json:"data_hex,omitempty"` DataString string `json:"data_string,omitempty"` }
TXOutput represents the state of a transaction output
type TXRef ¶
type TXRef struct { Address string `json:"address,omitempty"` BlockHeight int `json:"block_height"` TXHash string `json:"tx_hash"` TXInputN int `json:"tx_input_n"` TXOutputN int `json:"tx_output_n"` Value int `json:"value"` Pref string `json:"preference"` Spent bool `json:"spent"` DoubleSpend bool `json:"double_spend"` DoubleOf string `json:"double_of,omitempty"` Confirmations int `json:"confirmations"` Script string `json:"script,omitempty"` RefBalance int `json:"ref_balance,omitempty"` Confidence float64 `json:"confidence,omitempty"` Confirmed time.Time `json:"confirmed,omitempty"` SpentBy string `json:"spent_by,omitempty"` Received time.Time `json:"received,omitempty"` ReceivedCount int `json:"received_count,omitempty"` }
TXRef represents summarized data about a transaction input or output.
type TXSkel ¶
type TXSkel struct { Trans TX `json:"tx"` ToSign []string `json:"tosign"` Signatures []string `json:"signatures"` PubKeys []string `json:"pubkeys,omitempty"` ToSignTX []string `json:"tosign_tx,omitempty"` Errors []struct { Error string `json:"error,omitempty"` } `json:"errors,omitempty"` }
TXSkel represents the return call to BlockCypher's txs/new endpoint, and includes error information, hex transactions that need to be signed, and space for the signed transactions and associated public keys.