Documentation ¶
Index ¶
- func DistributeInitialSupply(stateStore global.StateStore, originPrivateKey ed25519.PrivateKey, ...) ([]byte, error)
- func DistributeInitialSupplyExt(stateStore global.StateStore, originPrivateKey ed25519.PrivateKey, ...) ([]byte, ledger.TransactionID, error)
- func GetChainAccount(chainID ledger.ChainID, srdr global.IndexedStateReader, desc ...bool) (*ledger.OutputWithChainID, []*ledger.OutputWithID, error)
- func MakeChainSuccessorTransaction(par *MakeChainSuccTransactionParams) ([]byte, uint64, func(i byte) (*ledger.Output, error), error)
- func MakeChainTransferTransaction(par *TransferData, disableEndorsementChecking ...bool) ([]byte, error)
- func MakeDistributionTransaction(stateStore global.StateStore, originPrivateKey ed25519.PrivateKey, ...) ([]byte, error)
- func MakeSequencerTransaction(par MakeSequencerTransactionParams) ([]byte, error)
- func MakeSequencerTransactionWithInputLoader(par MakeSequencerTransactionParams) ([]byte, func(i byte) (*ledger.Output, error), error)
- func MakeSimpleTransferTransaction(par *TransferData, disableEndorsementChecking ...bool) ([]byte, error)
- func MakeSimpleTransferTransactionWithRemainder(par *TransferData, disableEndorsementChecking ...bool) ([]byte, *ledger.OutputWithID, error)
- func MakeTransactionSequence(howLong int, firstUTXO *ledger.OutputWithID, privK ed25519.PrivateKey) ([][]byte, error)
- func MakeTransactionSequences(howLong int, firstUTXO []*ledger.OutputWithID, privK []ed25519.PrivateKey) ([][][]byte, error)deprecated
- func MakeTransferTransaction(par *TransferData, disableEndorsementValidation ...bool) ([]byte, error)
- func MustDistributeInitialSupply(stateStore global.StateStore, originPrivateKey ed25519.PrivateKey, ...) []byte
- func MustDistributeInitialSupplyExt(stateStore global.StateStore, originPrivateKey ed25519.PrivateKey, ...) ([]byte, ledger.TransactionID)
- type MakeChainSuccTransactionParams
- type MakeSequencerTransactionParams
- type TagAlongData
- type TransactionBuilder
- func (txb *TransactionBuilder) ConsumeOutput(out *ledger.Output, oid ledger.OutputID) (byte, error)
- func (txb *TransactionBuilder) ConsumeOutputWithID(o *ledger.OutputWithID) (byte, error)
- func (txb *TransactionBuilder) ConsumeOutputs(outs ...*ledger.OutputWithID) (uint64, ledger.Time, error)
- func (txb *TransactionBuilder) InputCommitment() [32]byte
- func (txb *TransactionBuilder) InsertSimpleChainTransition(inChainData *ledger.OutputDataWithChainID, ts ledger.Time) error
- func (txb *TransactionBuilder) NumInputs() int
- func (txb *TransactionBuilder) NumOutputs() int
- func (txb *TransactionBuilder) ProduceOutput(o *ledger.Output) (byte, error)
- func (txb *TransactionBuilder) ProduceOutputs(outs ...*ledger.Output) (uint64, error)
- func (txb *TransactionBuilder) PushEndorsements(txid ...*ledger.TransactionID)
- func (txb *TransactionBuilder) PutSignatureUnlock(inputIndex byte)
- func (txb *TransactionBuilder) PutStandardInputUnlocks(n int) error
- func (txb *TransactionBuilder) PutUnlockParams(inputIndex, constraintIndex byte, unlockParamData []byte)
- func (txb *TransactionBuilder) PutUnlockReference(inputIndex, constraintIndex, referencedInputIndex byte) error
- func (txb *TransactionBuilder) SignED25519(privKey ed25519.PrivateKey)
- func (txb *TransactionBuilder) String() string
- type TransferData
- func (t *TransferData) MustWithInputs(outs ...*ledger.OutputWithID) *TransferData
- func (t *TransferData) TotalAdjustedAmount() uint64
- func (t *TransferData) UseOutputsAsInputs(outs ...*ledger.OutputWithID) error
- func (t *TransferData) WithAmount(amount uint64, adjustToMinimum ...bool) *TransferData
- func (t *TransferData) WithChainOutput(out *ledger.OutputWithChainID) *TransferData
- func (t *TransferData) WithConstraint(constr ledger.Constraint, idx ...byte) *TransferData
- func (t *TransferData) WithConstraintAtIndex(constr ledger.Constraint) *TransferData
- func (t *TransferData) WithConstraintBinary(constr []byte, idx ...byte) *TransferData
- func (t *TransferData) WithEndorsements(ids ...*ledger.TransactionID) *TransferData
- func (t *TransferData) WithSender() *TransferData
- func (t *TransferData) WithTagAlong(seqID ledger.ChainID, amount uint64) *TransferData
- func (t *TransferData) WithTargetLock(lock ledger.Lock) *TransferData
- func (t *TransferData) WithUnlockData(consumedOutputIndex, constraintIndex byte, data []byte) *TransferData
- type UnlockData
- type UnlockParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DistributeInitialSupply ¶
func DistributeInitialSupply(stateStore global.StateStore, originPrivateKey ed25519.PrivateKey, genesisDistribution []ledger.LockBalance) ([]byte, error)
DistributeInitialSupply updates genesis state and branch records according to initial supply distribution parameters by adding initial distribution transaction. Distribution transaction is a branch transaction in the slot next after the genesis. Distribution parameter is added to the transaction store
func DistributeInitialSupplyExt ¶
func DistributeInitialSupplyExt(stateStore global.StateStore, originPrivateKey ed25519.PrivateKey, genesisDistribution []ledger.LockBalance) ([]byte, ledger.TransactionID, error)
func GetChainAccount ¶
func GetChainAccount(chainID ledger.ChainID, srdr global.IndexedStateReader, desc ...bool) (*ledger.OutputWithChainID, []*ledger.OutputWithID, error)
func MakeChainSuccessorTransaction ¶
func MakeChainSuccessorTransaction(par *MakeChainSuccTransactionParams) ([]byte, uint64, func(i byte) (*ledger.Output, error), error)
MakeChainSuccessorTransaction creates a transaction to continue a non-sequencer chain with inflation. Optionally withdraws some amount to the target lock, which can be used as a tag-along output Returns transaction adn inflation amount
func MakeChainTransferTransaction ¶
func MakeChainTransferTransaction(par *TransferData, disableEndorsementChecking ...bool) ([]byte, error)
func MakeDistributionTransaction ¶
func MakeDistributionTransaction(stateStore global.StateStore, originPrivateKey ed25519.PrivateKey, genesisDistribution []ledger.LockBalance) ([]byte, error)
MakeDistributionTransaction creates initial distribution transaction according to distribution list. It is a branch transaction. Remainder goes to the genesis chain
func MakeSequencerTransaction ¶
func MakeSequencerTransaction(par MakeSequencerTransactionParams) ([]byte, error)
func MakeSimpleTransferTransaction ¶
func MakeSimpleTransferTransaction(par *TransferData, disableEndorsementChecking ...bool) ([]byte, error)
func MakeSimpleTransferTransactionWithRemainder ¶
func MakeSimpleTransferTransactionWithRemainder(par *TransferData, disableEndorsementChecking ...bool) ([]byte, *ledger.OutputWithID, error)
func MakeTransactionSequence ¶
func MakeTransactionSequence(howLong int, firstUTXO *ledger.OutputWithID, privK ed25519.PrivateKey) ([][]byte, error)
MakeTransactionSequence make sequence of transactions, which moves all tokens from firstUTXO to the same adddress again and again. Timestamps are auto automatically adjusted according to tx pace TODO: move to testing tools
func MakeTransactionSequences
deprecated
func MakeTransactionSequences(howLong int, firstUTXO []*ledger.OutputWithID, privK []ed25519.PrivateKey) ([][][]byte, error)
Deprecated: will be moved to testing tools
func MakeTransferTransaction ¶
func MakeTransferTransaction(par *TransferData, disableEndorsementValidation ...bool) ([]byte, error)
MakeTransferTransaction makes transaction disableEndorsementChecking is an option to disable endorsement timestamp checking, i.e. it can produce tx with invalid endorsements. Used only for testing
func MustDistributeInitialSupply ¶
func MustDistributeInitialSupply(stateStore global.StateStore, originPrivateKey ed25519.PrivateKey, genesisDistribution []ledger.LockBalance) []byte
MustDistributeInitialSupply makes distribution transaction and commits it into the multi-ledger state with branch record
func MustDistributeInitialSupplyExt ¶
func MustDistributeInitialSupplyExt(stateStore global.StateStore, originPrivateKey ed25519.PrivateKey, genesisDistribution []ledger.LockBalance) ([]byte, ledger.TransactionID)
MustDistributeInitialSupplyExt makes distribution transaction and commits it into the multi-ledger state with branch record
Types ¶
type MakeChainSuccTransactionParams ¶
type MakeChainSuccTransactionParams struct { // predecessor ChainInput *ledger.OutputWithChainID // timestamp of the target transaction Timestamp ledger.Time // some amount sent to the target lock. It can be a tag-along output. Remainder goes to the chain WithdrawTarget ledger.Lock WithdrawAmount uint64 // chain controller PrivateKey ed25519.PrivateKey // enforce transaction is profitable EnforceProfitability bool // return input loader function ReturnInputLoader bool }
MakeChainSuccTransactionParams contains parameters for building a chain transaction
type MakeSequencerTransactionParams ¶
type MakeSequencerTransactionParams struct { // sequencer name. By convention, can be <sequencer name>.<proposer name> SeqName string // predecessor ChainInput *ledger.OutputWithChainID // StemInput *ledger.OutputWithID // it is branch tx if != nil // timestamp of the transaction Timestamp ledger.Time // minimum fee MinimumFee uint64 // additional inputs to consume. Must be unlockable by chain // can contain sender commands to the sequencer AdditionalInputs []*ledger.OutputWithID // additional outputs to produce AdditionalOutputs []*ledger.Output // Endorsements Endorsements []*ledger.TransactionID // chain controller PrivateKey ed25519.PrivateKey // PutInflation if true, calculates maximum inflation possible // if false, does not add inflation constraint at all PutInflation bool ReturnInputLoader bool }
MakeSequencerTransactionParams contains parameters for the sequencer transaction builder
type TagAlongData ¶
type TransactionBuilder ¶
type TransactionBuilder struct { ConsumedOutputs []*ledger.Output TransactionData *transactionData }
func NewTransactionBuilder ¶
func NewTransactionBuilder() *TransactionBuilder
func (*TransactionBuilder) ConsumeOutput ¶
func (*TransactionBuilder) ConsumeOutputWithID ¶
func (txb *TransactionBuilder) ConsumeOutputWithID(o *ledger.OutputWithID) (byte, error)
func (*TransactionBuilder) ConsumeOutputs ¶
func (txb *TransactionBuilder) ConsumeOutputs(outs ...*ledger.OutputWithID) (uint64, ledger.Time, error)
ConsumeOutputs returns total sum and maximal timestamp
func (*TransactionBuilder) InputCommitment ¶
func (txb *TransactionBuilder) InputCommitment() [32]byte
func (*TransactionBuilder) InsertSimpleChainTransition ¶
func (txb *TransactionBuilder) InsertSimpleChainTransition(inChainData *ledger.OutputDataWithChainID, ts ledger.Time) error
InsertSimpleChainTransition inserts a simple chain transition (surprise, surprise). Takes output with chain constraint from parameters, Produces identical output, only modifies timestamp. Unlocks chain-input lock with signature reference
func (*TransactionBuilder) NumInputs ¶
func (txb *TransactionBuilder) NumInputs() int
func (*TransactionBuilder) NumOutputs ¶
func (txb *TransactionBuilder) NumOutputs() int
func (*TransactionBuilder) ProduceOutput ¶
func (txb *TransactionBuilder) ProduceOutput(o *ledger.Output) (byte, error)
func (*TransactionBuilder) ProduceOutputs ¶
func (txb *TransactionBuilder) ProduceOutputs(outs ...*ledger.Output) (uint64, error)
func (*TransactionBuilder) PushEndorsements ¶
func (txb *TransactionBuilder) PushEndorsements(txid ...*ledger.TransactionID)
func (*TransactionBuilder) PutSignatureUnlock ¶
func (txb *TransactionBuilder) PutSignatureUnlock(inputIndex byte)
PutSignatureUnlock marker 0xff references signature of the transaction. It can be distinguished from any reference because it cannot be strictly less than any other reference
func (*TransactionBuilder) PutStandardInputUnlocks ¶
func (txb *TransactionBuilder) PutStandardInputUnlocks(n int) error
func (*TransactionBuilder) PutUnlockParams ¶
func (txb *TransactionBuilder) PutUnlockParams(inputIndex, constraintIndex byte, unlockParamData []byte)
func (*TransactionBuilder) PutUnlockReference ¶
func (txb *TransactionBuilder) PutUnlockReference(inputIndex, constraintIndex, referencedInputIndex byte) error
PutUnlockReference references some preceding output
func (*TransactionBuilder) SignED25519 ¶
func (txb *TransactionBuilder) SignED25519(privKey ed25519.PrivateKey)
func (*TransactionBuilder) String ¶
func (txb *TransactionBuilder) String() string
type TransferData ¶
type TransferData struct { SenderPrivateKey ed25519.PrivateKey SenderPublicKey ed25519.PublicKey SourceAccount ledger.Accountable Inputs []*ledger.OutputWithID ChainOutput *ledger.OutputWithChainID Timestamp ledger.Time // takes ledger.TimeFromClockTime(time.Now()) if ledger.NilLedgerTime Lock ledger.Lock Amount uint64 AdjustToMinimum bool AddSender bool AddConstraints [][]byte MarkAsSequencerTx bool UnlockData []*UnlockData Endorsements []*ledger.TransactionID TagAlong *TagAlongData }
func NewTransferData ¶
func NewTransferData(senderKey ed25519.PrivateKey, sourceAccount ledger.Accountable, ts ledger.Time) *TransferData
func (*TransferData) MustWithInputs ¶
func (t *TransferData) MustWithInputs(outs ...*ledger.OutputWithID) *TransferData
func (*TransferData) TotalAdjustedAmount ¶
func (t *TransferData) TotalAdjustedAmount() uint64
TotalAdjustedAmount adjust amount to minimum storage deposit requirements
func (*TransferData) UseOutputsAsInputs ¶
func (t *TransferData) UseOutputsAsInputs(outs ...*ledger.OutputWithID) error
func (*TransferData) WithAmount ¶
func (t *TransferData) WithAmount(amount uint64, adjustToMinimum ...bool) *TransferData
func (*TransferData) WithChainOutput ¶
func (t *TransferData) WithChainOutput(out *ledger.OutputWithChainID) *TransferData
func (*TransferData) WithConstraint ¶
func (t *TransferData) WithConstraint(constr ledger.Constraint, idx ...byte) *TransferData
func (*TransferData) WithConstraintAtIndex ¶
func (t *TransferData) WithConstraintAtIndex(constr ledger.Constraint) *TransferData
func (*TransferData) WithConstraintBinary ¶
func (t *TransferData) WithConstraintBinary(constr []byte, idx ...byte) *TransferData
func (*TransferData) WithEndorsements ¶
func (t *TransferData) WithEndorsements(ids ...*ledger.TransactionID) *TransferData
func (*TransferData) WithSender ¶
func (t *TransferData) WithSender() *TransferData
func (*TransferData) WithTagAlong ¶
func (t *TransferData) WithTagAlong(seqID ledger.ChainID, amount uint64) *TransferData
func (*TransferData) WithTargetLock ¶
func (t *TransferData) WithTargetLock(lock ledger.Lock) *TransferData
func (*TransferData) WithUnlockData ¶
func (t *TransferData) WithUnlockData(consumedOutputIndex, constraintIndex byte, data []byte) *TransferData
type UnlockData ¶
type UnlockParams ¶
type UnlockParams struct {
// contains filtered or unexported fields
}
func NewUnlockBlock ¶
func NewUnlockBlock() *UnlockParams
func (*UnlockParams) Bytes ¶
func (u *UnlockParams) Bytes() []byte