doginals

package
v0.0.0-...-f6beff1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTxVersion      = 2
	DefaultSequenceNum    = 0xfffffffd
	DefaultRevealOutValue = int64(100000)
	DefaultMinChangeValue = int64(100000)

	WitnessScaleFactor = 4

	ChangeOutputMaxSize = int64(20 + 4 + 34 + 4)
	MaxChunkLen         = 240
	MaxPayloadLen       = 1500
)
View Source
const (
	PubKeyHashAddrID = 0x1e
	ScriptHashAddrID = 0x16
	PrivateKeyID     = 0x9e
)

Variables

View Source
var DogeMainNetParams = chaincfg.Params{
	Name:        "mainnet",
	Net:         wire.MainNet,
	DefaultPort: "8333",

	PowLimit:                 mainPowLimit,
	PowLimitBits:             0x1d00ffff,
	BIP0034Height:            227931,
	BIP0065Height:            388381,
	BIP0066Height:            363725,
	CoinbaseMaturity:         100,
	SubsidyReductionInterval: 210000,
	TargetTimespan:           time.Hour * 24 * 14,
	TargetTimePerBlock:       time.Minute * 10,
	RetargetAdjustmentFactor: 4,
	ReduceMinDifficulty:      false,
	MinDiffReductionTime:     0,
	GenerateSupported:        false,

	RuleChangeActivationThreshold: 1916,
	MinerConfirmationWindow:       2016,

	RelayNonStdTxs: false,

	Bech32HRPSegwit: "doge",

	PubKeyHashAddrID:        PubKeyHashAddrID,
	ScriptHashAddrID:        ScriptHashAddrID,
	PrivateKeyID:            PrivateKeyID,
	WitnessPubKeyHashAddrID: 0x00,
	WitnessScriptHashAddrID: 0x00,

	HDPublicKeyID:  [4]byte{0x02, 0xfa, 0xca, 0xfd},
	HDPrivateKeyID: [4]byte{0x02, 0xfa, 0xc3, 0x98},

	HDCoinType: 3,
}

MainNetParams defines the network parameters for the main Bitcoin network.

Functions

func AddrToPkScript

func AddrToPkScript(addr string) ([]byte, error)

func DogeByteLength

func DogeByteLength(tx *wire.MsgTx) int64

func GetTransactionWeight

func GetTransactionWeight(tx *btcutil.Tx) int64

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 GetTxHex

func GetTxHex(tx *wire.MsgTx) (string, error)

func GetTxVirtualSize

func GetTxVirtualSize(tx *btcutil.Tx) int64

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 Sign

func Sign(tx *wire.MsgTx, privateKeys []*btcec.PrivateKey, prevOutFetcher *txscript.MultiPrevOutFetcher) error

Types

type Chunk

type Chunk struct {
	Buf       []byte
	Len       int
	OpcodeNum int
}

type DogScript

type DogScript struct {
	// contains filtered or unexported fields
}

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(request *InscriptionRequest) (*InscribeTxs, error)

type Inscription

type Inscription struct {
	P   string `json:"p"`
	Op  string `json:"op"`
	Amt string `json:"amt"`
}

func (*Inscription) Amount

func (i *Inscription) Amount() (int64, error)

type InscriptionData

type InscriptionData struct {
	ContentType string `json:"contentType"`
	Body        []byte `json:"body"`
	RevealAddr  string `json:"revealAddr"`
}

type InscriptionRequest

type InscriptionRequest struct {
	CommitTxPrevOutputList []*PrevOutput    `json:"commitTxPrevOutputList"`
	CommitFeeRate          int64            `json:"commitFeeRate"`
	RevealFeeRate          int64            `json:"revealFeeRate"`
	RevealOutValue         int64            `json:"revealOutValue"`
	InscriptionData        *InscriptionData `json:"inscriptionData"`
	Address                string           `json:"address"`
	DustSize               int64            `json:"dustSize"`
}

type InscriptionTool

type InscriptionTool struct {
	CommitTxPrevOutputFetcher *txscript.MultiPrevOutFetcher
	CommitTxPrivateKeyList    []*btcec.PrivateKey
	InscriptionTxCtxData      []*inscriptionTxCtxData
	RevealTxPrevOutputFetcher *txscript.MultiPrevOutFetcher
	CommitTxPrevOutputList    []*PrevOutput
	RevealTxs                 []*wire.MsgTx
	CommitTx                  *wire.MsgTx
	MustCommitTxFee           int64
	MustRevealTxFees          []int64
	CommitAddrs               []string
	FromAddr                  btcutil.Address
	RevealAddr                btcutil.Address
}

func NewInscriptionTool

func NewInscriptionTool(request *InscriptionRequest) (*InscriptionTool, error)

func (*InscriptionTool) CalculateFee

func (tool *InscriptionTool) CalculateFee() (int64, []int64)

func (*InscriptionTool) GetCommitTxHex

func (tool *InscriptionTool) GetCommitTxHex() (string, error)

func (*InscriptionTool) GetRevealTxHexList

func (tool *InscriptionTool) GetRevealTxHexList() ([]string, error)

type PrevOutput

type PrevOutput struct {
	TxId       string `json:"txId"`
	VOut       uint32 `json:"vOut"`
	Amount     int64  `json:"amount"`
	Address    string `json:"address"`
	PrivateKey string `json:"privateKey"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL