Documentation ¶
Index ¶
- Constants
- Variables
- func AddrToPkScript(addr string, network *chaincfg.Params) ([]byte, error)
- func Bip0322Hash(message string) string
- func BtcDecodeWitnessForBip0322(r io.Reader, pver uint32, enc wire.MessageEncoding, msg *wire.MsgTx) error
- func BtcEncodeBip322(w io.Writer, pver uint32, enc wire.MessageEncoding, msg *wire.MsgTx) error
- func BuildToSpend(message string, address string, network *chaincfg.Params) (string, error)
- func CalcFee(ins TxInputs, outs []*TxOutput, sellerPsbt string, feeRate int64, ...) (int64, error)
- func CalcFeeForBatchBuy(ins TxInputs, outs []*TxOutput, sellerPSBTList []string, feeRate int64, ...) (int64, error)
- func CalcFeeForBatchBuyWithMPC(ins TxInputs, outs []*TxOutput, sellerPSBTList []string, feeRate int64, ...) (int64, error)
- func CalcInputSigHashForUnsignedPSBT(updater *psbt.Updater, i int, packet *psbt.Packet, ...) (string, error)
- func CalcTxVirtualSize(inputs TxInputs, outputs []*TxOutput, changeAddress string, ...) (int64, error)
- func CheckDuplicateOfUpdater(updater *psbt.Updater, index int)
- func CountP2SHSigOps(tx *btcutil.Tx, isCoinBaseTx bool, utxoView map[wire.OutPoint][]byte) (int, error)
- func CountSigOps(tx *btcutil.Tx) int
- func ExtractTxFromSignedPSBT(psbtHex string) (string, error)
- func ExtractTxFromSignedPSBTBIP322(psbtHex string) (string, error)
- func GenerateAddress(pubKey string, net *chaincfg.Params) (string, error)
- func GenerateBatchBuyingTx(ins []*TxInput, outs []*TxOutput, sellerPSBTList []string, ...) (string, error)
- func GenerateBatchBuyingTxPsbt(ins []*TxInput, outs []*TxOutput, sellerPSBTList []string, ...) (string, string, error)
- func GenerateMultiAddress(redeemScript []byte, net *chaincfg.Params) (string, error)
- func GenerateSignedBuyingTx(ins []*TxInput, outs []*TxOutput, sellerPsbt string, network *chaincfg.Params) (string, error)
- func GenerateSignedListingPSBTBase64(in *TxInput, out *TxOutput, network *chaincfg.Params) (string, error)
- func GenerateUnsignedPSBTHex(ins []*TxInput, outs []*TxOutput, network *chaincfg.Params) (string, error)
- func GetBCHmainNetParams() *chaincfg.Params
- func GetBTCMainNetParams() *chaincfg.Params
- func GetBTCTestNetParams() *chaincfg.Params
- func GetBTGMainNetParams() *chaincfg.Params
- func GetDASHMainNetParams() *chaincfg.Params
- func GetDGBMainNetParams() *chaincfg.Params
- func GetDOGEMainNetParams() *chaincfg.Params
- func GetLTCMainNetParams() *chaincfg.Params
- func GetPsbtFromString(psbtStr string) (*psbt.Packet, error)
- func GetQTUMMainNetParams() *chaincfg.Params
- func GetRVNMainNetParams() *chaincfg.Params
- func GetRandomHash() (string, error)
- func GetRedeemScript(pubKeys []string, minSignNum int) ([]byte, error)
- func GetSigOpCost(tx *btcutil.Tx, isCoinBaseTx bool, utxoView map[wire.OutPoint][]byte, ...) (int, error)
- func GetSigOps(tx *btcutil.Tx, view UtxoViewpoint) (f int64)
- func GetTransactionWeight(tx *btcutil.Tx) int64
- func GetTxHex(tx *wire.MsgTx) (string, error)
- func GetTxHexBIP322(tx *wire.MsgTx) (string, error)
- func GetTxVirtualSize(tx *btcutil.Tx) int64
- func GetTxVirtualSizeByView(tx *btcutil.Tx, view UtxoViewpoint) int64
- func GetZECMainNetParams() *chaincfg.Params
- func IsHexString(s string) bool
- func MPCSignedMessage(signature string, publicKeyHex string, network *chaincfg.Params) (string, error)
- func MPCSignedMessageCompat(prefix, message string, signature string, publicKeyHex string, ...) (string, error)
- func MPCUnsignedMessage(prefix string, message string) string
- func MultiSignBuild(tx *wire.MsgTx, priKeyList []string) (string, error)
- func NewAddressPubKeyHash(pub *btcec.PublicKey, network *chaincfg.Params) (string, error)
- func NewAddressPubKeyHashFromWif(wif string, network *chaincfg.Params) (string, error)
- func NewOldAddr(version []byte, data []byte) string
- func NewPossibleAddrs(pub *btcec.PublicKey, network *chaincfg.Params) ([]string, error)
- func NewPsbt(inputs []*wire.OutPoint, outputs []*wire.TxOut, version int32, ...) (*psbt.Packet, error)
- func NewTxFromHex(txHex string) (*wire.MsgTx, error)
- func NewZECAddr(pubBytes []byte) string
- func PayToPubKeyHashScript(pubKeyHash []byte) ([]byte, error)
- func PayToWitnessPubKeyHashScript(pubKeyHash []byte) ([]byte, error)
- func PubKeyToAddr(publicKey []byte, addrType string, network *chaincfg.Params) (string, error)
- func ReadVarIntBuf(r io.Reader, pver uint32, buf []byte) (uint64, error)
- func Sign(tx *wire.MsgTx, privateKeys []*btcec.PrivateKey, ...) error
- func SignBip0322(message string, address string, privateKey string) (string, error)
- func SignMessage(wif string, prefix, message string) (string, error)
- func SignPsbtWithKeyPathAndScriptPath(psbtHex string, privKey string, network *chaincfg.Params, ...) (string, error)
- func SignRawPSBTTransaction(psbtHex string, privKey string) (string, error)
- func SignTx(raw string, pubKeyMap map[int]string, signatureMap map[int]string) (string, error)
- func VerifyMessage(signatureStr, prefix, message, publicKeyHex, address, signType string, ...) error
- func VerifySimpleForBip0322(message, address, signature, publicKey string, network *chaincfg.Params) error
- func Wif2PubKeyHex(wif string) (string, error)
- type ErrorCode
- type GenerateMPCPSbtTxRes
- func GenerateMPCSignedBuyingTx(psbtBase64 string, signatures []string, pubKey string, batchSize int) (*GenerateMPCPSbtTxRes, error)
- func GenerateMPCSignedListingPSBT(psbtBase64 string, signature string, pubKey string) (*GenerateMPCPSbtTxRes, error)
- func GenerateMPCSignedPSBT(psbtStr string, pubKeyHex string, signatureList []string) (*GenerateMPCPSbtTxRes, error)
- func GenerateMPCUnsignedBuyingPSBT(ins []*TxInput, outs []*TxOutput, sellerPSBTList []string, ...) (*GenerateMPCPSbtTxRes, error)
- func GenerateMPCUnsignedListingPSBT(in *TxInput, out *TxOutput, network *chaincfg.Params) (*GenerateMPCPSbtTxRes, error)
- func GenerateMPCUnsignedPSBT(psbtStr string, pubKeyHex string) (*GenerateMPCPSbtTxRes, error)
- func MPCSignedBip0322(message string, address string, publicKey string, signatureList []string, ...) (*GenerateMPCPSbtTxRes, error)
- func MPCUnsignedBip0322(message string, address string, publicKey string, network *chaincfg.Params) (*GenerateMPCPSbtTxRes, error)
- type Input
- type InscribeForMPCRes
- type InscribeTxs
- type InscriptionBuilder
- type InscriptionData
- type InscriptionRequest
- type MessageError
- type OutPoint
- type Output
- type PrevOutput
- type PrevOutputs
- type PsbtInput
- type PsbtInputOutputs
- type PsbtOutput
- type RuleError
- type SignPsbtOption
- type Src20InscriptionRequest
- type Src20InscriptionTool
- type ToSignInput
- type TransactionBuilder
- func (build *TransactionBuilder) AddInput(txId string, vOut uint32, privateKeyHex string, redeemScript string, ...)
- func (build *TransactionBuilder) AddInput2(txId string, vOut uint32, privateKey string, address string, amount int64)
- func (build *TransactionBuilder) AddOutput(address string, amount int64)
- func (build *TransactionBuilder) AddOutput2(address string, script string, amount int64)
- func (build *TransactionBuilder) AppendInput(input Input)
- func (build *TransactionBuilder) AppendOutput(o Output)
- func (build *TransactionBuilder) Build() (*wire.MsgTx, error)
- func (build *TransactionBuilder) SingleBuild() (string, error)
- func (t *TransactionBuilder) TotalInputAmount() int64
- func (t *TransactionBuilder) TotalOutputAmount() int64
- func (build *TransactionBuilder) UnSignedTx(pubKeyMap map[int]string) (string, map[int]string, error)
- func (build *TransactionBuilder) UtxoViewpoint() (UtxoViewpoint, error)
- type TxInput
- type TxInputs
- type TxOutput
- type UtxoViewpoint
Constants ¶
const ( LEGACY = "legacy" SEGWIT_NATIVE = "segwit_native" SEGWIT_NESTED = "segwit_nested" TAPROOT = "taproot" )
const ( DefaultTxVersion = 2 DefaultSequenceNum = 0xfffffffd DefaultRevealOutValue = int64(546) DefaultMinChangeValue = int64(546) MaxStandardTxWeight = 4000000 / 10 WitnessScaleFactor = 4 OrdPrefix = "ord" )
const ( ScriptSigPrefix = "0020" Bip0322Tag = "BIP0322-signed-message" Bip0322Opt = "bip0322-simple" SignedMessagePrefix = "Bitcoin Signed Message:\n" )
const Five = 5 //It has to be multiplied by five
const (
// MaxVarIntPayload is the maximum payload size for a variable length integer.
MaxVarIntPayload = 9
)
const PART_LEN = 31
const SellerSignatureIndex = 2
Variables ¶
var ( ErrNonSupportedAddrType = errors.New("non-supported address type") ErrInvalidSignature = errors.New("invalid signature") ErrInvalidPubKey = errors.New("invalid public key") )
var ErrInvalidPsbtHex = errors.New("invalid psbt hex")
Functions ¶
func Bip0322Hash ¶
func BtcEncodeBip322 ¶
func BuildToSpend ¶
func CalcFeeForBatchBuy ¶
func CalcTxVirtualSize ¶
func CheckDuplicateOfUpdater ¶
func CountP2SHSigOps ¶
func CountP2SHSigOps(tx *btcutil.Tx, isCoinBaseTx bool, utxoView map[wire.OutPoint][]byte) (int, error)
CountP2SHSigOps returns the number of signature operations for all input transactions which are of the pay-to-script-hash type. This uses the precise, signature operation counting mechanism from the script engine which requires access to the input transaction scripts.
func CountSigOps ¶
CountSigOps returns the number of signature operations for all transaction input and output scripts in the provided transaction. This uses the quicker, but imprecise, signature operation counting mechanism from txscript.
func ExtractTxFromSignedPSBT ¶
func GenerateBatchBuyingTx ¶
func GenerateMultiAddress ¶
func GenerateSignedBuyingTx ¶
func GenerateUnsignedPSBTHex ¶
func GetBTCTestNetParams ¶
func GetRandomHash ¶
func GetSigOpCost ¶
func GetSigOpCost(tx *btcutil.Tx, isCoinBaseTx bool, utxoView map[wire.OutPoint][]byte, bip16, segWit bool) (int, error)
GetSigOpCost returns the unified sig op cost for the passed transaction respecting current active soft-forks which modified sig op cost counting. The unified sig op cost for a transaction is computed as the sum of: the legacy sig op count scaled according to the WitnessScaleFactor, the sig op count for all p2sh inputs scaled by the WitnessScaleFactor, and finally the unscaled sig op count for any inputs spending witness programs.
func GetTransactionWeight ¶
GetTransactionWeight computes the value of the weight metric for a given transaction. Currently the weight metric is simply the sum of the transactions's serialized size without any witness data scaled proportionally by the WitnessScaleFactor, and the transaction's serialized size including any witness data.
func GetTxVirtualSize ¶
GetTxVirtualSize computes the virtual size of a given transaction. A transaction's virtual size is based off its weight, creating a discount for any witness data it contains, proportional to the current blockchain.WitnessScaleFactor value.
func GetTxVirtualSizeByView ¶
func GetTxVirtualSizeByView(tx *btcutil.Tx, view UtxoViewpoint) int64
func IsHexString ¶
func MPCSignedMessage ¶
func MPCSignedMessageCompat ¶
func MPCUnsignedMessage ¶
func NewAddressPubKeyHash ¶
func NewOldAddr ¶
func NewPossibleAddrs ¶
func NewPsbt ¶
func NewPsbt(inputs []*wire.OutPoint, outputs []*wire.TxOut, version int32, nLockTime uint32, nSequences []uint32, opts ...string) (*psbt.Packet, error)
NewPsbt compatible for bip0322
func NewTxFromHex ¶
NewTxFromHex Second signature
func NewZECAddr ¶
func PayToPubKeyHashScript ¶
func PubKeyToAddr ¶
func Sign ¶
func Sign(tx *wire.MsgTx, privateKeys []*btcec.PrivateKey, prevOutFetcher *txscript.MultiPrevOutFetcher) error
func SignBip0322 ¶
func SignRawPSBTTransaction ¶
func VerifyMessage ¶
func VerifySimpleForBip0322 ¶
func Wif2PubKeyHex ¶
Types ¶
type ErrorCode ¶
type ErrorCode int
ErrorCode identifies a kind of error.
const ( // ErrDuplicateBlock indicates a block with the same hash already // exists. ErrDuplicateBlock ErrorCode = iota // ErrBlockTooBig indicates the serialized block size exceeds the // maximum allowed size. ErrBlockTooBig // ErrBlockWeightTooHigh indicates that the block's computed weight // metric exceeds the maximum allowed value. ErrBlockWeightTooHigh // ErrBlockVersionTooOld indicates the block version is too old and is // no longer accepted since the majority of the network has upgraded // to a newer version. ErrBlockVersionTooOld // ErrInvalidTime indicates the time in the passed block has a precision // that is more than one second. The chain consensus rules require // timestamps to have a maximum precision of one second. ErrInvalidTime // ErrTimeTooOld indicates the time is either before the median time of // the last several blocks per the chain consensus rules or prior to the // most recent checkpoint. ErrTimeTooOld // ErrTimeTooNew indicates the time is too far in the future as compared // the current time. ErrTimeTooNew // ErrDifficultyTooLow indicates the difficulty for the block is lower // than the difficulty required by the most recent checkpoint. ErrDifficultyTooLow // ErrUnexpectedDifficulty indicates specified bits do not align with // the expected value either because it doesn't match the calculated // valued based on difficulty regarted rules or it is out of the valid // range. ErrUnexpectedDifficulty // ErrHighHash indicates the block does not hash to a value which is // lower than the required target difficultly. ErrHighHash // ErrBadMerkleRoot indicates the calculated merkle root does not match // the expected value. ErrBadMerkleRoot // ErrBadCheckpoint indicates a block that is expected to be at a // checkpoint height does not match the expected one. ErrBadCheckpoint // ErrForkTooOld indicates a block is attempting to fork the block chain // before the most recent checkpoint. ErrForkTooOld // ErrCheckpointTimeTooOld indicates a block has a timestamp before the // most recent checkpoint. ErrCheckpointTimeTooOld // ErrNoTransactions indicates the block does not have a least one // transaction. A valid block must have at least the coinbase // transaction. ErrNoTransactions // ErrNoTxInputs indicates a transaction does not have any inputs. A // valid transaction must have at least one input. ErrNoTxInputs // ErrNoTxOutputs indicates a transaction does not have any outputs. A // valid transaction must have at least one output. ErrNoTxOutputs // ErrTxTooBig indicates a transaction exceeds the maximum allowed size // when serialized. ErrTxTooBig // ErrBadTxOutValue indicates an output value for a transaction is // invalid in some way such as being out of range. ErrBadTxOutValue // ErrDuplicateTxInputs indicates a transaction references the same // input more than once. ErrDuplicateTxInputs // ErrBadTxInput indicates a transaction input is invalid in some way // such as referencing a previous transaction outpoint which is out of // range or not referencing one at all. ErrBadTxInput // ErrMissingTxOut indicates a transaction output referenced by an input // either does not exist or has already been spent. ErrMissingTxOut // ErrUnfinalizedTx indicates a transaction has not been finalized. // A valid block may only contain finalized transactions. ErrUnfinalizedTx // ErrDuplicateTx indicates a block contains an identical transaction // (or at least two transactions which hash to the same value). A // valid block may only contain unique transactions. ErrDuplicateTx // ErrOverwriteTx indicates a block contains a transaction that has // the same hash as a previous transaction which has not been fully // spent. ErrOverwriteTx // ErrImmatureSpend indicates a transaction is attempting to spend a // coinbase that has not yet reached the required maturity. ErrImmatureSpend // ErrSpendTooHigh indicates a transaction is attempting to spend more // value than the sum of all of its inputs. ErrSpendTooHigh // ErrBadFees indicates the total fees for a block are invalid due to // exceeding the maximum possible value. ErrBadFees // ErrTooManySigOps indicates the total number of signature operations // for a transaction or block exceed the maximum allowed limits. ErrTooManySigOps // ErrFirstTxNotCoinbase indicates the first transaction in a block // is not a coinbase transaction. ErrFirstTxNotCoinbase // ErrMultipleCoinbases indicates a block contains more than one // coinbase transaction. ErrMultipleCoinbases // ErrBadCoinbaseScriptLen indicates the length of the signature script // for a coinbase transaction is not within the valid range. ErrBadCoinbaseScriptLen // ErrBadCoinbaseValue indicates the amount of a coinbase value does // not match the expected value of the subsidy plus the sum of all fees. ErrBadCoinbaseValue // ErrMissingCoinbaseHeight indicates the coinbase transaction for a // block does not start with the serialized block block height as // required for version 2 and higher blocks. ErrMissingCoinbaseHeight // ErrBadCoinbaseHeight indicates the serialized block height in the // coinbase transaction for version 2 and higher blocks does not match // the expected value. ErrBadCoinbaseHeight // ErrScriptMalformed indicates a transaction script is malformed in // some way. For example, it might be longer than the maximum allowed // length or fail to parse. ErrScriptMalformed // ErrScriptValidation indicates the result of executing transaction // script failed. The error covers any failure when executing scripts // such signature verification failures and execution past the end of // the stack. ErrScriptValidation // ErrUnexpectedWitness indicates that a block includes transactions // with witness data, but doesn't also have a witness commitment within // the coinbase transaction. ErrUnexpectedWitness // ErrInvalidWitnessCommitment indicates that a block's witness // commitment is not well formed. ErrInvalidWitnessCommitment // ErrWitnessCommitmentMismatch indicates that the witness commitment // included in the block's coinbase transaction doesn't match the // manually computed witness commitment. ErrWitnessCommitmentMismatch // ErrPreviousBlockUnknown indicates that the previous block is not known. ErrPreviousBlockUnknown // ErrInvalidAncestorBlock indicates that an ancestor of this block has // already failed validation. ErrInvalidAncestorBlock // ErrPrevBlockNotBest indicates that the block's previous block is not the // current chain tip. This is not a block validation rule, but is required // for block proposals submitted via getblocktemplate RPC. ErrPrevBlockNotBest )
These constants are used to identify a specific RuleError.
type GenerateMPCPSbtTxRes ¶
type GenerateMPCPSbtTxRes struct { Psbt string `json:"psbt"` PsbtTx string `json:"psbtTx"` SignHashList []string `json:"signHashList"` }
func GenerateMPCSignedListingPSBT ¶
func GenerateMPCSignedListingPSBT(psbtBase64 string, signature string, pubKey string) (*GenerateMPCPSbtTxRes, error)
func GenerateMPCSignedPSBT ¶
func GenerateMPCSignedPSBT(psbtStr string, pubKeyHex string, signatureList []string) (*GenerateMPCPSbtTxRes, error)
func GenerateMPCUnsignedPSBT ¶
func GenerateMPCUnsignedPSBT(psbtStr string, pubKeyHex string) (*GenerateMPCPSbtTxRes, error)
func MPCSignedBip0322 ¶
func MPCUnsignedBip0322 ¶
type InscribeForMPCRes ¶
type InscribeForMPCRes struct { SigHashList []string `json:"sigHashList"` CommitTx string `json:"commitTx"` RevealTxs []string `json:"revealTxs"` CommitTxFee int64 `json:"commitTxFee"` RevealTxFees []int64 `json:"revealTxFees"` CommitAddrs []string `json:"commitAddrs"` }
func InscribeForMPCSigned ¶
func InscribeForMPCSigned(request *InscriptionRequest, network *chaincfg.Params, commitTx string, signatures []string) (*InscribeForMPCRes, error)
func InscribeForMPCUnsigned ¶
func InscribeForMPCUnsigned(request *InscriptionRequest, network *chaincfg.Params, unsignedCommitHash, signedCommitTxHash *chainhash.Hash) (*InscribeForMPCRes, error)
type InscribeTxs ¶
type InscribeTxs struct { CommitTx string `json:"commitTx"` RevealTxs []string `json:"revealTxs"` CommitTxFee int64 `json:"commitTxFee"` RevealTxFees []int64 `json:"revealTxFees"` CommitAddrs []string `json:"commitAddrs"` }
func Inscribe ¶
func Inscribe(network *chaincfg.Params, request *InscriptionRequest) (*InscribeTxs, error)
func Src20Inscribe ¶
func Src20Inscribe(network *chaincfg.Params, request *Src20InscriptionRequest) (*InscribeTxs, error)
type InscriptionBuilder ¶
type InscriptionBuilder struct { Network *chaincfg.Params CommitTxPrevOutputFetcher *txscript.MultiPrevOutFetcher CommitTxPrivateKeyList []*btcec.PrivateKey InscriptionTxCtxDataList []*inscriptionTxCtxData RevealTxPrevOutputFetcher *txscript.MultiPrevOutFetcher CommitTxPrevOutputList []*PrevOutput RevealTx []*wire.MsgTx CommitTx *wire.MsgTx MustCommitTxFee int64 MustRevealTxFees []int64 CommitAddrs []string }
func NewInscriptionTool ¶
func NewInscriptionTool(network *chaincfg.Params, request *InscriptionRequest) (*InscriptionBuilder, error)
func (*InscriptionBuilder) CalculateFee ¶
func (builder *InscriptionBuilder) CalculateFee() (int64, []int64)
func (*InscriptionBuilder) GetCommitTxHex ¶
func (builder *InscriptionBuilder) GetCommitTxHex() (string, error)
func (*InscriptionBuilder) GetRevealTxHexList ¶
func (builder *InscriptionBuilder) GetRevealTxHexList() ([]string, error)
type InscriptionData ¶
type InscriptionRequest ¶
type InscriptionRequest struct { CommitTxPrevOutputList PrevOutputs `json:"commitTxPrevOutputList"` CommitFeeRate int64 `json:"commitFeeRate"` RevealFeeRate int64 `json:"revealFeeRate"` InscriptionDataList []InscriptionData `json:"inscriptionDataList"` RevealOutValue int64 `json:"revealOutValue"` ChangeAddress string `json:"changeAddress"` MinChangeValue int64 `json:"minChangeValue"` }
type MessageError ¶
type MessageError struct { Func string // Function name Description string // Human readable description of the issue }
MessageError describes an issue with a message. An example of some potential issues are messages from the wrong bitcoin network, invalid commands, mismatched checksums, and exceeding max payloads.
This provides a mechanism for the caller to type assert the error to differentiate between general io errors such as io.EOF and issues that resulted from malformed messages.
func (*MessageError) Error ¶
func (e *MessageError) Error() string
Error satisfies the error interface and prints human-readable errors.
type OutPoint ¶
func DecodeFromSignedPSBT ¶
type PrevOutput ¶
type PrevOutputs ¶
type PrevOutputs []*PrevOutput
func (PrevOutputs) UtxoViewpoint ¶
func (s PrevOutputs) UtxoViewpoint(net *chaincfg.Params) (UtxoViewpoint, error)
type PsbtInputOutputs ¶
type PsbtInputOutputs struct { UnSignedTx string `json:"un_signed_tx"` Input []*PsbtInput `json:"input"` Output []*PsbtOutput `json:"output"` }
func DecodePSBTInputOutputs ¶
func DecodePSBTInputOutputs(psbtHex string, params *chaincfg.Params) (*PsbtInputOutputs, error)
func DecodePSBTsInputOutputs ¶
func DecodePSBTsInputOutputs(psbtHexs []string, params *chaincfg.Params) ([]*PsbtInputOutputs, error)
type PsbtOutput ¶
type RuleError ¶
type RuleError struct { ErrorCode ErrorCode // Describes the kind of error Description string // Human readable description of the issue }
RuleError identifies a rule violation. It is used to indicate that processing of a block or transaction failed due to one of the many validation rules. The caller can use type assertions to determine if a failure was specifically due to a rule violation and access the ErrorCode field to ascertain the specific reason for the rule violation.
type SignPsbtOption ¶
type SignPsbtOption struct { AutoFinalized bool `json:"autoFinalized"` ToSignInputs []*ToSignInput `json:"toSignInputs"` }
type Src20InscriptionRequest ¶
type Src20InscriptionRequest struct { CommitTxPrevOutputList PrevOutputs `json:"commitTxPrevOutputList"` CommitFeeRate int64 `json:"commitFeeRate"` InscriptionData *InscriptionData `json:"inscriptionDataList"` RevealOutValue int64 `json:"revealOutValue"` Address string `json:"address"` DustSize int64 `json:"dustSize"` }
type Src20InscriptionTool ¶
type Src20InscriptionTool struct { Network *chaincfg.Params CommitTxPrevOutputFetcher *txscript.MultiPrevOutFetcher CommitTxPrivateKeyList []*btcec.PrivateKey RevealTxPrevOutputFetcher *txscript.MultiPrevOutFetcher CommitTxPrevOutputList []*PrevOutput CommitTx *wire.MsgTx MustCommitTxFee int64 CommitAddrs []string }
func NewSrc20InscriptionTool ¶
func NewSrc20InscriptionTool(network *chaincfg.Params, request *Src20InscriptionRequest) (*Src20InscriptionTool, error)
func (*Src20InscriptionTool) CalculateFee ¶
func (tool *Src20InscriptionTool) CalculateFee() (int64, []int64)
func (*Src20InscriptionTool) GetCommitTxHex ¶
func (tool *Src20InscriptionTool) GetCommitTxHex() (string, error)
type ToSignInput ¶
type TransactionBuilder ¶
type TransactionBuilder struct {
// contains filtered or unexported fields
}
func NewTxBuild ¶
func NewTxBuild(version int32, netParams *chaincfg.Params) *TransactionBuilder
func (*TransactionBuilder) AddOutput ¶
func (build *TransactionBuilder) AddOutput(address string, amount int64)
func (*TransactionBuilder) AddOutput2 ¶
func (build *TransactionBuilder) AddOutput2(address string, script string, amount int64)
func (*TransactionBuilder) AppendInput ¶
func (build *TransactionBuilder) AppendInput(input Input)
func (*TransactionBuilder) AppendOutput ¶
func (build *TransactionBuilder) AppendOutput(o Output)
func (*TransactionBuilder) SingleBuild ¶
func (build *TransactionBuilder) SingleBuild() (string, error)
func (*TransactionBuilder) TotalInputAmount ¶
func (t *TransactionBuilder) TotalInputAmount() int64
func (*TransactionBuilder) TotalOutputAmount ¶
func (t *TransactionBuilder) TotalOutputAmount() int64
func (*TransactionBuilder) UnSignedTx ¶
func (*TransactionBuilder) UtxoViewpoint ¶
func (build *TransactionBuilder) UtxoViewpoint() (UtxoViewpoint, error)
type TxInputs ¶
type TxInputs []*TxInput
func (TxInputs) UtxoViewpoint ¶
func (inputs TxInputs) UtxoViewpoint(net *chaincfg.Params) (UtxoViewpoint, error)