bitcoin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ValuePrecision = 8
	ValueSatoshi   = 100000000
	ValueDust      = 1000

	TimeLockMinimum = time.Hour * 1
	TimeLockMaximum = time.Hour * 24 * 365

	ScriptPubKeyTypeWitnessKeyHash    = "witness_v0_keyhash"
	ScriptPubKeyTypeWitnessScriptHash = "witness_v0_scripthash"

	InputTypeP2WPKHAccoutant             = 1
	InputTypeP2WSHMultisigHolderSigner   = 2
	InputTypeP2WSHMultisigObserverSigner = 3

	MaxTransactionSequence = 0xffffffff
	MaxStandardTxWeight    = 300000

	TransactionConfirmations = 1
)

Variables

This section is empty.

Functions

func CheckFinalization

func CheckFinalization(num uint64, coinbase bool) bool

func CheckMultisigHolderSignerScript

func CheckMultisigHolderSignerScript(script []byte) bool

func EncodeAddress

func EncodeAddress(script []byte) (string, error)

func HashMessageForSignature

func HashMessageForSignature(msg string) []byte

func IsInsufficientInputError

func IsInsufficientInputError(err error) bool

func ParseAddress

func ParseAddress(addr string) (string, error)

func ParseSatoshi

func ParseSatoshi(amount string) int64

func ParseSequence

func ParseSequence(lock time.Duration) int64

func RPCEstimateSmartFee

func RPCEstimateSmartFee(rpc string) (int64, error)

func RPCGetBlockHash

func RPCGetBlockHash(rpc string, num int64) (string, error)

func RPCGetBlockHeight

func RPCGetBlockHeight(rpc string) (int64, error)

func RPCGetTransactionOutput

func RPCGetTransactionOutput(rpc, hash string, index int64) (*RPCTransaction, *Output, error)

func RPCGetTransactionSender

func RPCGetTransactionSender(rpc string, tx *RPCTransaction) (string, error)

func RPCSendRawTransaction

func RPCSendRawTransaction(rpc, raw string) (string, error)

func VerifyHolderKey

func VerifyHolderKey(public string) error

func VerifySignatureDER

func VerifySignatureDER(public string, msg, sig []byte) error

Types

type Input

type Input struct {
	TransactionHash string
	Index           uint32
	Satoshi         int64
	Script          []byte
	Sequence        uint32
	RouteBackup     bool
}

type Output

type Output struct {
	Address  string
	Satoshi  int64
	Height   uint64
	Coinbase bool
}

type PartiallySignedTransaction

type PartiallySignedTransaction struct {
	Hash   string
	Fee    int64
	Packet *psbt.Packet
}

func BuildPartiallySignedTransaction

func BuildPartiallySignedTransaction(mainInputs []*Input, feeInputs []*Input, outputs []*Output, fvb int64, rid []byte) (*PartiallySignedTransaction, error)

func UnmarshalPartiallySignedTransaction

func UnmarshalPartiallySignedTransaction(b []byte) (*PartiallySignedTransaction, error)

func (*PartiallySignedTransaction) Marshal

func (raw *PartiallySignedTransaction) Marshal() []byte

func (*PartiallySignedTransaction) SigHash

func (t *PartiallySignedTransaction) SigHash(idx int) []byte

type RPCBlock

type RPCBlock struct {
	Hash   string   `json:"hash"`
	Height uint64   `json:"height"`
	Tx     []string `json:"tx"`
}

func RPCGetBlock

func RPCGetBlock(rpc, hash string) (*RPCBlock, error)

type RPCBlockWithTransactions

type RPCBlockWithTransactions struct {
	Hash   string            `json:"hash"`
	Height uint64            `json:"height"`
	Tx     []*RPCTransaction `json:"tx"`
}

func RPCGetBlockWithTransactions

func RPCGetBlockWithTransactions(rpc, hash string) (*RPCBlockWithTransactions, error)

type RPCTransaction

type RPCTransaction struct {
	TxId      string    `json:"txid"`
	Vin       []*rpcIn  `json:"vin"`
	Vout      []*rpcOut `json:"vout"`
	BlockHash string    `json:"blockhash"`
	Hex       string    `json:"hex"`
}

func RPCGetRawMempool

func RPCGetRawMempool(rpc string) ([]*RPCTransaction, error)

func RPCGetTransaction

func RPCGetTransaction(rpc, hash string) (*RPCTransaction, error)

type WitnessKeyAccount

type WitnessKeyAccount struct {
	Script  []byte
	Address string
}

func BuildWitnessKeyAccount

func BuildWitnessKeyAccount(accountant string) (*WitnessKeyAccount, error)

type WitnessScriptAccount

type WitnessScriptAccount struct {
	Sequence uint32
	Script   []byte
	Address  string
}

func BuildWitnessScriptAccount

func BuildWitnessScriptAccount(holder, signer, observer string, lock time.Duration) (*WitnessScriptAccount, error)

func UnmarshalWitnessScriptAccountWitAccountant

func UnmarshalWitnessScriptAccountWitAccountant(extra []byte) (*WitnessScriptAccount, string, error)

func (*WitnessScriptAccount) MarshalWithAccountant

func (wsa *WitnessScriptAccount) MarshalWithAccountant(accountant string) []byte

Jump to

Keyboard shortcuts

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