Documentation ¶
Index ¶
- Constants
- func AddrToPkScript(addr string, network *chaincfg.Params) ([]byte, error)
- func CalcFee(ins []*TxInput, outs []*TxOutput, sellerPsbt string, feeRate int64, ...) (int64, error)
- func CalcTxVirtualSize(inputs []*TxInput, outputs []*TxOutput, changeAddress string, ...) (int64, error)
- func ExtractTxFromSignedPSBT(psbtHex string) (string, error)
- func GenerateAddress(pubKey string, net *chaincfg.Params) (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 GetRedeemScript(pubKeys []string, minSignNum int) ([]byte, error)
- func GetTransactionWeight(tx *btcutil.Tx) int64
- func GetTxHex(tx *wire.MsgTx) (string, error)
- func GetTxVirtualSize(tx *btcutil.Tx) int64
- func MultiSignBuild(tx *wire.MsgTx, priKeyList []string) (string, 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 SignTx(raw string, pubKeyMap map[int]string, signatureMap map[int]string) (string, error)
- type Input
- type InscribeTxs
- type InscriptionBuilder
- type InscriptionData
- type InscriptionRequest
- type Output
- type PrevOutput
- 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) Build() (*wire.MsgTx, error)
- func (build *TransactionBuilder) SingleBuild() (string, error)
- 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 )
View Source
const SellerSignatureIndex = 2
Variables ¶
This section is empty.
Functions ¶
func CalcTxVirtualSize ¶
func ExtractTxFromSignedPSBT ¶
func GenerateMultiAddress ¶
func GenerateSignedBuyingTx ¶
func GenerateUnsignedPSBTHex ¶
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 NewTxFromHex ¶
NewTxFromHex Second signature
func PayToPubKeyHashScript ¶
func PubKeyToAddr ¶
Types ¶
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)
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 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) SingleBuild ¶
func (build *TransactionBuilder) SingleBuild() (string, error)
func (*TransactionBuilder) UnSignedTx ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.