run

package
v0.0.0-...-2e64146 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTx

func CreateTx(config *txConfig) (*wire.MsgTx, error)

CreateTx is based on examples provided at https://medium.com/swlh/create-raw-bitcoin-transaction-and-sign-it-with-golang-96b5e10c30aa

func GetBlock

func GetBlock(cmd *cobra.Command, args []string) error

func Send

func Send(cmd *cobra.Command, args []string) error

func SignTx

func SignTx(privKey string, pkScript string, redeemTx *wire.MsgTx) error

func Utxo

func Utxo(cmd *cobra.Command, args []string) error

Types

type Block

type Block struct {
	Header       *BlockHeader `json:"header,omitempty" yaml:"header,omitempty"`
	Transactions []string     `json:"transactions,omitempty" yaml:"transactions,omitempty"`
}

Block defines a custom view of actual block in the blockchain

func Parse

func Parse(block *wire.MsgBlock, chainHash *chainhash.Hash) (*Block, error)

type BlockHeader

type BlockHeader struct {
	// Version of the block.  This is not the same as the protocol version.
	Version int32 `json:"version,omitempty" yaml:"version,omitempty"`

	// Hash of the block
	Hash string `json:"hash,omitempty" yaml:"hash,omitempty"`

	// NumContiguousZerosInHash is the number of trailing zeros in the binary version of the hash
	NumContiguousZerosInHash int `json:"numContiguousZerosInHash,omitempty" yaml:"numContiguousZerosInHash,omitempty"`

	// PrevBlock is the hash of the previous block header in the blockchain
	PrevBlock string `json:"prevBlock,omitempty" yaml:"prevBlock,omitempty"`

	// Merkle tree reference to hash of all transactions for the block.
	MerkleRoot string `json:"merkleRoot,omitempty" yaml:"merkleRoot,omitempty"`

	// Time the block was created.  This is, unfortunately, encoded as a
	// uint32 on the wire and therefore is limited to 2106.
	Timestamp time.Time `json:"timestamp,omitempty" yaml:"timestamp,omitempty"`

	// Difficulty target for the block.
	Bits uint32 `json:"bits,omitempty" yaml:"bits,omitempty"`

	// Nonce used to generate the block.
	Nonce uint32 `json:"nonce,omitempty" yaml:"nonce,omitempty"`
}

BlockHeader defines information about a block

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL