dashcoin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EXTRANONCE1_SIZE    = 4
	EXTRANONCE2_SIZE    = 4
	COINBASE_TX_VERSION = 3
	COINBASE_TX_TYPE    = 5
)
View Source
const (
	TRANSACTION_NORMAL                    = 0
	TRANSACTION_PROVIDER_REGISTER         = 1
	TRANSACTION_PROVIDER_UPDATE_SERVICE   = 2
	TRANSACTION_PROVIDER_UPDATE_REGISTRAR = 3
	TRANSACTION_PROVIDER_UPDATE_REVOKE    = 4
	TRANSACTION_COINBASE                  = 5
	TRANSACTION_QUORUM_COMMITMENT         = 6
)
View Source
const (
	GENESISNBITS = uint32(0x1d00ffff)
)

Variables

This section is empty.

Functions

func GetCoinBaseScript

func GetCoinBaseScript(wallet string) ([]byte, error)

func GetCoinBaseScriptByAddress

func GetCoinBaseScriptByAddress(address string) ([]byte, error)

func GetCoinBaseScriptByPubKey

func GetCoinBaseScriptByPubKey(pubKeyHex string) ([]byte, error)

func GetCoinBaseScriptHex

func GetCoinBaseScriptHex(wallet string) (string, error)

func GetDiffWork

func GetDiffWork(diff float64) (float64, error)

func GetGenesisTargetWork

func GetGenesisTargetWork() (float64, error)

func GetHashRateByDiff

func GetHashRateByDiff(diff float64, secs int64, unit string) (float64, error)

func GetHashRateByNBits

func GetHashRateByNBits(nBits uint32, secs int64, unit string) (float64, error)

func GetHashRateByWork

func GetHashRateByWork(work float64, secs int64, unit string) float64

func GetNBitsDiff

func GetNBitsDiff(nBits uint32) float64

func GetTargetDiff

func GetTargetDiff(target *big.Int) (float64, error)

func GetTargetWork

func GetTargetWork(target *big.Int) (float64, error)

func NBits2Target

func NBits2Target(nBits uint32) *big.Int

func PackNumber

func PackNumber(num int64) []byte

func PackString

func PackString(str string) ([]byte, error)

Types

type Block

type Block struct {
	Header BlockHeader
	Vtx    []DashTransaction
}

func (Block) Pack

func (b Block) Pack(writer io.Writer) error

func (Block) PackToHex

func (b Block) PackToHex() (string, error)

func (*Block) UnPack

func (b *Block) UnPack(reader io.Reader) error

func (*Block) UnPackFromHex

func (b *Block) UnPackFromHex(hexStr string) error

type BlockHeader

type BlockHeader struct {
	Version        int32
	HashPrevBlock  bigint.Uint256
	HashMerkleRoot bigint.Uint256
	Time           uint32
	Bits           uint32
	Nonce          uint32
}

func (BlockHeader) Pack

func (b BlockHeader) Pack(writer io.Writer) error

func (*BlockHeader) UnPack

func (b *BlockHeader) UnPack(reader io.Reader) error

type DashCoinBaseTransaction

type DashCoinBaseTransaction struct {
	BlockTime       uint32
	BlockHeight     uint32
	RewardValue     int64
	MasterNodeVouts []MasterNodeVout
	CBExtras        string
	CBAuxFlag       []byte
	ExtraPayload    []byte
	VinScript1      []byte
	VinScript2      []byte
	VoutScript      []byte
	CoinBaseTx1     []byte
	CoinBaseTx2     []byte
}

func (*DashCoinBaseTransaction) Initialize

func (t *DashCoinBaseTransaction) Initialize(cbWallet string, bTime uint32, height uint32, value int64, flags string,
	cbPayload string, cbExtras string, masterNodes []rpc.MasterNode) error

func (*DashCoinBaseTransaction) RecoverToDashTransaction

func (t *DashCoinBaseTransaction) RecoverToDashTransaction(extraNonce1Hex string, extraNonce2Hex string) (DashTransaction, error)

type DashTransaction

type DashTransaction struct {
	Vin          []TxIn
	Vout         []TxOut
	Version      int32
	LockTime     uint32
	ExtraPayload script.Script
	Version16    int16
	Type16       int16
}

func (DashTransaction) CalcTrxId

func (t DashTransaction) CalcTrxId() (bigint.Uint256, error)

func (*DashTransaction) GetTrxPrintAble

func (t *DashTransaction) GetTrxPrintAble() TrxPrintAble

func (DashTransaction) Pack

func (t DashTransaction) Pack(writer io.Writer) error

func (DashTransaction) PackToHex

func (t DashTransaction) PackToHex() (string, error)

func (*DashTransaction) UnPack

func (t *DashTransaction) UnPack(reader io.Reader) error

func (*DashTransaction) UnPackFromHex

func (t *DashTransaction) UnPackFromHex(hexStr string) error

type MasterNodeVout

type MasterNodeVout struct {
	Amount     int64
	VoutScript []byte
}

type OutPoint

type OutPoint struct {
	Hash bigint.Uint256
	N    uint32
}

func (OutPoint) Pack

func (o OutPoint) Pack(writer io.Writer) error

func (*OutPoint) UnPack

func (o *OutPoint) UnPack(reader io.Reader) error

type OutPointPrintAble

type OutPointPrintAble struct {
	Hash string
	N    uint32
}

type TrxPrintAble

type TrxPrintAble struct {
	Vin          []TxInPrintAble
	Vout         []TxOutPrintAble
	Version      int32
	LockTime     uint32
	ExtraPayload string
	Version16    int16
	Type16       int16
}

type TxIn

type TxIn struct {
	PrevOut   OutPoint
	ScriptSig script.Script
	Sequence  uint32
}

func (TxIn) Pack

func (t TxIn) Pack(writer io.Writer) error

func (*TxIn) UnPack

func (t *TxIn) UnPack(reader io.Reader) error

type TxInPrintAble

type TxInPrintAble struct {
	PrevOut   OutPointPrintAble
	ScriptSig string
	Sequence  uint32
}

type TxOut

type TxOut struct {
	Value        int64
	ScriptPubKey script.Script
}

func (TxOut) Pack

func (t TxOut) Pack(writer io.Writer) error

func (*TxOut) UnPack

func (t *TxOut) UnPack(reader io.Reader) error

type TxOutPrintAble

type TxOutPrintAble struct {
	Value        int64
	ScriptPubKey string
	Address      string
	ScriptType   string
}

Jump to

Keyboard shortcuts

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