Documentation ¶
Index ¶
- Constants
- Variables
- func BuildEtchingCompleteRevealTx(etching *runestone.Etching, feeRate int64, privateKey string, ...) ([]byte, int64, string, error)
- func BuildEtchingDummyRevealTx(etching *runestone.Etching, feeRate int64, privateKey string, toAddr string, ...) (int64, string, error)
- func BuildEtchingTxs(etching *runestone.Etching, feeRate int64, privateKey string, ...) ([]byte, []byte, int64, string, error)
- func BuildInscriptionTxs(privateKey *btcec.PrivateKey, utxo []*Utxo, mime string, content []byte, ...) ([]byte, []byte, int64, error)
- func BuildRuneEtchingCompleteRevealTx(privateKey *btcec.PrivateKey, runeOpReturnData []byte, runeCommitment []byte, ...) ([]byte, int64, string, error)
- func BuildRuneEtchingDummyRevealTx(privateKey *btcec.PrivateKey, runeOpReturnData []byte, runeCommitment []byte, ...) (int64, string, error)
- func BuildRuneEtchingTxs(privateKey *btcec.PrivateKey, utxo []*Utxo, runeOpReturnData []byte, ...) ([]byte, []byte, int64, string, error)
- func BuildTransferBTCTx(privateKey *btcec.PrivateKey, utxo []*Utxo, toAddr string, ...) ([]byte, error)
- func CreateCommitmentScript(pk *btcec.PublicKey, commitment []byte) ([]byte, error)
- func CreateInscriptionScript(pk *btcec.PublicKey, contentType string, fileBytes []byte, ...) ([]byte, error)
- func FromHex(s string) []byte
- func Generate(compress bool) (wif, address, segwitBech32, segwitNested, p2tr string, err error)
- func GenerateFromBytes(prvKey *btcec.PrivateKey, compress bool) (wif, address, segwitBech32, segwitNested, p2tr string, err error)
- func GetInscriptionContent(tx *wire.MsgTx) (contentType string, content []byte, err error)
- func GetOrdinalsContent(tapScript []byte) (mime string, content []byte, err error)
- func GetP2TRAddress(pubKey *btcec.PublicKey, net *chaincfg.Params) (string, error)
- func GetPrivateKeyAddr(privateKey string, network *chaincfg.Params) (*btcec.PrivateKey, string, error)
- func GetTapScriptAddress(pk *btcec.PublicKey, revealedScript []byte, net *chaincfg.Params) (btcutil.Address, error)
- func GetTaprootPubkey(pubkey *btcec.PublicKey, revealedScript []byte) (*btcec.PublicKey, error)
- func GetUtilP2TRAddress(pubKey *btcec.PublicKey, net *chaincfg.Params) (btcutil.Address, error)
- func Hex2Bytes(str string) []byte
- func IsOrdinalsScript(script []byte) bool
- func IsTapScript(witness wire.TxWitness) bool
- func SendRevealTx(connector *MempoolConnector, rtx []byte) error
- func SendTx(connector *MempoolConnector, ctx []byte, rtx []byte) error
- func VerifyTx(rawTx string, prevTxOutScript []byte, prevTxOutValue int64) error
- type BtcTxInfo
- type CoinType
- type Hash
- type Key
- type KeyManager
- func (km *KeyManager) GetAccountKey(purpose, coinType, account uint32) (*bip32.Key, error)
- func (km *KeyManager) GetChangeKey(purpose, coinType, account, change uint32) (*bip32.Key, error)
- func (km *KeyManager) GetCoinTypeKey(purpose, coinType uint32) (*bip32.Key, error)
- func (km *KeyManager) GetKey(purpose, coinType, account, change, index uint32) (*Key, error)
- func (km *KeyManager) GetMasterKey() (*bip32.Key, error)
- func (km *KeyManager) GetMnemonic() string
- func (km *KeyManager) GetPassphrase() string
- func (km *KeyManager) GetPurposeKey(purpose uint32) (*bip32.Key, error)
- func (km *KeyManager) GetSeed() []byte
- type MempoolConnector
- func (m MempoolConnector) GetBalance(address string) (uint64, error)
- func (m MempoolConnector) GetBlockByHash(blockHash Hash) (*wire.MsgBlock, error)
- func (m MempoolConnector) GetBlockByHeight(height uint64) (*wire.MsgBlock, error)
- func (m MempoolConnector) GetBlockHashByHeight(height uint64) ([]byte, error)
- func (m MempoolConnector) GetBlockHeight() (uint64, error)
- func (m MempoolConnector) GetBlockTxIDS(bh Hash) ([]Hash, error)
- func (m MempoolConnector) GetHeaderByHash(h Hash) (*wire.BlockHeader, error)
- func (m MempoolConnector) GetRawTxByHash(hash string) (*wire.MsgTx, error)
- func (m MempoolConnector) GetTxByHash(hash string) (*BtcTxInfo, error)
- func (m MempoolConnector) GetUtxos(address string) ([]*Utxo, error)
- func (m MempoolConnector) SendRawTransaction(tx *wire.MsgTx, allowHighFees bool) (*chainhash.Hash, error)
- type Purpose
- type Utxo
- type UtxoList
Constants ¶
const (
Apostrophe uint32 = 0x80000000 // 0'
)
const HashLength = 32
const (
MaxStandardTxWeight = blockchain.MaxBlockWeight / 10
)
Variables ¶
var ZeroHash = Hash{}
Functions ¶
func BuildEtchingTxs ¶
func BuildInscriptionTxs ¶
func BuildRuneEtchingTxs ¶
func BuildTransferBTCTx ¶
func CreateCommitmentScript ¶
func CreateInscriptionScript ¶
func FromHex ¶
FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".
func GenerateFromBytes ¶
func GetInscriptionContent ¶
func GetOrdinalsContent ¶
func GetP2TRAddress ¶
GetP2TRAddress returns a taproot address for a given public key.
func GetPrivateKeyAddr ¶
func GetTapScriptAddress ¶
func GetTaprootPubkey ¶
func GetUtilP2TRAddress ¶
func IsOrdinalsScript ¶
func IsTapScript ¶
func SendRevealTx ¶
func SendRevealTx(connector *MempoolConnector, rtx []byte) error
Types ¶
type CoinType ¶
type CoinType = uint32
CoinType SLIP-0044 : Registered coin types for BIP-0044 https://github.com/satoshilabs/slips/blob/master/slip-0044.md
type Hash ¶
type Hash [HashLength]byte
func BytesToHash ¶
BytesToHash sets b to hash. If b is larger than len(h), b will be cropped from the left.
type KeyManager ¶
type KeyManager struct {
// contains filtered or unexported fields
}
func NewKeyManager ¶
func NewKeyManager(bitSize int, passphrase, mnemonic string) (*KeyManager, error)
NewKeyManager return new key manager bitSize has to be a multiple 32 and be within the inclusive range of {128, 256} 128: 12 phrases 256: 24 phrases
func (*KeyManager) GetAccountKey ¶
func (km *KeyManager) GetAccountKey(purpose, coinType, account uint32) (*bip32.Key, error)
func (*KeyManager) GetChangeKey ¶
func (km *KeyManager) GetChangeKey(purpose, coinType, account, change uint32) (*bip32.Key, error)
GetChangeKey ... https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#change change constant 0 is used for external chain change constant 1 is used for internal chain (also known as change addresses)
func (*KeyManager) GetCoinTypeKey ¶
func (km *KeyManager) GetCoinTypeKey(purpose, coinType uint32) (*bip32.Key, error)
func (*KeyManager) GetKey ¶
func (km *KeyManager) GetKey(purpose, coinType, account, change, index uint32) (*Key, error)
func (*KeyManager) GetMasterKey ¶
func (km *KeyManager) GetMasterKey() (*bip32.Key, error)
func (*KeyManager) GetMnemonic ¶
func (km *KeyManager) GetMnemonic() string
func (*KeyManager) GetPassphrase ¶
func (km *KeyManager) GetPassphrase() string
func (*KeyManager) GetPurposeKey ¶
func (km *KeyManager) GetPurposeKey(purpose uint32) (*bip32.Key, error)
func (*KeyManager) GetSeed ¶
func (km *KeyManager) GetSeed() []byte
type MempoolConnector ¶
type MempoolConnector struct {
// contains filtered or unexported fields
}
func NewMempoolConnector ¶
func NewMempoolConnector() *MempoolConnector
func (MempoolConnector) GetBalance ¶
func (m MempoolConnector) GetBalance(address string) (uint64, error)
func (MempoolConnector) GetBlockByHash ¶
func (m MempoolConnector) GetBlockByHash(blockHash Hash) (*wire.MsgBlock, error)
func (MempoolConnector) GetBlockByHeight ¶
func (m MempoolConnector) GetBlockByHeight(height uint64) (*wire.MsgBlock, error)
func (MempoolConnector) GetBlockHashByHeight ¶
func (m MempoolConnector) GetBlockHashByHeight(height uint64) ([]byte, error)
func (MempoolConnector) GetBlockHeight ¶
func (m MempoolConnector) GetBlockHeight() (uint64, error)
func (MempoolConnector) GetBlockTxIDS ¶
func (m MempoolConnector) GetBlockTxIDS(bh Hash) ([]Hash, error)
func (MempoolConnector) GetHeaderByHash ¶
func (m MempoolConnector) GetHeaderByHash(h Hash) (*wire.BlockHeader, error)
func (MempoolConnector) GetRawTxByHash ¶
func (m MempoolConnector) GetRawTxByHash(hash string) (*wire.MsgTx, error)
func (MempoolConnector) GetTxByHash ¶
func (m MempoolConnector) GetTxByHash(hash string) (*BtcTxInfo, error)
func (MempoolConnector) GetUtxos ¶
func (m MempoolConnector) GetUtxos(address string) ([]*Utxo, error)
func (MempoolConnector) SendRawTransaction ¶
type Purpose ¶
type Purpose = uint32
Purpose BIP43 - Purpose Field for Deterministic Wallets https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki
Purpose is a constant set to 44' (or 0x8000002C) following the BIP43 recommendation. It indicates that the subtree of this node is used according to this specification.
What does 44' mean in BIP44? https://bitcoin.stackexchange.com/questions/74368/what-does-44-mean-in-bip44
44' means that hardened keys should be used. The distinguisher for whether a key a given index is hardened is that the index is greater than 2^31, which is 2147483648. In hex, that is 0x80000000. That is what the apostrophe (') means. The 44 comes from adding it to 2^31 to get the final hardened key index. In hex, 44 is 2C, so 0x80000000 + 0x2C = 0x8000002C.