Documentation ¶
Index ¶
- Constants
- Variables
- func CompressMsgpackMarshalPanic(val interface{}) []byte
- func DecompressMsgpackUnmarshal(data []byte, val interface{}) error
- func MsgpackMarshalPanic(val interface{}) []byte
- func MsgpackUnmarshal(data []byte, val interface{}) error
- type Address
- type Asset
- type DataStore
- type DepositData
- type DeprecatedSnapshot
- type Domain
- type DomainReader
- type GenesisHackInput
- type GenesisHackTransaction
- type GhostChecker
- type Input
- type Integer
- func (x Integer) Add(y Integer) (v Integer)
- func (x Integer) Cmp(y Integer) int
- func (x Integer) Div(y int) (v Integer)
- func (x Integer) MarshalJSON() ([]byte, error)
- func (x Integer) MarshalMsgpack() ([]byte, error)
- func (x Integer) Mul(y int) (v Integer)
- func (x Integer) Sign() int
- func (x Integer) String() string
- func (x Integer) Sub(y Integer) (v Integer)
- func (x *Integer) UnmarshalJSON(b []byte) error
- func (x *Integer) UnmarshalMsgpack(data []byte) error
- type MintData
- type MintDistribution
- type Node
- type NodeReader
- type Output
- type Round
- type RoundLink
- type Script
- type SignedGenesisHackTransaction
- type SignedTransaction
- func (tx *SignedTransaction) AsLatestVersion() *VersionedTransaction
- func (tx *SignedTransaction) DepositData() *DepositData
- func (signed *SignedTransaction) SignInput(reader UTXOReader, index int, accounts []Address) error
- func (signed *SignedTransaction) SignRaw(key crypto.Key) error
- func (signed *SignedTransaction) SignUTXO(utxo *UTXO, accounts []Address) error
- func (tx *SignedTransaction) TransactionType() uint8
- type Snapshot
- type SnapshotWithTopologicalOrder
- type Transaction
- func (tx *Transaction) AddDepositInput(data *DepositData)
- func (tx *Transaction) AddInput(hash crypto.Hash, index int)
- func (tx *Transaction) AddKernelNodeMintInput(batch uint64, amount Integer)
- func (tx *Transaction) AddOutputWithType(ot uint8, accounts []Address, s Script, amount Integer, seed []byte)
- func (tx *Transaction) AddRandomScriptOutput(accounts []Address, s Script, amount Integer) error
- func (tx *Transaction) AddScriptOutput(accounts []Address, s Script, amount Integer, seed []byte)
- func (tx *Transaction) AsLatestVersion() *VersionedTransaction
- func (tx *Transaction) ViewGhostKey(a *crypto.Key) []*Output
- type UTXO
- type UTXOLocker
- type UTXOReader
- type UTXOWithLock
- type VersionedTransaction
- func (ver *VersionedTransaction) CompressMarshal() []byte
- func (tx *VersionedTransaction) LockInputs(locker UTXOLocker, fork bool) error
- func (ver *VersionedTransaction) Marshal() []byte
- func (ver *VersionedTransaction) PayloadHash() crypto.Hash
- func (ver *VersionedTransaction) PayloadMarshal() []byte
- func (tx *VersionedTransaction) UnspentOutputs() []*UTXO
- func (ver *VersionedTransaction) Validate(store DataStore) error
- type WithdrawalData
Constants ¶
View Source
const ( NodeStatePledging = "PLEDGING" NodeStateAccepted = "ACCEPTED" NodeStateResigning = "RESIGNING" NodeStateRemoved = "REMOVED" NodeStateCancelled = "CANCELLED" )
View Source
const ( Operator0 = 0x00 Operator64 = 0x40 OperatorSum = 0xfe OperatorCmp = 0xff )
View Source
const ( TxVersion = 0x01 ExtraSizeLimit = 256 OutputTypeScript = 0x00 OutputTypeWithdrawalSubmit = 0xa1 OutputTypeWithdrawalFuel = 0xa2 OutputTypeNodePledge = 0xa3 OutputTypeNodeAccept = 0xa4 OutputTypeNodeResign = 0xa5 OutputTypeNodeRemove = 0xa6 OutputTypeDomainAccept = 0xa7 OutputTypeDomainRemove = 0xa8 OutputTypeWithdrawalClaim = 0xa9 OutputTypeNodeCancel = 0xaa TransactionTypeScript = 0x00 TransactionTypeMint = 0x01 TransactionTypeDeposit = 0x02 TransactionTypeWithdrawalSubmit = 0x03 TransactionTypeWithdrawalFuel = 0x04 TransactionTypeWithdrawalClaim = 0x05 TransactionTypeNodePledge = 0x06 TransactionTypeNodeAccept = 0x07 TransactionTypeNodeResign = 0x08 TransactionTypeNodeRemove = 0x09 TransactionTypeDomainAccept = 0x10 TransactionTypeDomainRemove = 0x11 TransactionTypeNodeCancel = 0x12 TransactionTypeUnknown = 0xff )
View Source
const MainNetworkId = "XIN"
View Source
const (
MintGroupKernelNode = "KERNELNODE"
)
View Source
const Precision = 8
View Source
const (
SnapshotVersion = 1
)
Variables ¶
View Source
var ( CompressionVersionZero = []byte{0, 0, 0, 0} CompressionVersionLatest = CompressionVersionZero )
View Source
var (
XINAssetId crypto.Hash
)
Functions ¶
func CompressMsgpackMarshalPanic ¶ added in v0.2.7
func CompressMsgpackMarshalPanic(val interface{}) []byte
func DecompressMsgpackUnmarshal ¶ added in v0.2.7
func MsgpackMarshalPanic ¶
func MsgpackMarshalPanic(val interface{}) []byte
func MsgpackUnmarshal ¶ added in v0.1.13
Types ¶
type Address ¶
type Address struct { PrivateSpendKey crypto.Key PrivateViewKey crypto.Key PublicSpendKey crypto.Key PublicViewKey crypto.Key }
func NewAddressFromSeed ¶
func NewAddressFromString ¶
func (Address) MarshalJSON ¶
func (*Address) UnmarshalJSON ¶
type Asset ¶ added in v0.1.14
func (*Asset) FeeAssetId ¶ added in v0.1.14
type DataStore ¶
type DataStore interface { UTXOReader UTXOLocker GhostChecker NodeReader DomainReader }
type DepositData ¶
type DepositData struct { Chain crypto.Hash `json:"chain"` AssetKey string `json:"asset"` TransactionHash string `json:"transaction"` OutputIndex uint64 `json:"index"` Amount Integer `json:"amount"` }
func (*DepositData) Asset ¶ added in v0.1.14
func (d *DepositData) Asset() *Asset
func (*DepositData) UniqueKey ¶ added in v0.1.4
func (d *DepositData) UniqueKey() crypto.Hash
type DeprecatedSnapshot ¶ added in v0.5.0
type DomainReader ¶
type DomainReader interface {
ReadDomains() []Domain
}
type GenesisHackInput ¶ added in v0.1.14
type GenesisHackTransaction ¶ added in v0.1.14
type Integer ¶
type Integer struct {
// contains filtered or unexported fields
}
var Zero Integer
func NewInteger ¶
func NewIntegerFromString ¶
func (Integer) MarshalJSON ¶
func (Integer) MarshalMsgpack ¶
func (*Integer) UnmarshalJSON ¶
func (*Integer) UnmarshalMsgpack ¶
type MintData ¶ added in v0.1.1
type MintData struct { Group string `json:"group"` Batch uint64 `json:"batch"` Amount Integer `json:"amount"` }
func (*MintData) Distribute ¶ added in v0.1.1
func (m *MintData) Distribute(tx crypto.Hash) *MintDistribution
type MintDistribution ¶ added in v0.1.1
type Node ¶
type NodeReader ¶
type Output ¶
type Output struct { Type uint8 `json:"type"` Amount Integer `json:"amount"` Keys []crypto.Key `json:"keys,omitempty"` Withdrawal *WithdrawalData `msgpack:",omitempty"json:"withdrawal,omitempty"` // OutputTypeScript fields Script Script `json:"script,omitempty"` Mask crypto.Key `json:"mask,omitempty"` }
type Script ¶
type Script []uint8
func NewThresholdScript ¶ added in v0.1.1
func (Script) MarshalJSON ¶
func (*Script) UnmarshalJSON ¶
func (Script) VerifyFormat ¶
type SignedGenesisHackTransaction ¶ added in v0.1.14
type SignedGenesisHackTransaction struct { GenesisHackTransaction Signatures [][]crypto.Signature }
type SignedTransaction ¶
type SignedTransaction struct { Transaction Signatures [][]crypto.Signature `json:"signatures,omitempty"` }
func (*SignedTransaction) AsLatestVersion ¶ added in v0.4.1
func (tx *SignedTransaction) AsLatestVersion() *VersionedTransaction
func (*SignedTransaction) DepositData ¶ added in v0.1.14
func (tx *SignedTransaction) DepositData() *DepositData
func (*SignedTransaction) SignInput ¶
func (signed *SignedTransaction) SignInput(reader UTXOReader, index int, accounts []Address) error
func (*SignedTransaction) SignUTXO ¶ added in v0.5.10
func (signed *SignedTransaction) SignUTXO(utxo *UTXO, accounts []Address) error
func (*SignedTransaction) TransactionType ¶ added in v0.2.0
func (tx *SignedTransaction) TransactionType() uint8
type Snapshot ¶
type Snapshot struct { Version uint8 `json:"version"` NodeId crypto.Hash `json:"node"` Transaction crypto.Hash `json:"transaction"` References *RoundLink `json:"references"` RoundNumber uint64 `json:"round"` Timestamp uint64 `json:"timestamp"` Signatures []*crypto.Signature `json:"signatures,omitempty"msgpack:",omitempty"` Signature *crypto.CosiSignature `json:"signature,omitempty"msgpack:",omitempty"` Hash crypto.Hash `msgpack:"-"json:"hash"` Commitment *crypto.Key `msgpack:"-"json:"-"` }
func (*Snapshot) PayloadHash ¶
func (*Snapshot) VersionedPayload ¶ added in v0.5.0
type Transaction ¶
type Transaction struct { Version uint8 `json:"version"` Asset crypto.Hash `json:"asset"` Inputs []*Input `json:"inputs"` Outputs []*Output `json:"outputs"` Extra []byte `json:"extra,omitempty"` }
func NewTransaction ¶
func NewTransaction(asset crypto.Hash) *Transaction
func (*Transaction) AddDepositInput ¶
func (tx *Transaction) AddDepositInput(data *DepositData)
func (*Transaction) AddKernelNodeMintInput ¶ added in v0.1.1
func (tx *Transaction) AddKernelNodeMintInput(batch uint64, amount Integer)
func (*Transaction) AddOutputWithType ¶ added in v0.2.0
func (*Transaction) AddRandomScriptOutput ¶ added in v0.2.0
func (tx *Transaction) AddRandomScriptOutput(accounts []Address, s Script, amount Integer) error
func (*Transaction) AddScriptOutput ¶
func (tx *Transaction) AddScriptOutput(accounts []Address, s Script, amount Integer, seed []byte)
func (*Transaction) AsLatestVersion ¶ added in v0.1.14
func (tx *Transaction) AsLatestVersion() *VersionedTransaction
func (*Transaction) ViewGhostKey ¶
func (tx *Transaction) ViewGhostKey(a *crypto.Key) []*Output
type UTXOLocker ¶
type UTXOReader ¶
type UTXOReader interface { ReadUTXO(hash crypto.Hash, index int) (*UTXOWithLock, error) CheckDepositInput(deposit *DepositData, tx crypto.Hash) error ReadLastMintDistribution(group string) (*MintDistribution, error) }
type UTXOWithLock ¶
type VersionedTransaction ¶ added in v0.1.14
type VersionedTransaction struct { SignedTransaction BadGenesis *SignedGenesisHackTransaction }
func DecompressUnmarshalVersionedTransaction ¶ added in v0.2.7
func DecompressUnmarshalVersionedTransaction(val []byte) (*VersionedTransaction, error)
func UnmarshalVersionedTransaction ¶ added in v0.1.14
func UnmarshalVersionedTransaction(val []byte) (*VersionedTransaction, error)
func (*VersionedTransaction) CompressMarshal ¶ added in v0.2.7
func (ver *VersionedTransaction) CompressMarshal() []byte
func (*VersionedTransaction) LockInputs ¶ added in v0.1.14
func (tx *VersionedTransaction) LockInputs(locker UTXOLocker, fork bool) error
func (*VersionedTransaction) Marshal ¶ added in v0.1.14
func (ver *VersionedTransaction) Marshal() []byte
func (*VersionedTransaction) PayloadHash ¶ added in v0.1.14
func (ver *VersionedTransaction) PayloadHash() crypto.Hash
func (*VersionedTransaction) PayloadMarshal ¶ added in v0.1.14
func (ver *VersionedTransaction) PayloadMarshal() []byte
func (*VersionedTransaction) UnspentOutputs ¶ added in v0.1.14
func (tx *VersionedTransaction) UnspentOutputs() []*UTXO
func (*VersionedTransaction) Validate ¶ added in v0.1.14
func (ver *VersionedTransaction) Validate(store DataStore) error
Click to show internal directories.
Click to hide internal directories.