Versions in this module Expand all Collapse all v0 v0.0.1 Jan 10, 2025 Changes in this version + const Bip0322Opt + const Bip0322Tag + const DefaultMinChangeValue + const DefaultRevealOutValue + const DefaultSequenceNum + const DefaultTxVersion + const Five + const LEGACY + const MaxStandardTxWeight + const MaxVarIntPayload + const OrdPrefix + const PART_LEN + const SEGWIT_NATIVE + const SEGWIT_NESTED + const ScriptSigPrefix + const SellerSignatureIndex + const SignedMessagePrefix + const TAPROOT + const WitnessScaleFactor + var ErrInvalidPsbtHex = errors.New("invalid psbt hex") + var ErrInvalidPubKey = errors.New("invalid public key") + var ErrInvalidSignature = errors.New("invalid signature") + var ErrNonSupportedAddrType = errors.New("non-supported address type") + 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 int + const ErrBadCheckpoint + const ErrBadCoinbaseHeight + const ErrBadCoinbaseScriptLen + const ErrBadCoinbaseValue + const ErrBadFees + const ErrBadMerkleRoot + const ErrBadTxInput + const ErrBadTxOutValue + const ErrBlockTooBig + const ErrBlockVersionTooOld + const ErrBlockWeightTooHigh + const ErrCheckpointTimeTooOld + const ErrDifficultyTooLow + const ErrDuplicateBlock + const ErrDuplicateTx + const ErrDuplicateTxInputs + const ErrFirstTxNotCoinbase + const ErrForkTooOld + const ErrHighHash + const ErrImmatureSpend + const ErrInvalidAncestorBlock + const ErrInvalidTime + const ErrInvalidWitnessCommitment + const ErrMissingCoinbaseHeight + const ErrMissingTxOut + const ErrMultipleCoinbases + const ErrNoTransactions + const ErrNoTxInputs + const ErrNoTxOutputs + const ErrOverwriteTx + const ErrPrevBlockNotBest + const ErrPreviousBlockUnknown + const ErrScriptMalformed + const ErrScriptValidation + const ErrSpendTooHigh + const ErrTimeTooNew + const ErrTimeTooOld + const ErrTooManySigOps + const ErrTxTooBig + const ErrUnexpectedDifficulty + const ErrUnexpectedWitness + const ErrUnfinalizedTx + const ErrWitnessCommitmentMismatch + type GenerateMPCPSbtTxRes struct + Psbt string + PsbtTx string + SignHashList []string + 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 struct + type InscribeForMPCRes struct + CommitAddrs []string + CommitTx string + CommitTxFee int64 + RevealTxFees []int64 + RevealTxs []string + SigHashList []string + func InscribeForMPCSigned(request *InscriptionRequest, network *chaincfg.Params, commitTx string, ...) (*InscribeForMPCRes, error) + func InscribeForMPCUnsigned(request *InscriptionRequest, network *chaincfg.Params, ...) (*InscribeForMPCRes, error) + type InscribeTxs struct + CommitAddrs []string + CommitTx string + CommitTxFee int64 + RevealTxFees []int64 + RevealTxs []string + func Inscribe(network *chaincfg.Params, request *InscriptionRequest) (*InscribeTxs, error) + func Src20Inscribe(network *chaincfg.Params, request *Src20InscriptionRequest) (*InscribeTxs, error) + type InscriptionBuilder struct + CommitAddrs []string + CommitTx *wire.MsgTx + CommitTxPrevOutputFetcher *txscript.MultiPrevOutFetcher + CommitTxPrevOutputList []*PrevOutput + CommitTxPrivateKeyList []*btcec.PrivateKey + InscriptionTxCtxDataList []*inscriptionTxCtxData + MustCommitTxFee int64 + MustRevealTxFees []int64 + Network *chaincfg.Params + RevealTx []*wire.MsgTx + RevealTxPrevOutputFetcher *txscript.MultiPrevOutFetcher + func NewInscriptionTool(network *chaincfg.Params, request *InscriptionRequest) (*InscriptionBuilder, error) + func (builder *InscriptionBuilder) CalculateFee() (int64, []int64) + func (builder *InscriptionBuilder) GetCommitTxHex() (string, error) + func (builder *InscriptionBuilder) GetRevealTxHexList() ([]string, error) + type InscriptionData struct + Body []byte + ContentType string + RevealAddr string + type InscriptionRequest struct + ChangeAddress string + CommitFeeRate int64 + CommitTxPrevOutputList PrevOutputs + InscriptionDataList []InscriptionData + MinChangeValue int64 + RevealFeeRate int64 + RevealOutValue int64 + type MessageError struct + Description string + Func string + func (e *MessageError) Error() string + type OutPoint struct + TxId string + VOut uint32 + func DecodeFromSignedPSBT(psbtHex string) ([]*OutPoint, error) + type Output struct + type PrevOutput struct + Address string + Amount int64 + PrivateKey string + PublicKey string + TxId string + VOut uint32 + type PrevOutputs []*PrevOutput + func (s PrevOutputs) UtxoViewpoint(net *chaincfg.Params) (UtxoViewpoint, error) + type PsbtInput struct + Amount int64 + TxId string + VOut uint32 + type PsbtInputOutputs struct + Input []*PsbtInput + Output []*PsbtOutput + UnSignedTx string + func DecodePSBTInputOutputs(psbtHex string, params *chaincfg.Params) (*PsbtInputOutputs, error) + func DecodePSBTsInputOutputs(psbtHexs []string, params *chaincfg.Params) ([]*PsbtInputOutputs, error) + type PsbtOutput struct + Address string + Amount int64 + PkScript string + VOut uint32 + type RuleError struct + Description string + ErrorCode ErrorCode + func (e RuleError) Error() string + type SignPsbtOption struct + AutoFinalized bool + ToSignInputs []*ToSignInput + type Src20InscriptionRequest struct + Address string + CommitFeeRate int64 + CommitTxPrevOutputList PrevOutputs + DustSize int64 + InscriptionData *InscriptionData + RevealOutValue int64 + type Src20InscriptionTool struct + CommitAddrs []string + CommitTx *wire.MsgTx + CommitTxPrevOutputFetcher *txscript.MultiPrevOutFetcher + CommitTxPrevOutputList []*PrevOutput + CommitTxPrivateKeyList []*btcec.PrivateKey + MustCommitTxFee int64 + Network *chaincfg.Params + RevealTxPrevOutputFetcher *txscript.MultiPrevOutFetcher + func NewSrc20InscriptionTool(network *chaincfg.Params, request *Src20InscriptionRequest) (*Src20InscriptionTool, error) + func (tool *Src20InscriptionTool) CalculateFee() (int64, []int64) + func (tool *Src20InscriptionTool) GetCommitTxHex() (string, error) + type ToSignInput struct + Address string + DisableTweakSigner bool + Index int + PublicKey string + SigHashTypes []int + type TransactionBuilder struct + func NewTxBuild(version int32, netParams *chaincfg.Params) *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 (build *TransactionBuilder) UnSignedTx(pubKeyMap map[int]string) (string, map[int]string, error) + func (build *TransactionBuilder) UtxoViewpoint() (UtxoViewpoint, error) + func (t *TransactionBuilder) TotalInputAmount() int64 + func (t *TransactionBuilder) TotalOutputAmount() int64 + type TxInput struct + Address string + Amount int64 + DerivationPath string + MasterFingerprint uint32 + NonWitnessUtxo string + PrivateKey string + PublicKey string + Sequence uint32 + TxId string + VOut uint32 + type TxInputs []*TxInput + func (inputs TxInputs) UtxoViewpoint(net *chaincfg.Params) (UtxoViewpoint, error) + type TxOutput struct + Address string + Amount int64 + DerivationPath string + IsChange bool + MasterFingerprint uint32 + PublicKey string + type UtxoViewpoint map[wire.OutPoint][]byte