Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeCustodianNode(custodian, payee *Address, signerSpend, payeeSpend, custodianSpend *crypto.Key, ...) []byte
- func NewZstdDecoder(ccr int) *zstd.Decoder
- func NewZstdEncoder(ccr int) *zstd.Encoder
- type Address
- type AggregatedSignature
- type Asset
- type CustodianNode
- type CustodianReader
- type CustodianUpdateRequest
- type DataStore
- type Decoder
- func (dec *Decoder) DecodeSnapshotWithTopo() (*SnapshotWithTopologicalOrder, error)
- func (dec *Decoder) DecodeTransaction() (*SignedTransaction, error)
- func (dec *Decoder) Read(b []byte) error
- func (dec *Decoder) ReadAggregatedSignature() (*AggregatedSignature, error)
- func (dec *Decoder) ReadByte() (byte, error)
- func (dec *Decoder) ReadBytes() ([]byte, error)
- func (dec *Decoder) ReadCosiSignature() (*crypto.CosiSignature, error)
- func (dec *Decoder) ReadInput() (*Input, error)
- func (dec *Decoder) ReadInt() (int, error)
- func (dec *Decoder) ReadInteger() (Integer, error)
- func (dec *Decoder) ReadMagic() (bool, error)
- func (dec *Decoder) ReadOutput() (*Output, error)
- func (dec *Decoder) ReadRoundReferences() (*RoundLink, error)
- func (dec *Decoder) ReadSignatures() (map[uint16]*crypto.Signature, error)
- func (dec *Decoder) ReadUint16() (uint16, error)
- func (dec *Decoder) ReadUint32() (uint32, error)
- func (dec *Decoder) ReadUint64() (uint64, error)
- type DepositData
- type DeprecatedSnapshot
- type Domain
- type DomainReader
- type Encoder
- func (enc *Encoder) Bytes() []byte
- func (enc *Encoder) EncodeAggregatedSignature(js *AggregatedSignature)
- func (enc *Encoder) EncodeCosiSignature(s *crypto.CosiSignature)
- func (enc *Encoder) EncodeInput(in *Input)
- func (enc *Encoder) EncodeOutput(o *Output)
- func (enc *Encoder) EncodeRoundReferences(r *RoundLink)
- func (enc *Encoder) EncodeSignatures(sm map[uint16]*crypto.Signature)
- func (enc *Encoder) EncodeSnapshotPayload(s *Snapshot) []byte
- func (enc *Encoder) EncodeSnapshotWithTopo(s *SnapshotWithTopologicalOrder) []byte
- func (enc *Encoder) EncodeTransaction(signed *SignedTransaction) []byte
- func (enc *Encoder) Write(b []byte)
- func (enc *Encoder) WriteByte(b byte) error
- func (enc *Encoder) WriteInt(d int)
- func (enc *Encoder) WriteInteger(d Integer)
- func (enc *Encoder) WriteUint16(d uint16)
- func (enc *Encoder) WriteUint32(d uint32)
- func (enc *Encoder) WriteUint64(d uint64)
- type GenesisHackInput
- type GenesisHackTransaction
- type GhostLocker
- type Input
- type Integer
- func (x Integer) Add(y Integer) (v Integer)
- func (x Integer) Cmp(y Integer) int
- func (x Integer) Count(y Integer) uint64
- 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) Ration(y Integer) (v RationalNumber)
- 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 RationalNumber
- type Round
- type RoundLink
- type RoundSpace
- type Script
- type SignedGenesisHackTransaction
- type SignedTransaction
- func (signed *SignedTransaction) AggregateSign(reader UTXOKeysReader, accounts [][]*Address, seed []byte) error
- func (tx *SignedTransaction) AsVersioned() *VersionedTransaction
- func (signed *SignedTransaction) SignInput(reader UTXOKeysReader, index int, accounts []*Address) error
- func (signed *SignedTransaction) SignInputV1(reader UTXOKeysReader, index int, accounts []*Address) error
- func (signed *SignedTransaction) SignRaw(key crypto.Key) error
- func (signed *SignedTransaction) SignRawV1(key crypto.Key) error
- func (signed *SignedTransaction) SignUTXO(utxo *UTXO, accounts []*Address) error
- func (tx *SignedTransaction) TransactionType() uint8
- type SignedTransactionV1
- type Snapshot
- type SnapshotWithTopologicalOrder
- type SnapshotWork
- type Transaction
- func (tx *Transaction) AddDepositInput(data *DepositData)
- func (tx *Transaction) AddInput(hash crypto.Hash, index int)
- func (tx *Transaction) AddKernelNodeMintInputLegacy(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) AddUniversalMintInput(batch uint64, amount Integer)
- func (tx *Transaction) AsVersioned() *VersionedTransaction
- func (tx *Transaction) DepositData() *DepositData
- func (tx *Transaction) ViewGhostKey(a *crypto.Key) []*Output
- type UTXO
- type UTXOKeys
- type UTXOKeysReader
- type UTXOLockReader
- type UTXOLocker
- 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() []*UTXOWithLock
- func (ver *VersionedTransaction) Validate(store DataStore, fork bool) error
- type WithdrawalData
Constants ¶
View Source
const ( MinimumEncodingVersion = 0x1 MaximumEncodingInt = 0xFFFF AggregatedSignaturePrefix = 0xFF01 AggregatedSignatureSparseMask = byte(0x01) AggregatedSignatureOrdinaryMask = byte(0x00) )
View Source
const ( NodeStatePledging = "PLEDGING" NodeStateAccepted = "ACCEPTED" NodeStateRemoved = "REMOVED" NodeStateCancelled = "CANCELLED" )
View Source
const ( Operator0 = 0x00 Operator64 = 0x40 OperatorSum = 0xfe OperatorCmp = 0xff )
View Source
const ( SnapshotVersionMsgpackEncoding = 1 SnapshotVersionCommonEncoding = 2 )
View Source
const ( TxVersionReferences = 0x04 TxVersionBlake3Hash = 0x03 TxVersionCommonEncoding = 0x02 ExtraSizeGeneralLimit = 256 ExtraSizeStorageStep = 1024 ExtraSizeStorageCapacity = 1024 * 1024 * 4 ExtraStoragePriceStep = "0.001" SliceCountLimit = 256 ReferencesCountLimit = 2 OutputTypeScript = 0x00 OutputTypeWithdrawalSubmit = 0xa1 OutputTypeWithdrawalFuel = 0xa2 OutputTypeNodePledge = 0xa3 OutputTypeNodeAccept = 0xa4 OutputTypeNodeRemove = 0xa6 OutputTypeDomainAccept = 0xa7 OutputTypeDomainRemove = 0xa8 OutputTypeWithdrawalClaim = 0xa9 OutputTypeNodeCancel = 0xaa OutputTypeCustodianUpdateNodes = 0xb1 OutputTypeCustodianSlashNodes = 0xb2 TransactionTypeScript = 0x00 TransactionTypeMint = 0x01 TransactionTypeDeposit = 0x02 TransactionTypeWithdrawalSubmit = 0x03 TransactionTypeWithdrawalFuel = 0x04 TransactionTypeWithdrawalClaim = 0x05 TransactionTypeNodePledge = 0x06 TransactionTypeNodeAccept = 0x07 TransactionTypeNodeRemove = 0x09 TransactionTypeDomainAccept = 0x10 TransactionTypeDomainRemove = 0x11 TransactionTypeNodeCancel = 0x12 TransactionTypeCustodianUpdateNodes = 0x13 TransactionTypeCustodianSlashNodes = 0x14 TransactionTypeUnknown = 0xff )
View Source
const MainNetworkId = "XIN"
View Source
const Precision = 8
Variables ¶
View Source
var ( CompressionVersionZero = []byte{0, 0, 0, 0} CompressionVersionLatest = CompressionVersionZero )
View Source
var (
XINAssetId crypto.Hash
)
View Source
var ZstdEmbed []byte
Functions ¶
func EncodeCustodianNode ¶ added in v0.16.0
func NewZstdDecoder ¶ added in v0.12.22
func NewZstdEncoder ¶ added in v0.12.22
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 AggregatedSignature ¶ added in v0.12.18
type Asset ¶ added in v0.1.14
func (*Asset) FeeAssetId ¶ added in v0.1.14
type CustodianNode ¶ added in v0.16.0
func ParseCustodianNode ¶ added in v0.16.0
func ParseCustodianNode(extra []byte) (*CustodianNode, error)
type CustodianReader ¶ added in v0.16.0
type CustodianReader interface { DomainReader ReadCustodian(ts uint64) (*CustodianUpdateRequest, error) }
type CustodianUpdateRequest ¶ added in v0.16.0
type CustodianUpdateRequest struct { Custodian *Address Nodes []*CustodianNode Signature *crypto.Signature Transaction crypto.Hash Timestamp uint64 }
func ParseCustodianUpdateNodesExtra ¶ added in v0.16.0
func ParseCustodianUpdateNodesExtra(extra []byte) (*CustodianUpdateRequest, error)
type DataStore ¶
type DataStore interface { UTXOLockReader UTXOLocker GhostLocker NodeReader DomainReader CustodianReader }
type Decoder ¶ added in v0.12.1
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder ¶ added in v0.12.1
func NewMinimumDecoder ¶ added in v0.14.0
func (*Decoder) DecodeSnapshotWithTopo ¶ added in v0.14.0
func (dec *Decoder) DecodeSnapshotWithTopo() (*SnapshotWithTopologicalOrder, error)
func (*Decoder) DecodeTransaction ¶ added in v0.12.1
func (dec *Decoder) DecodeTransaction() (*SignedTransaction, error)
func (*Decoder) ReadAggregatedSignature ¶ added in v0.12.18
func (dec *Decoder) ReadAggregatedSignature() (*AggregatedSignature, error)
func (*Decoder) ReadCosiSignature ¶ added in v0.14.0
func (dec *Decoder) ReadCosiSignature() (*crypto.CosiSignature, error)
func (*Decoder) ReadInteger ¶ added in v0.12.1
func (*Decoder) ReadOutput ¶ added in v0.12.1
func (*Decoder) ReadRoundReferences ¶ added in v0.15.0
func (*Decoder) ReadSignatures ¶ added in v0.12.1
func (*Decoder) ReadUint16 ¶ added in v0.12.1
func (*Decoder) ReadUint32 ¶ added in v0.15.0
func (*Decoder) ReadUint64 ¶ added in v0.12.1
type DepositData ¶
type DepositData struct { Chain crypto.Hash AssetKey string TransactionHash string OutputIndex uint64 Amount Integer }
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 Encoder ¶ added in v0.12.1
type Encoder struct {
// contains filtered or unexported fields
}
func NewEncoder ¶ added in v0.12.1
func NewEncoder() *Encoder
func NewMinimumEncoder ¶ added in v0.14.0
func NewMinimumEncoder() *Encoder
func (*Encoder) EncodeAggregatedSignature ¶ added in v0.12.18
func (enc *Encoder) EncodeAggregatedSignature(js *AggregatedSignature)
func (*Encoder) EncodeCosiSignature ¶ added in v0.14.0
func (enc *Encoder) EncodeCosiSignature(s *crypto.CosiSignature)
func (*Encoder) EncodeInput ¶ added in v0.12.1
func (*Encoder) EncodeOutput ¶ added in v0.12.1
func (*Encoder) EncodeRoundReferences ¶ added in v0.15.0
func (*Encoder) EncodeSignatures ¶ added in v0.12.1
func (*Encoder) EncodeSnapshotPayload ¶ added in v0.14.0
func (*Encoder) EncodeSnapshotWithTopo ¶ added in v0.14.0
func (enc *Encoder) EncodeSnapshotWithTopo(s *SnapshotWithTopologicalOrder) []byte
func (*Encoder) EncodeTransaction ¶ added in v0.12.1
func (enc *Encoder) EncodeTransaction(signed *SignedTransaction) []byte
func (*Encoder) WriteInteger ¶ added in v0.12.1
func (*Encoder) WriteUint16 ¶ added in v0.12.1
func (*Encoder) WriteUint32 ¶ added in v0.15.0
func (*Encoder) WriteUint64 ¶ added in v0.12.1
type GenesisHackInput ¶ added in v0.1.14
type GenesisHackTransaction ¶ added in v0.1.14
type GhostLocker ¶ added in v0.16.0
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) Ration ¶ added in v0.11.0
func (x Integer) Ration(y Integer) (v RationalNumber)
func (*Integer) UnmarshalJSON ¶
func (*Integer) UnmarshalMsgpack ¶
type MintData ¶ added in v0.1.1
func (*MintData) Distribute ¶ added in v0.1.1
func (m *MintData) Distribute(tx crypto.Hash) *MintDistribution
type MintDistribution ¶ added in v0.1.1
func DecompressUnmarshalMintDistribution ¶ added in v0.14.0
func DecompressUnmarshalMintDistribution(b []byte) (*MintDistribution, error)
func UnmarshalMintDistribution ¶ added in v0.14.0
func UnmarshalMintDistribution(b []byte) (*MintDistribution, error)
func (*MintDistribution) CompressMarshal ¶ added in v0.14.0
func (m *MintDistribution) CompressMarshal() []byte
func (*MintDistribution) Marshal ¶ added in v0.14.0
func (m *MintDistribution) Marshal() []byte
type Node ¶
type NodeReader ¶
type RationalNumber ¶ added in v0.11.0
type RationalNumber struct {
// contains filtered or unexported fields
}
var OneRat RationalNumber
func (RationalNumber) Cmp ¶ added in v0.11.0
func (r RationalNumber) Cmp(x RationalNumber) int
func (RationalNumber) Product ¶ added in v0.11.0
func (r RationalNumber) Product(x Integer) (v Integer)
type Round ¶
type Round struct { Hash crypto.Hash NodeId crypto.Hash Number uint64 Timestamp uint64 References *RoundLink }
func DecompressUnmarshalRound ¶ added in v0.14.0
func UnmarshalRound ¶ added in v0.14.0
func (*Round) CompressMarshal ¶ added in v0.14.0
type RoundSpace ¶ added in v0.14.0
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 AggregatedSignature *AggregatedSignature `msgpack:"-"` SignaturesMap []map[uint16]*crypto.Signature `msgpack:"-"` SignaturesSliceV1 [][]*crypto.Signature `msgpack:"-"` }
func (*SignedTransaction) AggregateSign ¶ added in v0.12.18
func (signed *SignedTransaction) AggregateSign(reader UTXOKeysReader, accounts [][]*Address, seed []byte) error
func (*SignedTransaction) AsVersioned ¶ added in v0.14.0
func (tx *SignedTransaction) AsVersioned() *VersionedTransaction
func (*SignedTransaction) SignInput ¶
func (signed *SignedTransaction) SignInput(reader UTXOKeysReader, index int, accounts []*Address) error
func (*SignedTransaction) SignInputV1 ¶ added in v0.12.1
func (signed *SignedTransaction) SignInputV1(reader UTXOKeysReader, index int, accounts []*Address) error
func (*SignedTransaction) SignRawV1 ¶ added in v0.12.3
func (signed *SignedTransaction) SignRawV1(key crypto.Key) 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 SignedTransactionV1 ¶ added in v0.12.0
type SignedTransactionV1 struct { Transaction SignaturesSliceV1 [][]*crypto.Signature `msgpack:"Signatures"` }
type Snapshot ¶
type Snapshot struct { Version uint8 NodeId crypto.Hash TransactionLegacy crypto.Hash `msgpack:"Transaction"` References *RoundLink RoundNumber uint64 Timestamp uint64 Signatures []*crypto.Signature `msgpack:",omitempty"` Signature *crypto.CosiSignature `msgpack:",omitempty"` Hash crypto.Hash `msgpack:"-"` Transactions []crypto.Hash `msgpack:"-"` }
func (*Snapshot) AddSoleTransaction ¶ added in v0.14.0
func (*Snapshot) PayloadHash ¶
func (*Snapshot) SoleTransaction ¶ added in v0.14.0
func (*Snapshot) VersionedMarshal ¶ added in v0.14.0
type SnapshotWithTopologicalOrder ¶
func DecompressUnmarshalVersionedSnapshot ¶ added in v0.14.0
func DecompressUnmarshalVersionedSnapshot(b []byte) (*SnapshotWithTopologicalOrder, error)
func UnmarshalVersionedSnapshot ¶ added in v0.14.0
func UnmarshalVersionedSnapshot(b []byte) (*SnapshotWithTopologicalOrder, error)
func (*SnapshotWithTopologicalOrder) VersionedCompressMarshal ¶ added in v0.14.0
func (s *SnapshotWithTopologicalOrder) VersionedCompressMarshal() []byte
func (*SnapshotWithTopologicalOrder) VersionedMarshal ¶ added in v0.14.0
func (s *SnapshotWithTopologicalOrder) VersionedMarshal() []byte
type SnapshotWork ¶ added in v0.11.7
type Transaction ¶
type Transaction struct { Version uint8 Asset crypto.Hash Inputs []*Input Outputs []*Output References []crypto.Hash `msgpack:"-"` Extra []byte }
func NewTransactionV2 ¶ added in v0.14.0
func NewTransactionV2(asset crypto.Hash) *Transaction
func NewTransactionV3 ¶ added in v0.14.0
func NewTransactionV3(asset crypto.Hash) *Transaction
func NewTransactionV4 ¶ added in v0.15.0
func NewTransactionV4(asset crypto.Hash) *Transaction
func (*Transaction) AddDepositInput ¶
func (tx *Transaction) AddDepositInput(data *DepositData)
func (*Transaction) AddKernelNodeMintInputLegacy ¶ added in v0.16.0
func (tx *Transaction) AddKernelNodeMintInputLegacy(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) AddUniversalMintInput ¶ added in v0.16.0
func (tx *Transaction) AddUniversalMintInput(batch uint64, amount Integer)
func (*Transaction) AsVersioned ¶ added in v0.14.0
func (tx *Transaction) AsVersioned() *VersionedTransaction
func (*Transaction) DepositData ¶ added in v0.12.0
func (tx *Transaction) DepositData() *DepositData
func (*Transaction) ViewGhostKey ¶
func (tx *Transaction) ViewGhostKey(a *crypto.Key) []*Output
type UTXOKeysReader ¶ added in v0.12.18
type UTXOLockReader ¶ added in v0.12.18
type UTXOLockReader interface { ReadUTXOLock(hash crypto.Hash, index int) (*UTXOWithLock, error) CheckDepositInput(deposit *DepositData, tx crypto.Hash) error ReadLastMintDistribution(batch uint64) (*MintDistribution, error) }
type UTXOLocker ¶
type UTXOWithLock ¶
func DecompressUnmarshalUTXO ¶ added in v0.14.0
func DecompressUnmarshalUTXO(b []byte) (*UTXOWithLock, error)
func UnmarshalUTXO ¶ added in v0.14.0
func UnmarshalUTXO(b []byte) (*UTXOWithLock, error)
func (*UTXOWithLock) CompressMarshal ¶ added in v0.14.0
func (out *UTXOWithLock) CompressMarshal() []byte
func (*UTXOWithLock) Marshal ¶ added in v0.14.0
func (out *UTXOWithLock) Marshal() []byte
type VersionedTransaction ¶ added in v0.1.14
type VersionedTransaction struct { SignedTransaction BadGenesis *SignedGenesisHackTransaction `msgpack:"-"` // contains filtered or unexported fields }
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() []*UTXOWithLock
Click to show internal directories.
Click to hide internal directories.