bitcoin

package
v0.0.0-...-ae0dd77 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// SkippedStatus is the status of all
	// operations that are skipped because
	// of BIP-30. You can read more about these
	// types of operations in BIP-30.
	SkippedStatus = "SKIPPED"

	// NullData is returned by bitcoind
	// as the ScriptPubKey.Type for OP_RETURN
	// locking scripts.
	NullData = "nulldata"
)

Variables

View Source
var Module = fx.Options(
	internal.NewParserBuilder("bitcoin", NewBitcoinNativeParser).
		SetCheckerFactory(NewBitcoinChecker).
		SetRosettaParserFactory(NewBitcoinRosettaParser).
		Build(),
)

Functions

func NewBitcoinChecker

func NewBitcoinChecker(params internal.ParserParams) (internal.Checker, error)

func NewBitcoinRosettaParser

func NewBitcoinRosettaParser(params internal.ParserParams, nativeParser internal.NativeParser, opts ...internal.ParserFactoryOption) (internal.RosettaParser, error)

Types

type BitcoinBlock

type BitcoinBlock struct {
	Hash              BitcoinHexString       `json:"hash" validate:"required"`
	StrippedSize      BitcoinQuantity        `json:"strippedsize"`
	Size              BitcoinQuantity        `json:"size"`
	Weight            BitcoinQuantity        `json:"weight"`
	Height            BitcoinQuantity        `json:"height" validate:"required_with=PreviousBlockHash"`
	Version           BitcoinQuantity        `json:"version"`
	VersionHex        BitcoinHexString       `json:"versionHex"`
	MerkleRoot        BitcoinHexString       `json:"merkleroot"`
	Tx                []*BitcoinTransaction  `json:"tx" validate:"required,min=1,dive,required"`
	Time              BitcoinQuantity        `json:"time" validate:"required"`
	MedianTime        BitcoinQuantity        `json:"mediantime"`
	Nonce             BitcoinQuantity        `json:"nonce"`
	Bits              BitcoinHexString       `json:"bits"`
	Difficulty        BitcoinDecimalQuantity `json:"difficulty"`
	ChainWork         BitcoinHexString       `json:"chainwork"`
	NTx               BitcoinQuantity        `json:"nTx"`
	PreviousBlockHash BitcoinHexString       `json:"previousblockhash" validate:"required_with=Height"`
	NextBlockHash     BitcoinHexString       `json:"nextblockhash"`
}

BitcoinBlock https://developer.bitcoin.org/reference/rpc/getblock.html

func (*BitcoinBlock) GetApiBitcoinHeader

func (b *BitcoinBlock) GetApiBitcoinHeader() *api.BitcoinHeader

type BitcoinBlockLit

type BitcoinBlockLit struct {
	Hash              BitcoinHexString         `json:"hash" validate:"required"`
	PreviousBlockHash BitcoinHexString         `json:"previousblockhash" validate:"required_with=Height"`
	Height            BitcoinQuantity          `json:"height" validate:"required_with=PreviousBlockHash"`
	Transactions      []*BitcoinTransactionLit `json:"tx" validate:"required"`
	Time              BitcoinQuantity          `json:"time" validate:"required"`
}

BitcoinBlockLit is a light version of BitcoinBlock Fields not used during data ingestion are removed.

type BitcoinBoolean

type BitcoinBoolean bool

func (BitcoinBoolean) Value

func (v BitcoinBoolean) Value() bool

type BitcoinDecimalQuantity

type BitcoinDecimalQuantity float64

func (BitcoinDecimalQuantity) String

func (v BitcoinDecimalQuantity) String() string

func (BitcoinDecimalQuantity) Value

func (v BitcoinDecimalQuantity) Value() float64

type BitcoinHexString

type BitcoinHexString string

func (BitcoinHexString) Value

func (v BitcoinHexString) Value() string

type BitcoinInputTransactionLit

type BitcoinInputTransactionLit struct {
	TxId BitcoinHexString            `json:"txid" validate:"required"`
	Vout []*BitcoinTransactionOutput `json:"vout" validate:"required,min=1,dive,required"`
}

type BitcoinQuantity

type BitcoinQuantity uint64

func (BitcoinQuantity) Value

func (v BitcoinQuantity) Value() uint64

type BitcoinScriptPubKey

type BitcoinScriptPubKey struct {
	Asm       BitcoinString    `json:"asm"`
	Hex       BitcoinHexString `json:"hex"`
	ReqSigs   BitcoinQuantity  `json:"reqSigs"` // deprecated: https://github.com/bitcoin/bitcoin/pull/20286
	Type      BitcoinString    `json:"type"`
	Addresses []BitcoinString  `json:"addresses"` // deprecated: https://github.com/bitcoin/bitcoin/pull/20286
	Address   BitcoinString    `json:"address"`
}

BitcoinScriptPubKey ... note that reqSigs and addresses are kept for backward compatibility from what's in storage

func (*BitcoinScriptPubKey) ToApiBitcoinScriptPublicKey

func (k *BitcoinScriptPubKey) ToApiBitcoinScriptPublicKey() (*api.BitcoinScriptPublicKey, error)

type BitcoinScriptSig

type BitcoinScriptSig struct {
	Asm BitcoinString    `json:"asm"`
	Hex BitcoinHexString `json:"hex"`
}

func (*BitcoinScriptSig) ToApiBitcoinScriptSignature

func (s *BitcoinScriptSig) ToApiBitcoinScriptSignature() *api.BitcoinScriptSignature

type BitcoinString

type BitcoinString string

func (BitcoinString) Value

func (v BitcoinString) Value() string

type BitcoinTransaction

type BitcoinTransaction struct {
	Hex       BitcoinHexString            `json:"hex"`
	TxId      BitcoinHexString            `json:"txid" validate:"required"`
	Hash      BitcoinHexString            `json:"hash" validate:"required"`
	Size      BitcoinQuantity             `json:"size"`
	Vsize     BitcoinQuantity             `json:"vsize"`
	Weight    BitcoinQuantity             `json:"weight"`
	Version   BitcoinQuantity             `json:"version"`
	LockTime  BitcoinQuantity             `json:"locktime"`
	Vin       []*BitcoinTransactionInput  `json:"vin" validate:"required,min=1,dive,required"`
	Vout      []*BitcoinTransactionOutput `json:"vout" validate:"required,min=1,dive,required"`
	BlockHash BitcoinHexString            `json:"blockhash"`
	BlockTime BitcoinQuantity             `json:"blocktime"`
	Time      BitcoinQuantity             `json:"time"`
}

BitcoinTransaction https://developer.bitcoin.org/reference/rpc/getrawtransaction.html

func (*BitcoinTransaction) ToApiBitcoinTransaction

func (t *BitcoinTransaction) ToApiBitcoinTransaction(index int, metadataMap map[string][]*api.BitcoinTransactionOutput) (*api.BitcoinTransaction, error)

type BitcoinTransactionInput

type BitcoinTransactionInput struct {
	Coinbase    BitcoinHexString   `json:"coinbase"`
	TxId        BitcoinHexString   `json:"txid" validate:"required_without=Coinbase"`
	Vout        BitcoinQuantity    `json:"vout"`
	ScriptSig   *BitcoinScriptSig  `json:"scriptSig"`
	Sequence    BitcoinQuantity    `json:"sequence"`
	TxInWitness []BitcoinHexString `json:"txinwitness"`
}

func (*BitcoinTransactionInput) ToApiBitcoinTransactionInput

func (i *BitcoinTransactionInput) ToApiBitcoinTransactionInput(index uint64) *api.BitcoinTransactionInput

type BitcoinTransactionInputLit

type BitcoinTransactionInputLit struct {
	Coinbase   BitcoinHexString `json:"coinbase"`
	Identifier BitcoinHexString `json:"txid" validate:"required_without=Coinbase"`
	Vout       BitcoinQuantity  `json:"vout" validate:"required_with=Identifier"`
}

type BitcoinTransactionLit

type BitcoinTransactionLit struct {
	Identifier BitcoinHexString              `json:"txid" validate:"required"`
	Inputs     []*BitcoinTransactionInputLit `json:"vin" validate:"required"`
}

func (*BitcoinTransactionLit) UnmarshalJSON

func (v *BitcoinTransactionLit) UnmarshalJSON(input []byte) error

type BitcoinTransactionOutput

type BitcoinTransactionOutput struct {
	Value        BitcoinDecimalQuantity `json:"value"`
	N            BitcoinQuantity        `json:"n"`
	ScriptPubKey *BitcoinScriptPubKey   `json:"scriptPubKey" validate:"required"`
}

func (*BitcoinTransactionOutput) ToApiBitcoinTransactionOutput

func (o *BitcoinTransactionOutput) ToApiBitcoinTransactionOutput() (*api.BitcoinTransactionOutput, error)

Jump to

Keyboard shortcuts

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