Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateAddressTaproot(chainParam *chaincfg.Params, seed ...string) (privKey, pubKey, addressTaproot string, err error)
- func GenerateAddressTaprootFromPrivateKey(chainParam *chaincfg.Params, privateKey string) (addressTaproot string, err error)
- type BTCFullnodeConfig
- type BitcoinParams
- type BlockAuditScoreResp
- type BlockCypherWalletInfo
- type BlockInfoResp
- type BlockResp
- type Client
- func (c *Client) Address() (string, string, error)
- func (c *Client) Balance(addr string) (uint64, error)
- func (u *Client) BroadcastBTCTxByMempool(hexTx string) (string, error)
- func (u *Client) BuildBTCClient(cfg *BTCFullnodeConfig) (*rpcclient.Client, error)
- func (u *Client) CheckBVMInscs(txIDs []string) ([]bool, error)
- func (c *Client) CheckTXHash(hash string, confirmedBlock int) (bool, error)
- func (u *Client) CreateOrdInscImg(btcAddress string, privateKey string, feeRate int, receiverAddress string, ...) (string, string, error)
- func (c *Client) CreateOrdInscImgParam(req CreateOrdInscImgDtoRequest) (CreateOrdInscImgResp, error)
- func (c *Client) CreateSendTxSendMultiInsc(req CreateSendTxMultiInscRequest) (CreateSendTxResponse, error)
- func (c *Client) GenerateAddressSegwit(networkParams *chaincfg.Params, privateKey ...string) (privKey, pubKey, addressSegwit string, err error)
- func (c *Client) GenerateAddressTaproot() (string, string, error)
- func (c *Client) GetBTCAddressAllTxs(address string) ([]*RawaddrTXResp, error)
- func (c *Client) GetBTCAddressInscriptions(address string, offset uint, limit uint) ([]*WalletInscription, error)
- func (c *Client) GetBTCAddressInscriptionsAll(address string) ([]*WalletInscription, error)
- func (c *Client) GetBTCAddressTxs(address string, offset int, limit int) ([]*RawaddrTXResp, error)
- func (c *Client) GetBTCAddressTxsV2(address string, lastTxID string) ([]*MempoolTXResp, error)
- func (c *Client) GetBalanceFromBlockcypler(addr string) (uint64, error)
- func (c *Client) GetBalanceFromQuickNode(address string) (*BlockCypherWalletInfo, error)
- func (c *Client) GetBlock(hash string) (*BlockResp, error)
- func (c *Client) GetBlockAuditScore(hash string) (*BlockAuditScoreResp, error)
- func (u *Client) GetBlockCountFromService() (uint64, error)
- func (c *Client) GetBlocksAuditScore(startHeight uint64) ([]*BlockAuditScoreResp, error)
- func (u *Client) GetFeeRate() (int, error)
- func (c *Client) GetLatestBlockHash() (string, int64, error)
- func (u *Client) GetListUnspentBVMInscsForMint(btcAddress string) ([]InscriptionT1, []Utxo, map[string][]InscriptionT2, error)
- func (u *Client) GetListUnspentBVMInscsForSend(btcAddress string, inscUTXOs []*UTXOIns) ([]InscriptionT1, []Utxo, map[string][]InscriptionT2, error)
- func (c *Client) GetMiningPoolBlocks(slug string) ([]*MiningBlockResp, error)
- func (c *Client) GetMiningPools() ([]*MiningPoolResp, error)
- func (c *Client) GetOutAddrsByHeight(height int64) ([]string, []*OutResp, error)
- func (u *Client) GetUTXOs(btcClient *rpcclient.Client, addresses []string, chainCfg *chaincfg.Params, ...) ([]btcjson.ListUnspentResult, error)
- func (u *Client) ParseTx(data string) (*wire.MsgTx, error)
- func (u *Client) SendBVMInscs(btcAddress string, privateKey string, inscIDs []string, addresses []string, ...) (string, string, error)
- func (bs *Client) Transfer(secret string, from string, destination string, amount int) (string, error)
- type CreateOrdInscImgDtoRequest
- type CreateOrdInscImgResp
- type CreateRawTxResponse
- type CreateRawTxTransferSRC20Request
- type CreateSendTxMultiInscRequest
- type CreateSendTxMultiRequest
- type CreateSendTxRequest
- type CreateSendTxResponse
- type CreateTransferSRC20ScriptRequest
- type CreateTransferSRC20ScriptResponse
- type ExecRequest
- type FeeRates
- type GetTxInfoFromBlockStream
- type InscPaymentInfo
- type InscribeTxRequest
- type InscribeTxResponse
- type InscriptionT1
- type InscriptionT2
- type MempoolTXResp
- type MiningBlockResp
- type MiningPoolResp
- type OutResp
- type PaymentInfo
- type QuickNodeUTXO
- type QuickNodeUTXO_Resp
- type RawaddrResp
- type RawaddrTXResp
- type TCInscription
- type TxRef
- type UTXO
- type UTXOFromBlockStream
- type UTXOIns
- type Utxo
- type WalletBalance
- type WalletInscription
Constants ¶
View Source
const ( // This will calculate and include appropriate fees for your transaction to be included in the next 1-2 blocks PreferenceHigh = "high" // This will calculate and include appropriate fees for your transaction to be included in the next 3-6 blocks PreferenceMedium = "medium" // This will calculate and include appropriate fees for your transaction to be included in the next 7 or more blocks PreferenceLow = "low" // No fee PreferenceZero = "zero" )
View Source
const MinSat = 546
Variables ¶
View Source
var BitcoinParamsMaintest = &BitcoinParams{ FirstScannedBTCBlkHeight: uint64(787496), MasterPubKeys: [][]byte{ []byte{0x2, 0xe, 0x8, 0xa, 0xe3, 0xcf, 0xf5, 0x1d, 0xc3, 0xc0, 0x83, 0xaf, 0xa9, 0x24, 0x71, 0x9c, 0x2f, 0xca, 0x62, 0x89, 0x74, 0x70, 0xb4, 0x8b, 0x9, 0x51, 0x3, 0x6f, 0x32, 0x9e, 0xdb, 0x5f, 0xe7}, []byte{0x3, 0xc2, 0x3c, 0x3d, 0x6f, 0x83, 0xbe, 0xc9, 0x56, 0xde, 0x6a, 0x54, 0x90, 0xac, 0x2d, 0xe7, 0xee, 0x5c, 0xf8, 0x63, 0x22, 0x84, 0x9c, 0x61, 0xed, 0x62, 0x5b, 0x69, 0x8f, 0x4a, 0x4a, 0xee, 0x49}, []byte{0x3, 0x3b, 0x75, 0x80, 0x77, 0x8f, 0x4d, 0x2e, 0x46, 0x20, 0x6a, 0xd5, 0x32, 0x66, 0x18, 0xb6, 0xd6, 0x4c, 0x46, 0x1a, 0xe, 0x47, 0xb2, 0x5a, 0x77, 0xad, 0x72, 0xdc, 0x56, 0x4e, 0xa6, 0xca, 0xdb}, []byte{0x2, 0xfc, 0x81, 0x32, 0xba, 0xb2, 0x85, 0x71, 0x82, 0x3f, 0x82, 0x3d, 0x74, 0xe5, 0xd4, 0xa2, 0xff, 0xcb, 0xb, 0xe7, 0x2c, 0x49, 0x63, 0xb3, 0x73, 0x75, 0xf7, 0xc4, 0x41, 0xf9, 0x3e, 0xda, 0x96}, []byte{0x2, 0xb2, 0x14, 0xd8, 0x19, 0x77, 0x31, 0x59, 0xa3, 0xae, 0x9c, 0x30, 0xf9, 0x85, 0xa4, 0xe0, 0x56, 0x1d, 0x98, 0x9d, 0xf6, 0x27, 0xfb, 0xbd, 0xd6, 0x9d, 0x33, 0xdd, 0xa7, 0x25, 0x38, 0x35, 0xb5}, []byte{0x3, 0xb8, 0xc6, 0xf2, 0x80, 0x9d, 0xe5, 0xd, 0x6a, 0x43, 0x57, 0xb9, 0xac, 0xce, 0xaa, 0xd, 0x8, 0xda, 0xd4, 0x75, 0xd9, 0x6a, 0xbf, 0x70, 0x14, 0xe7, 0x2a, 0xeb, 0x68, 0xe0, 0xb1, 0xa4, 0xb4}, []byte{0x2, 0xee, 0x76, 0x26, 0xa3, 0x4f, 0xd, 0xb7, 0x57, 0x21, 0xa4, 0x44, 0x8c, 0xa8, 0x6e, 0x59, 0xa1, 0x32, 0x2d, 0xa6, 0xbe, 0xf8, 0x86, 0xbf, 0x64, 0xa5, 0x94, 0xa7, 0xed, 0x20, 0xfd, 0xc2, 0x52}, }, GeneralMultisigWallet: "bc1qajyp9ekpepmhftxq8aeps4cv8gjkat00nfk9lplqec7mevhv4z6qxy37z8", NumRequiredSigs: 5, TotalSigs: 7, MinDepositAmount: uint64(0), MinWithdrawAmount: uint64(0), DepositFee: uint64(10000), ChainParam: &chaincfg.MainNetParams, InputSize: 192, OutputSize: 43, MaxTxSize: 51200, TaprootInputSize: 68, }
Functions ¶
func GenerateAddressTaproot ¶
Types ¶
type BTCFullnodeConfig ¶
type BitcoinParams ¶
type BitcoinParams struct { FirstScannedBTCBlkHeight uint64 MasterPubKeys [][]byte GeneralMultisigWallet string NumRequiredSigs int TotalSigs int MinDepositAmount uint64 MinWithdrawAmount uint64 DepositFee uint64 ChainParam *chaincfg.Params InputSize int // for multisig OutputSize int MaxTxSize int MaxFeeRate int TaprootInputSize int }
type BlockAuditScoreResp ¶
type BlockCypherWalletInfo ¶
type BlockCypherWalletInfo struct { Address string `json:"address"` TotalReceived int `json:"total_received"` TotalSent int `json:"total_sent"` Balance int `json:"balance"` UnconfirmedBalance int `json:"unconfirmed_balance"` FinalBalance int `json:"final_balance"` NTx int `json:"n_tx"` UnconfirmedNTx int `json:"unconfirmed_n_tx"` FinalNTx int `json:"final_n_tx"` Txrefs []TxRef `json:"txrefs"` TxURL string `json:"tx_url"` Error string `json:"error"` }
type BlockInfoResp ¶
type BlockInfoResp struct { Hash string `json:"hash"` Tx []*struct { Hash string `json:"hash"` Inputs []*struct { PrevOut *struct { Spent bool `json:"spent"` Value uint64 `json:"value"` Addr string `json:"addr"` } `json:"prev_out"` } `json:"inputs"` Out []*struct { Spent bool `json:"spent"` Value uint64 `json:"value"` Addr string `json:"addr"` } `json:"out"` } `json:"tx"` }
type BlockResp ¶
type BlockResp struct { Id string `json:"id"` Extras struct { MatchRate numeric.BigFloat `json:"matchRate"` ExpectedFees int64 `json:"expectedFees"` ExpectedWeight int64 `json:"expectedWeight"` Pool struct { ID uint `json:"id"` Name string `json:"name"` Slug string `json:"slug"` } `json:"pool"` } `json:"extras"` }
type Client ¶
type Client struct { Chain string Network string Token string QNUrl string SdkUrl string BlockstreamUrl string MempoolUrl string HirosoUrl string BlockchainInfoUrl string // contains filtered or unexported fields }
func (*Client) BroadcastBTCTxByMempool ¶
func (*Client) BuildBTCClient ¶
func (u *Client) BuildBTCClient(cfg *BTCFullnodeConfig) (*rpcclient.Client, error)
func (*Client) CheckTXHash ¶
func (*Client) CreateOrdInscImg ¶
func (*Client) CreateOrdInscImgParam ¶
func (c *Client) CreateOrdInscImgParam(req CreateOrdInscImgDtoRequest) (CreateOrdInscImgResp, error)
func (*Client) CreateSendTxSendMultiInsc ¶
func (c *Client) CreateSendTxSendMultiInsc(req CreateSendTxMultiInscRequest) (CreateSendTxResponse, error)
func (*Client) GenerateAddressSegwit ¶
func (*Client) GenerateAddressTaproot ¶
func (*Client) GetBTCAddressAllTxs ¶
func (c *Client) GetBTCAddressAllTxs(address string) ([]*RawaddrTXResp, error)
func (*Client) GetBTCAddressInscriptions ¶
func (*Client) GetBTCAddressInscriptionsAll ¶
func (c *Client) GetBTCAddressInscriptionsAll(address string) ([]*WalletInscription, error)
func (*Client) GetBTCAddressTxs ¶
func (*Client) GetBTCAddressTxsV2 ¶
func (c *Client) GetBTCAddressTxsV2(address string, lastTxID string) ([]*MempoolTXResp, error)
func (*Client) GetBalanceFromBlockcypler ¶
func (*Client) GetBalanceFromQuickNode ¶
func (c *Client) GetBalanceFromQuickNode(address string) (*BlockCypherWalletInfo, error)
func (*Client) GetBlockAuditScore ¶
func (c *Client) GetBlockAuditScore(hash string) (*BlockAuditScoreResp, error)
func (*Client) GetBlockCountFromService ¶
func (*Client) GetBlocksAuditScore ¶
func (c *Client) GetBlocksAuditScore(startHeight uint64) ([]*BlockAuditScoreResp, error)
func (*Client) GetFeeRate ¶
func (*Client) GetListUnspentBVMInscsForMint ¶
func (u *Client) GetListUnspentBVMInscsForMint(btcAddress string) ([]InscriptionT1, []Utxo, map[string][]InscriptionT2, error)
func (*Client) GetListUnspentBVMInscsForSend ¶
func (u *Client) GetListUnspentBVMInscsForSend(btcAddress string, inscUTXOs []*UTXOIns) ([]InscriptionT1, []Utxo, map[string][]InscriptionT2, error)
func (*Client) GetMiningPoolBlocks ¶
func (c *Client) GetMiningPoolBlocks(slug string) ([]*MiningBlockResp, error)
func (*Client) GetMiningPools ¶
func (c *Client) GetMiningPools() ([]*MiningPoolResp, error)
func (*Client) GetOutAddrsByHeight ¶
func (*Client) SendBVMInscs ¶
type CreateOrdInscImgDtoRequest ¶
type CreateOrdInscImgDtoRequest struct { Network int `json:"network"` PrivateString string `json:"privateString"` SenderAddress string `json:"senderAddress"` Utxos []Utxo `json:"utxos"` Inscriptions map[string][]InscriptionT2 `json:"inscriptions"` Data string `json:"data"` ContentType string `json:"contentType"` FeeRatePerByte int `json:"feeRatePerByte"` ReceiverAddress string `json:"receiverAddress"` }
type CreateOrdInscImgResp ¶
type CreateRawTxResponse ¶
type CreateRawTxResponse struct { ErrorCode string `json:"errorCode"` Error string `json:"error"` Data *struct { Base64Psbt string `json:"base64Psbt"` Fee string `json:"fee"` SelectedUTXOs []Utxo `json:"selectedUTXOs"` ChangeAmount string `json:"changeAmount"` IndicesToSign []int `json:"indicesToSign"` } `json:"data"` }
type CreateRawTxTransferSRC20Request ¶
type CreateRawTxTransferSRC20Request struct { PublicKey string `json:"publicKey"` // wif string SenderAddress string `json:"senderAddress"` Utxos []Utxo `json:"utxos"` Inscriptions map[string][]InscriptionT2 `json:"inscriptions"` Data string `json:"data"` ReceiverAddress string `json:"receiverAddress"` PaymentInfos []PaymentInfo `json:"paymentInfos"` FeeRatePerByte int `json:"feeRatePerByte"` Network int `json:"network"` }
type CreateSendTxMultiInscRequest ¶
type CreateSendTxMultiInscRequest struct { PrivateKeyStr string `json:"privateString"` // wif string SenderAddress string `json:"senderAddress"` Utxos []Utxo `json:"utxos"` Inscriptions map[string][]InscriptionT2 `json:"inscriptions"` InscPaymentInfos []InscPaymentInfo `json:"inscPaymentInfos"` PaymentInfos []PaymentInfo `json:"paymentInfos"` FeeRatePerByte int `json:"feeRatePerByte"` Network int `json:"network"` }
type CreateSendTxMultiRequest ¶
type CreateSendTxMultiRequest struct { // PrivateKey string `json:"-"` //buffer PrivateKeyStr string `json:"privateString"` //buffer SenderAddress string `json:"senderAddress"` Utxos []Utxo `json:"utxos"` Inscriptions map[string][]InscriptionT2 `json:"inscriptions"` PaymentInfos []PaymentInfo `json:"paymentInfos"` FeeRatePerByte int `json:"feeRatePerByte"` Network int `json:"network"` }
type CreateSendTxRequest ¶
type CreateSendTxRequest struct { // PrivateKey string `json:"-"` //buffer PrivateKeyStr string `json:"privateString"` //buffer SenderAddress string `json:"senderAddress"` Utxos []Utxo `json:"utxos"` Inscriptions map[string][]InscriptionT2 `json:"inscriptions"` SendInscriptionID string `json:"sendInscriptionID"` ReceiverInsAddress string `json:"receiverInsAddress"` SendAmount string `json:"sendAmount"` FeeRatePerByte int `json:"feeRatePerByte"` Network int `json:"network"` }
type CreateSendTxResponse ¶
type ExecRequest ¶
type ExecRequest struct {
Args []string `json:"args"`
}
type GetTxInfoFromBlockStream ¶
type GetTxInfoFromBlockStream struct { Txid string `json:"txid"` Version int `json:"version"` Locktime int `json:"locktime"` Vin []struct { Txid string `json:"txid"` Vout int `json:"vout"` Prevout struct { Scriptpubkey string `json:"scriptpubkey"` ScriptpubkeyAsm string `json:"scriptpubkey_asm"` ScriptpubkeyType string `json:"scriptpubkey_type"` ScriptpubkeyAddress string `json:"scriptpubkey_address"` Value int `json:"value"` } `json:"prevout"` Scriptsig string `json:"scriptsig"` ScriptsigAsm string `json:"scriptsig_asm"` Witness []string `json:"witness"` IsCoinbase bool `json:"is_coinbase"` Sequence int `json:"sequence"` InnerWitnessscriptAsm string `json:"inner_witnessscript_asm"` } `json:"vin"` Vout []struct { Scriptpubkey string `json:"scriptpubkey"` ScriptpubkeyAsm string `json:"scriptpubkey_asm"` ScriptpubkeyType string `json:"scriptpubkey_type"` ScriptpubkeyAddress string `json:"scriptpubkey_address"` Value int `json:"value"` } `json:"vout"` Size int `json:"size"` Weight int `json:"weight"` Fee int `json:"fee"` Status struct { Confirmed bool `json:"confirmed"` BlockHeight int `json:"block_height"` BlockHash string `json:"block_hash"` BlockTime int `json:"block_time"` } `json:"status"` }
type InscPaymentInfo ¶
type InscribeTxRequest ¶
type InscribeTxRequest struct { // PrivateKey string `json:"-"` //buffer PrivateKeyStr string `json:"privateString"` //buffer SenderAddress string `json:"senderAddress"` Utxos []Utxo `json:"utxos"` Inscriptions map[string][]InscriptionT2 `json:"inscriptions"` Data string `json:"data"` FeeRatePerByte int `json:"feeRatePerByte"` Network int `json:"network"` }
type InscribeTxResponse ¶
type InscribeTxResponse struct { ErrorCode string `json:"errorCode"` Error string `json:"error"` Data *struct { CommitTxID string `json:"commitTxID"` CommitTxHex string `json:"commitTxHex"` RevealTxID string `json:"revealTxID"` RevealTxHex string `json:"revealTxHex"` Fee string `json:"totalFee"` SelectedUTXOs []Utxo `json:"selectedUTXOs"` NewUTXOs []Utxo `json:"newUTXOs"` } `json:"data"` }
type InscriptionT1 ¶
type InscriptionT2 ¶
type MempoolTXResp ¶
type MiningBlockResp ¶
type MiningBlockResp struct {
Id string `json:"id"`
}
type MiningPoolResp ¶
type MiningPoolResp struct { PoolID uint `json:"poolId"` Name string `json:"name"` Link string `json:"link"` BlockCount int `json:"blockCount"` Rank int `json:"rank"` EmptyBlocks int `json:"emptyBlocks"` Slug string `json:"slug"` AvgMatchRate numeric.BigFloat `json:"avgMatchRate"` AvgFeeDelta numeric.BigFloat `json:"avgFeeDelta"` PoolUniqueID uint `json:"poolUniqueId"` }
type PaymentInfo ¶
type QuickNodeUTXO ¶
type QuickNodeUTXO_Resp ¶
type QuickNodeUTXO_Resp struct { ID int `json:"id"` Result []QuickNodeUTXO `json:"result"` Jsonrpc string `json:"jsonrpc"` }
type RawaddrResp ¶
type RawaddrResp struct { NTx uint64 `json:"n_tx"` Txs []*RawaddrTXResp `json:"txs"` }
type RawaddrTXResp ¶
type TCInscription ¶
type TxRef ¶
type TxRef struct { TxHash string `json:"tx_hash"` BlockHeight int `json:"block_height"` TxInputN int `json:"tx_input_n"` TxOutputN int `json:"tx_output_n"` Value int `json:"value"` RefBalance int `json:"ref_balance"` Spent bool `json:"spent"` Confirmations int `json:"confirmations"` Confirmed time.Time `json:"confirmed"` DoubleSpend bool `json:"double_spend"` }
type UTXOFromBlockStream ¶
type WalletBalance ¶
type WalletBalance struct {
Results []*WalletInscription `json:"results"`
}
Click to show internal directories.
Click to hide internal directories.