portal

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBTCClientNotInitialized is thrown when trying to call a non-initialized BTCClient.
	ErrBTCClientNotInitialized = fmt.Errorf("the btcClient has not been initialized")
)

Functions

func HashMerkleBranches

func HashMerkleBranches(left *chainhash.Hash, right *chainhash.Hash) *chainhash.Hash

HashMerkleBranches takes two hashes, treated as the left and right tree nodes, and returns the hash of their concatenation. This is a helper function used to aid in the generation of a merkle tree.

Types

type BTCClient

type BTCClient struct {
	// contains filtered or unexported fields
}

BTCClient implements a wrapped Go client for retrieving information of the BTC network.

func NewBTCMainNetClient

func NewBTCMainNetClient() (*BTCClient, error)

NewBTCMainNetClient returns a BTC main-net client.

func NewBTCTestNetClient

func NewBTCTestNetClient() (*BTCClient, error)

NewBTCTestNetClient returns a BTC test-net client.

func (*BTCClient) BuildMsgTxFromCypher

func (b *BTCClient) BuildMsgTxFromCypher(txHashStr string) (*wire.MsgTx, error)

BuildMsgTxFromCypher returns a wire.MsgTx given a BTC transaction hash.

func (*BTCClient) BuildProof

func (b *BTCClient) BuildProof(txHashStr string, blkHeight uint64) (string, error)

BuildProof constructs the proof for a BTC transaction hash.

func (*BTCClient) IsConfirmedTx

func (b *BTCClient) IsConfirmedTx(txHashStr string) (bool, uint64, error)

IsConfirmedTx returns a boolean indicator of whether a BTC txHashStr has been confirmed, and the block height at which the transaction was included.

type BTCProof

type BTCProof struct {
	MerkleProofs []*MerkleProof
	BTCTx        *wire.MsgTx
	BlockHash    *chainhash.Hash
}

BTCProof represents a Merkle proof for a BTC transaction.

type MerkleProof

type MerkleProof struct {
	ProofHash *chainhash.Hash
	IsLeft    bool
}

MerkleProof represents a Merkle path.

func BuildMerkleProof

func BuildMerkleProof(txHashes []*chainhash.Hash, targetedTxHash *chainhash.Hash) []*MerkleProof

BuildMerkleProof returns a list of MerkleProof of a transaction hash.

Jump to

Keyboard shortcuts

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