Documentation ¶
Index ¶
- func AppendBlocks(chain *protocol.Chain, num uint64) error
- func CreateCoinbaseTx(controlProgram []byte, height, txsFee uint64) (*types.Tx, error)
- func CreateSpendInput(tx *types.Tx, outputIndex uint64) (*types.SpendInput, error)
- func CreateTxFromTx(baseTx *types.Tx, outputIndex uint64, outputAmount uint64, ctrlProgram []byte) (*types.Tx, error)
- func MockBlock() *bc.Block
- func MockChain(testDB dbm.DB) (*protocol.Chain, *database.Store, *protocol.TxPool, error)
- func MockSign(tpl *txbuilder.Template, hsm *pseudohsm.HSM, password string) (bool, error)
- func MockTx(utxo *account.UTXO, testAccount *account.Account) (*txbuilder.Template, *types.TxData, error)
- func MockUTXO(controlProg *account.CtrlProgram) *account.UTXO
- func NewBlock(chain *protocol.Chain, txs []*types.Tx, controlProgram []byte) (*types.Block, error)
- func ReplaceCoinbase(block *types.Block, coinbaseTx *types.Tx) (err error)
- func SignInstructionFor(input *types.SpendInput, db dbm.DB, signer *signers.Signer) (*txbuilder.SigningInstruction, error)
- func Solve(seed *bc.Hash, block *types.Block)
- func SolveAndUpdate(chain *protocol.Chain, block *types.Block) error
- type TxGenerator
- func (g *TxGenerator) AddIssuanceInput(assetAlias string, amount uint64) error
- func (g *TxGenerator) AddRetirement(assetAlias string, amount uint64) error
- func (g *TxGenerator) AddSpendInput(accountAlias, assetAlias string, amount uint64) error
- func (g *TxGenerator) AddTxInput(txInput *types.TxInput, signInstruction *txbuilder.SigningInstruction) error
- func (g *TxGenerator) AddTxInputFromUtxo(utxo *account.UTXO, accountAlias string) error
- func (g *TxGenerator) AddTxOutput(accountAlias, assetAlias string, amount uint64) error
- func (g *TxGenerator) Reset()
- func (g *TxGenerator) Sign(passwords []string) (*types.Tx, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendBlocks ¶ added in v0.4.6
AppendBlocks append empty blocks to chain, mainly used to mature the coinbase tx
func CreateCoinbaseTx ¶ added in v0.4.6
CreateCoinbaseTx create coinbase tx at block height
func CreateSpendInput ¶ added in v0.4.6
CreateSpendInput create SpendInput which spent the output from tx
func CreateTxFromTx ¶ added in v0.4.6
func CreateTxFromTx(baseTx *types.Tx, outputIndex uint64, outputAmount uint64, ctrlProgram []byte) (*types.Tx, error)
CreateTxFromTx create a tx spent the output in outputIndex at baseTx
func MockTx ¶
func MockTx(utxo *account.UTXO, testAccount *account.Account) (*txbuilder.Template, *types.TxData, error)
MockTx mock a tx
func ReplaceCoinbase ¶ added in v0.4.6
ReplaceCoinbase replace the coinbase tx of block with coinbaseTx
func SignInstructionFor ¶ added in v0.4.6
func SignInstructionFor(input *types.SpendInput, db dbm.DB, signer *signers.Signer) (*txbuilder.SigningInstruction, error)
SignInstructionFor read CtrlProgram from db, construct SignInstruction for SpendInput
Types ¶
type TxGenerator ¶ added in v0.4.6
type TxGenerator struct { Builder *txbuilder.TemplateBuilder AccountManager *account.Manager Assets *asset.Registry Hsm *pseudohsm.HSM }
TxGenerator used to generate new tx
func NewTxGenerator ¶ added in v0.4.6
func NewTxGenerator(accountManager *account.Manager, assets *asset.Registry, hsm *pseudohsm.HSM) *TxGenerator
NewTxGenerator create a TxGenerator
func (*TxGenerator) AddIssuanceInput ¶ added in v0.4.6
func (g *TxGenerator) AddIssuanceInput(assetAlias string, amount uint64) error
AddIssuanceInput add a issue input
func (*TxGenerator) AddRetirement ¶ added in v0.4.6
func (g *TxGenerator) AddRetirement(assetAlias string, amount uint64) error
AddRetirement add a retirement output
func (*TxGenerator) AddSpendInput ¶ added in v0.4.6
func (g *TxGenerator) AddSpendInput(accountAlias, assetAlias string, amount uint64) error
AddSpendInput add a spend input
func (*TxGenerator) AddTxInput ¶ added in v0.4.6
func (g *TxGenerator) AddTxInput(txInput *types.TxInput, signInstruction *txbuilder.SigningInstruction) error
AddTxInput add a tx input and signing instruction
func (*TxGenerator) AddTxInputFromUtxo ¶ added in v0.4.6
func (g *TxGenerator) AddTxInputFromUtxo(utxo *account.UTXO, accountAlias string) error
AddTxInputFromUtxo add a tx input which spent the utxo
func (*TxGenerator) AddTxOutput ¶ added in v0.4.6
func (g *TxGenerator) AddTxOutput(accountAlias, assetAlias string, amount uint64) error
AddTxOutput add a tx output
func (*TxGenerator) Reset ¶ added in v0.4.6
func (g *TxGenerator) Reset()
Reset reset transaction builder, used to create a new tx