# README
btcutil
Package btcutil provides bitcoin-specific convenience functions and types.
A comprehensive suite of tests is provided to ensure proper functionality. See test_coverage.txt
for the gocov coverage report. Alternatively, if you are running a POSIX OS, you can run the cov_report.sh
script for a real-time report.
This package was developed for pod, an alternative full-node implementation of bitcoin which is under active development by Conformal. Although it was primarily written for pod, this package has intentionally been designed so it can be used as a standalone package for any projects needing the functionality provided.
Installation and Updating
$ go get -u github.com/p9c/util
License
Package btcutil is licensed under the copyfree ISC License.
# Packages
Package base58 provides an API for working with modified base58 and Base58Check encodings.
Package bech32 provides a Go implementation of the bech32 format specified in BIP 173.
No description provided by the author
No description provided by the author
Package ec implements support for the elliptic curves needed for bitcoin.
Package gcs provides an API for building and using a Golomb-coded set filter.
Package graph turns hexadecimal strings into visual representation of the magnitude of digits.
Package hdkeychain provides an API for bitcoin hierarchical deterministic extended keys (BIP0032).
Package helpers provides convenience functions to simplify wallet code.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Package treap implements a treap data structure that is used to hold ordered key/value pairs using a combination of binary search tree and heap semantics.
Package zero contains functions to clear data from byte slices and multi-precision integers.
# Functions
DecodeAddress decodes the string encoding of an address and returns the Address if addr is a valid encoding for a known address type.
DecodeWIF creates a new WIF structure by decoding the string encoding of the import format.
Hash160 calculates the hash ripemd160(sha256(b)).
NewAddressPubKey returns a new AddressPubKey which represents a pay-to-pubkey address.
NewAddressPubKeyHash returns a new AddressPubKeyHash.
NewAddressScriptHash returns a new AddressScriptHash.
NewAddressScriptHashFromHash returns a new AddressScriptHash.
NewAddressWitnessPubKeyHash returns a new AddressWitnessPubKeyHash.
NewAddressWitnessScriptHash returns a new AddressWitnessPubKeyHash.
NewAmount creates an Amount from a floating point value representing some value in bitcoin.
NewBlock returns a new instance of a bitcoin block given an underlying wire.MsgBlock.
NewBlockFromBlockAndBytes returns a new instance of a bitcoin block given an underlying wire.MsgBlock and the serialized bytes for it.
NewBlockFromBytes returns a new instance of a bitcoin block given the serialized bytes.
NewBlockFromReader returns a new instance of a bitcoin block given a Reader to deserialize the block.
NewTLSCertPair returns a new PEM-encoded x.509 certificate pair based on a 521-bit ECDSA private key.
NewTx returns a new instance of a bitcoin transaction given an underlying wire.MsgTx.
NewTxFromBytes returns a new instance of a bitcoin transaction given the serialized bytes.
NewTxFromReader returns a new instance of a bitcoin transaction given a Reader to deserialize the transaction.
NewWIF creates a new WIF structure to export an address and its private key as a string encoded in the Wallet Import Format.
# Constants
These constants define various units used when describing a bitcoin monetary amount.
These constants define various units used when describing a bitcoin monetary amount.
These constants define various units used when describing a bitcoin monetary amount.
These constants define various units used when describing a bitcoin monetary amount.
These constants define various units used when describing a bitcoin monetary amount.
These constants define various units used when describing a bitcoin monetary amount.
BlockHeightUnknown is the value returned for a block height that is unknown.
MaxSatoshi is the maximum transaction amount allowed in satoshi.
PKFCompressed indicates the pay-to-pubkey address format is a compressed public key.
PKFHybrid indicates the pay-to-pubkey address format is a hybrid public key.
PKFUncompressed indicates the pay-to-pubkey address format is an uncompressed public key.
SatoshiPerBitcent is the number of satoshi in one bitcoin cent.
SatoshiPerBitcoin is the number of satoshi in one bitcoin (1 DUO).
TxIndexUnknown is the value returned for a transaction index that is unknown.
# Variables
ErrAddressCollision describes an error where an address can not be uniquely determined as either a pay-to-pubkey-hash or pay-to-script-hash address since the leading identifier is used for describing both address kinds, but for different networks.
ErrChecksumMismatch describes an error where decoding failed due to a bad checksum.
ErrMalformedPrivateKey describes an error where a WIF-encoded private key cannot be decoded due to being improperly formatted.
ErrUnknownAddressType describes an error where an address can not decoded as a specific address type due to the string encoding begining with an identifier byte unknown to any standard or registered (via chaincfg.Register) network.
# Structs
AddressPubKey is an Address for a pay-to-pubkey transaction.
AddressPubKeyHash is an Address for a pay-to-pubkey-hash (P2PKH) transaction.
AddressScriptHash is an Address for a pay-to-script-hash (P2SH) transaction.
AddressWitnessPubKeyHash is an Address for a pay-to-witness-pubkey-hash (P2WPKH) output.
AddressWitnessScriptHash is an Address for a pay-to-witness-script-hash (P2WSH) output.
Block defines a bitcoin block that provides easier and more efficient manipulation of raw blocks.
Tx defines a bitcoin transaction that provides easier and more efficient manipulation of raw transactions.
WIF contains the individual components described by the Wallet Import Format (WIF).
# Interfaces
Address is an interface type for any type of destination a transaction output may spend to.
# Type aliases
Amount represents the base bitcoin monetary unit (colloquially referred to as a `Satoshi').
AmountUnit describes a method of converting an Amount to something other than the base unit of a bitcoin.
OutOfRangeError describes an error due to accessing an element that is out of range.
PubKeyFormat describes what format to use for a pay-to-pubkey address.
UnsupportedWitnessProgLenError describes an error where a segwit address being decoded has an unsupported witness program length.
UnsupportedWitnessVerError describes an error where a segwit address being decoded has an unsupported witness version.