Documentation ¶
Index ¶
Constants ¶
View Source
const ( NetworkTypeEnvKey = "BTC_NETWORK_TYPE" NetworkTypeMain = "mainnet" NetworkTypeTest = "testnet" SatoshiPerBtc = 100000000 TxVersion int32 = 1 TxLockTime uint32 = 0 TxInSequence uint32 = 4294967295 CoinBaseTxid = "0000000000000000000000000000000000000000000000000000000000000000" AddressVersionMain byte = 0x00 AddressVersionTest byte = 0x6f PkhLength = 20 // 0x14 PubKeyLength = 65 // 0x41 )
Variables ¶
View Source
var (
ErrInvalidPkhLength = errors.New("invalid pkh length")
)
Functions ¶
func Sha256Double ¶ added in v0.2.0
func UseTestnet ¶
func UseTestnet() error
Types ¶
type Block ¶
type Block struct { *BlockHeader Txes []*Tx `json:"txes"` }
func NewBlockFromBytes ¶
func NewBlockFromHex ¶
type BlockHeader ¶
type BlockHeader struct { Version int32 `json:"version"` PrevBlockhash string `json:"prevBlock"` MerkleRoot string `json:"merkleRoot"` Timestamp uint32 `json:"timestamp"` Bits uint32 `json:"bits"` Nonce uint32 `json:"nonce"` }
func NewBlockHeaderFromBytes ¶
func NewBlockHeaderFromBytes(b []byte) (*BlockHeader, error)
func NewBlockHeaderFromHex ¶
func NewBlockHeaderFromHex(s string) (*BlockHeader, error)
func (*BlockHeader) Blockhash ¶
func (bh *BlockHeader) Blockhash() (string, error)
func (*BlockHeader) Bytes ¶
func (bh *BlockHeader) Bytes() ([]byte, error)
func (*BlockHeader) Hex ¶
func (bh *BlockHeader) Hex() (string, error)
type OpCode ¶
type OpCode byte
const ( Op0 OpCode = 0x00 OpFalse OpCode = 0x00 OpDataLenMin OpCode = 0x01 OpDataLenMax OpCode = 0x4b OpPushdata1 OpCode = 0x4c OpPushdata2 OpCode = 0x4d OpPushdata4 OpCode = 0x4e Op1 OpCode = 0x51 OpTrue OpCode = 0x51 OpReturn OpCode = 0x6a OpDrop OpCode = 0x75 OpDup OpCode = 0x76 OpEqualVerify OpCode = 0x88 OpHash160 OpCode = 0xa9 OpCheckSig OpCode = 0xac )
type Tx ¶
type Tx struct { Version int32 `json:"version"` TxIns []*TxIn `json:"txIns"` TxOuts []*TxOut `json:"txOuts"` LockTime uint32 `json:"lockTime"` }
func NewTxFromBytes ¶
func NewTxFromHex ¶
Click to show internal directories.
Click to hide internal directories.