auxpow

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxScriptSize is the maximum allowed length of a raw script.
	MaxScriptSize = 10000
)

Variables

View Source
var (
	AuxPowChainID = 1224
)

Functions

func BtcReadOutPoint

func BtcReadOutPoint(r io.Reader, op *BtcOutPoint) error

func BtcReadTxIn

func BtcReadTxIn(r io.Reader, ti *BtcTxIn) error

func BtcReadTxOut

func BtcReadTxOut(r io.Reader, to *BtcTxOut) error

func BtcWriteOutPoint

func BtcWriteOutPoint(w io.Writer, op *BtcOutPoint) error

func BtcWriteTxIn

func BtcWriteTxIn(w io.Writer, ti *BtcTxIn) error

func BtcWriteTxOut

func BtcWriteTxOut(w io.Writer, to *BtcTxOut) error

func GetExpectedIndex

func GetExpectedIndex(nonce uint32, chainID, h int) int

func GetMerkleRoot

func GetMerkleRoot(hash common.Uint256, merkleBranch []common.Uint256, index int) common.Uint256

Types

type AuxPow

type AuxPow struct {
	AuxMerkleBranch   []common.Uint256
	AuxMerkleIndex    int
	ParCoinbaseTx     BtcTx
	ParCoinBaseMerkle []common.Uint256
	ParMerkleIndex    int
	ParBlockHeader    BtcHeader
	ParentHash        common.Uint256
}

func GenerateAuxPow

func GenerateAuxPow(msgBlockHash Uint256) *AuxPow

func NewAuxPow

func NewAuxPow(AuxMerkleBranch []common.Uint256, AuxMerkleIndex int,
	ParCoinbaseTx BtcTx, ParCoinBaseMerkle []common.Uint256,
	ParMerkleIndex int, ParBlockHeader BtcHeader) *AuxPow

func (*AuxPow) Check

func (ap *AuxPow) Check(hashAuxBlock *common.Uint256, chainID int) bool

func (*AuxPow) Deserialize

func (ap *AuxPow) Deserialize(r io.Reader) error

func (*AuxPow) Serialize

func (ap *AuxPow) Serialize(w io.Writer) error

type BtcHeader

type BtcHeader struct {
	Version    uint32
	Previous   Uint256
	MerkleRoot Uint256
	Timestamp  uint32
	Bits       uint32
	Nonce      uint32
}

func (*BtcHeader) Deserialize

func (bh *BtcHeader) Deserialize(r io.Reader) error

func (*BtcHeader) Hash

func (bh *BtcHeader) Hash() Uint256

func (*BtcHeader) Serialize

func (bh *BtcHeader) Serialize(w io.Writer) error

type BtcOutPoint

type BtcOutPoint struct {
	Hash  common.Uint256
	Index uint32
}

type BtcTx

type BtcTx struct {
	Version  int32
	TxIn     []*BtcTxIn
	TxOut    []*BtcTxOut
	LockTime uint32
}

func NewBtcTx

func NewBtcTx(txIn []*BtcTxIn, txOut []*BtcTxOut) *BtcTx

func (*BtcTx) Deserialize

func (tx *BtcTx) Deserialize(r io.Reader) error

func (*BtcTx) Hash

func (tx *BtcTx) Hash() common.Uint256

func (*BtcTx) Serialize

func (tx *BtcTx) Serialize(w io.Writer) error

type BtcTxIn

type BtcTxIn struct {
	PreviousOutPoint BtcOutPoint
	SignatureScript  []byte
	Sequence         uint32
}

type BtcTxOut

type BtcTxOut struct {
	Value    int64
	PkScript []byte
}

Jump to

Keyboard shortcuts

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