Documentation
¶
Index ¶
- Constants
- func AddrToPkScript(addr string, network *chaincfg.Params) ([]byte, error)
- func Bip0322Hash(message string) string
- 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 []*TxInput, outs []*TxOutput, sellerPsbt string, feeRate int64, ...) (int64, error)
- func CalcFeeForBatchBuy(ins []*TxInput, outs []*TxOutput, sellerPSBTList []string, feeRate int64, ...) (int64, error)
- func CalcFeeForBatchBuyWithMPC(ins []*TxInput, outs []*TxOutput, sellerPSBTList []string, feeRate int64, ...) (int64, error)
- func CalcInputSigHashForUnsignedPSBT(updater *psbt.Updater, i int, packet *psbt.Packet, ...) (string, error)
- func CalcTxVirtualSize(inputs []*TxInput, outputs []*TxOutput, changeAddress string, ...) (int64, error)
- func CheckDuplicateOfUpdater(updater *psbt.Updater, index 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 GetPsbtFromString(psbtStr string) (*psbt.Packet, error)
- func GetRandomHash() (string, error)
- func GetRedeemScript(pubKeys []string, minSignNum int) ([]byte, error)
- 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 IsHexString(s string) bool
- func MPCSignedMessage(signature string, publicKeyHex string, network *chaincfg.Params) (string, error)
- func MPCSignedMessageCompat(message string, signature string, publicKeyHex string, ...) (string, error)
- func MPCUnsignedMessage(message string) string
- func MultiSignBuild(tx *wire.MsgTx, priKeyList []string) (string, error)
- func NewPsbt(inputs []*wire.OutPoint, outputs []*wire.TxOut, version int32, ...) (*psbt.Packet, error)
- func NewTxFromHex(txHex string) (*wire.MsgTx, error)
- func PayToPubKeyHashScript(pubKeyHash []byte) ([]byte, error)
- func PayToWitnessPubKeyHashScript(pubKeyHash []byte) ([]byte, error)
- func PubKeyToAddr(publicKey []byte, addrType string, network *chaincfg.Params) (string, error)
- func Sign(tx *wire.MsgTx, privateKeys []*btcec.PrivateKey, ...) error
- func SignBip0322(message string, address string, privateKey string) (string, error)
- func SignMessage(wif string, 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, message, publicKeyHex, signType string) (bool, error)
- 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 Output
- type PrevOutput
- 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) AdjustGas(gas int64, index int)
- 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)
- type TxInput
- type TxOutput
Constants ¶
View Source
const ( LEGACY = "legacy" SEGWIT_NATIVE = "segwit_native" SEGWIT_NESTED = "segwit_nested" TAPROOT = "taproot" )
View Source
const ( DefaultTxVersion = 2 DefaultSequenceNum = 0xfffffffd DefaultRevealOutValue = int64(546) DefaultMinChangeValue = int64(546) MaxStandardTxWeight = 4000000 / 10 WitnessScaleFactor = 4 OrdPrefix = "ord" )
View Source
const ( ScriptSigPrefix = "0020" Bip0322Tag = "BIP0322-signed-message" Bip0322Opt = "bip0322-simple" SignedMessagePrefix = "Bitcoin Signed Message:\n" )
View Source
const PART_LEN = 31
View Source
const SellerSignatureIndex = 2
Variables ¶
This section is empty.
Functions ¶
func Bip0322Hash ¶
func BtcEncodeBip322 ¶
func BuildToSpend ¶
func CalcFeeForBatchBuy ¶
func CalcTxVirtualSize ¶
func CheckDuplicateOfUpdater ¶
func ExtractTxFromSignedPSBT ¶
func GenerateBatchBuyingTx ¶
func GenerateMultiAddress ¶
func GenerateSignedBuyingTx ¶
func GenerateUnsignedPSBTHex ¶
func GetRandomHash ¶
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 IsHexString ¶
func MPCSignedMessage ¶
func MPCSignedMessageCompat ¶
func MPCUnsignedMessage ¶
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 PayToPubKeyHashScript ¶
func PubKeyToAddr ¶
func Sign ¶
func Sign(tx *wire.MsgTx, privateKeys []*btcec.PrivateKey, prevOutFetcher *txscript.MultiPrevOutFetcher) error
func SignBip0322 ¶
func SignRawPSBTTransaction ¶
func VerifyMessage ¶
Types ¶
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 []*PrevOutput `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 PrevOutput ¶
type SignPsbtOption ¶
type SignPsbtOption struct { AutoFinalized bool `json:"autoFinalized"` ToSignInputs []*ToSignInput `json:"toSignInputs"` }
type Src20InscriptionRequest ¶
type Src20InscriptionRequest struct { CommitTxPrevOutputList []*PrevOutput `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) AdjustGas ¶
func (build *TransactionBuilder) AdjustGas(gas int64, index int)
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 ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.