transactions

package
v0.0.0-...-425d0f2 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 14 Imported by: 35

Documentation

Index

Constants

View Source
const (
	//FeePurityUnit = 232                          // =Handling charge content unit: 0.00000001 baht = 1 yuan
	//MaxFeePurity  = uint64(18446744073709550000) // =The maximum value of Uint64 is about 1844HAC
	FeePurityUnit = 240                 // =Handling charge content unit: 0.00000001 baht = 1 zhu
	MaxFeePurity  = uint32(42_94967295) // =The maximum value of Uint64 is about 42HAC
)

Variables

This section is empty.

Functions

func CalculateFeePurity

func CalculateFeePurity(trsFee *fields.Amount, txsize uint32) uint32

How many tokens does the handling charge contain per 32 bytes more handling fees can be avoided, but the handling fee field takes up more space, resulting in transactions with the same structure (for example, the transaction of creating diamonds) the handling fee is higher, but it ranks behind

func CheckoutAction_4_DiamondCreateFromTx

func CheckoutAction_4_DiamondCreateFromTx(tx interfaces.Transaction) *actions.Action_4_DiamondCreate

Take out the action created by the diamond

func CreateOneActionOfHACDEngraved

func CreateOneActionOfHACDEngraved(diamonds *fields.DiamondListMaxLen200, content string, insfee *fields.Amount) (*actions.Action_32_DiamondsEngraved, error)

func NewTransactionByType

func NewTransactionByType(ty uint8) (interfaces.Transaction, error)

func ParseTransaction

func ParseTransaction(buf []byte, seek uint32) (interfaces.Transaction, uint32, error)

Types

type Transaction_0_Coinbase

type Transaction_0_Coinbase struct {
	// type
	Address fields.Address
	Reward  fields.Amount
	Message fields.TrimString16
	// Version number
	ExtendDataVersion fields.VarUint1 // Equal to 0 before 220000 height

	// When extenddataversion > = 1, it has the following fields:
	MinerNonce   fields.Bytes32
	WitnessCount fields.VarUint1 // Number of voting witnesses
	WitnessSigs  []uint8         // Witness specified hash mantissa
	Witnesses    []fields.Sign   // Signature of prev block hash, voting fork

	// cache data
	TotalFeeUserPayed     fields.Amount // Total transaction fee of the block
	TotalFeeMinerReceived fields.Amount // Total transaction fee of the block
}

func NewTransaction_0_CoinbaseV0

func NewTransaction_0_CoinbaseV0() *Transaction_0_Coinbase

func NewTransaction_0_CoinbaseV1

func NewTransaction_0_CoinbaseV1() *Transaction_0_Coinbase

func (*Transaction_0_Coinbase) CleanSigns

func (trs *Transaction_0_Coinbase) CleanSigns()

Clear all signatures

func (*Transaction_0_Coinbase) ClearHash

func (trs *Transaction_0_Coinbase) ClearHash()

func (*Transaction_0_Coinbase) Clone

func (*Transaction_0_Coinbase) Copy

func (*Transaction_0_Coinbase) CopyForMining

func (trs *Transaction_0_Coinbase) CopyForMining() *Transaction_0_Coinbase

func (*Transaction_0_Coinbase) Describe

func (trs *Transaction_0_Coinbase) Describe(isUnitMei, isForMining bool) map[string]interface{}

func (*Transaction_0_Coinbase) FeePurity

func (trs *Transaction_0_Coinbase) FeePurity() uint32

func (*Transaction_0_Coinbase) FillNeedSigns

func (trs *Transaction_0_Coinbase) FillNeedSigns(map[string][]byte, []fields.Address) error

Fill in signature

func (*Transaction_0_Coinbase) FillTargetSign

func (trs *Transaction_0_Coinbase) FillTargetSign(*account.Account) error

Fill in all required signatures

func (*Transaction_0_Coinbase) GetActionList

func (trs *Transaction_0_Coinbase) GetActionList() []interfaces.Action

func (*Transaction_0_Coinbase) GetActions

func (trs *Transaction_0_Coinbase) GetActions() []interfacev2.Action

func (*Transaction_0_Coinbase) GetAddress

func (trs *Transaction_0_Coinbase) GetAddress() fields.Address

query

func (*Transaction_0_Coinbase) GetFee

func (trs *Transaction_0_Coinbase) GetFee() *fields.Amount

func (*Transaction_0_Coinbase) GetFeeOfMinerRealReceived

func (trs *Transaction_0_Coinbase) GetFeeOfMinerRealReceived() *fields.Amount

func (*Transaction_0_Coinbase) GetMessage

func (trs *Transaction_0_Coinbase) GetMessage() fields.TrimString16

func (*Transaction_0_Coinbase) GetReward

func (trs *Transaction_0_Coinbase) GetReward() *fields.Amount

func (*Transaction_0_Coinbase) GetSigns

func (trs *Transaction_0_Coinbase) GetSigns() []fields.Sign

Return all signatures

func (*Transaction_0_Coinbase) GetTimestamp

func (trs *Transaction_0_Coinbase) GetTimestamp() uint64

func (*Transaction_0_Coinbase) Hash

func (trs *Transaction_0_Coinbase) Hash() fields.Hash

func (*Transaction_0_Coinbase) HashWithFee

func (trs *Transaction_0_Coinbase) HashWithFee() fields.Hash

Transaction unique hash value

func (*Transaction_0_Coinbase) Parse

func (trs *Transaction_0_Coinbase) Parse(buf []byte, seek uint32) (uint32, error)

func (*Transaction_0_Coinbase) ParseHead

func (trs *Transaction_0_Coinbase) ParseHead(buf []byte, seek uint32) (uint32, error)

func (*Transaction_0_Coinbase) RecoverChainState

func (trs *Transaction_0_Coinbase) RecoverChainState(state interfacev2.ChainStateOperation) error

func (*Transaction_0_Coinbase) RequestAddressBalance

func (trs *Transaction_0_Coinbase) RequestAddressBalance() ([][]byte, []big.Int, error)

Balance check required

func (*Transaction_0_Coinbase) RequestSignAddresses

func (trs *Transaction_0_Coinbase) RequestSignAddresses([]fields.Address, bool) ([]fields.Address, error)

Get the address to be signed from actions

func (*Transaction_0_Coinbase) Serialize

func (trs *Transaction_0_Coinbase) Serialize() ([]byte, error)

func (*Transaction_0_Coinbase) SetAddress

func (trs *Transaction_0_Coinbase) SetAddress(addr fields.Address)

func (*Transaction_0_Coinbase) SetFee

func (trs *Transaction_0_Coinbase) SetFee(fee *fields.Amount)

func (*Transaction_0_Coinbase) SetMessage

func (trs *Transaction_0_Coinbase) SetMessage(msg fields.TrimString16)

func (*Transaction_0_Coinbase) SetSigns

func (trs *Transaction_0_Coinbase) SetSigns([]fields.Sign)

Set signature

func (*Transaction_0_Coinbase) Size

func (trs *Transaction_0_Coinbase) Size() uint32

func (*Transaction_0_Coinbase) Type

func (trs *Transaction_0_Coinbase) Type() uint8

func (*Transaction_0_Coinbase) VerifyAllNeedSigns

func (trs *Transaction_0_Coinbase) VerifyAllNeedSigns() (bool, error)

Verify required signatures

func (*Transaction_0_Coinbase) VerifyTargetSigns

func (trs *Transaction_0_Coinbase) VerifyTargetSigns([]fields.Address) (bool, error)

func (*Transaction_0_Coinbase) WriteInChainState

func (trs *Transaction_0_Coinbase) WriteInChainState(state interfaces.ChainStateOperation) error

func (*Transaction_0_Coinbase) WriteinChainState

func (trs *Transaction_0_Coinbase) WriteinChainState(state interfacev2.ChainStateOperation) error

修改 / 恢复 状态数据库

type Transaction_1_DO_NOT_USE_WITH_BUG

type Transaction_1_DO_NOT_USE_WITH_BUG struct {
	Timestamp fields.BlockTxTimestamp
	Address   fields.Address
	Fee       fields.Amount

	ActionCount fields.VarUint2
	Actions     []interfaces.Action

	SignCount fields.VarUint2
	Signs     []fields.Sign

	MultisignCount fields.VarUint2
	Multisigns     []fields.Multisign
	// contains filtered or unexported fields
}

func NewEmptyTransaction_1_Simple

func NewEmptyTransaction_1_Simple(master fields.Address) (*Transaction_1_DO_NOT_USE_WITH_BUG, error)

func (*Transaction_1_DO_NOT_USE_WITH_BUG) AppendAction

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) AppendAction(action interfacev2.Action) error

func (*Transaction_1_DO_NOT_USE_WITH_BUG) CleanSigns

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) CleanSigns()

Clear all signatures

func (*Transaction_1_DO_NOT_USE_WITH_BUG) ClearHash

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) ClearHash()

func (*Transaction_1_DO_NOT_USE_WITH_BUG) Clone

func (*Transaction_1_DO_NOT_USE_WITH_BUG) Copy

func (*Transaction_1_DO_NOT_USE_WITH_BUG) FeePurity

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) FeePurity() uint32

Service charge content: how many tokens per byte

func (*Transaction_1_DO_NOT_USE_WITH_BUG) FillNeedSigns

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) FillNeedSigns(addrPrivates map[string][]byte, reqs []fields.Address) error

Fill in signature

func (*Transaction_1_DO_NOT_USE_WITH_BUG) FillTargetSign

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) FillTargetSign(signacc *account.Account) error

Fill in all required signatures

func (*Transaction_1_DO_NOT_USE_WITH_BUG) GetActionList

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) GetActionList() []interfaces.Action

func (*Transaction_1_DO_NOT_USE_WITH_BUG) GetActions

func (*Transaction_1_DO_NOT_USE_WITH_BUG) GetAddress

query

func (*Transaction_1_DO_NOT_USE_WITH_BUG) GetFee

func (*Transaction_1_DO_NOT_USE_WITH_BUG) GetFeeOfMinerRealReceived

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) GetFeeOfMinerRealReceived() *fields.Amount

func (*Transaction_1_DO_NOT_USE_WITH_BUG) GetMessage

func (*Transaction_1_DO_NOT_USE_WITH_BUG) GetSigns

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) GetSigns() []fields.Sign

Return all signatures

func (*Transaction_1_DO_NOT_USE_WITH_BUG) GetTimestamp

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) GetTimestamp() uint64

func (*Transaction_1_DO_NOT_USE_WITH_BUG) Hash

func (*Transaction_1_DO_NOT_USE_WITH_BUG) HashFresh

func (*Transaction_1_DO_NOT_USE_WITH_BUG) HashWithFee

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) HashWithFee() fields.Hash

Transaction unique hash value

func (*Transaction_1_DO_NOT_USE_WITH_BUG) HashWithFeeFresh

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) HashWithFeeFresh() fields.Hash

func (*Transaction_1_DO_NOT_USE_WITH_BUG) Parse

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) Parse(buf []byte, seek uint32) (uint32, error)

func (*Transaction_1_DO_NOT_USE_WITH_BUG) RecoverChainState

func (*Transaction_1_DO_NOT_USE_WITH_BUG) RequestAddressBalance

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) RequestAddressBalance() ([][]byte, []big.Int, error)

Balance check required

func (*Transaction_1_DO_NOT_USE_WITH_BUG) RequestSignAddresses

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) RequestSignAddresses(appends []fields.Address, dropfeeaddr bool) ([]fields.Address, error)

Get the address to be signed from actions

func (*Transaction_1_DO_NOT_USE_WITH_BUG) Serialize

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) Serialize() ([]byte, error)

func (*Transaction_1_DO_NOT_USE_WITH_BUG) SerializeNoSign

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) SerializeNoSign() ([]byte, error)

func (*Transaction_1_DO_NOT_USE_WITH_BUG) SerializeNoSignEx

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) SerializeNoSignEx(nofee bool) ([]byte, error)

func (*Transaction_1_DO_NOT_USE_WITH_BUG) SetAddress

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) SetAddress(addr fields.Address)

func (*Transaction_1_DO_NOT_USE_WITH_BUG) SetFee

func (*Transaction_1_DO_NOT_USE_WITH_BUG) SetMessage

func (*Transaction_1_DO_NOT_USE_WITH_BUG) SetSigns

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) SetSigns(allsigns []fields.Sign)

Set signature

func (*Transaction_1_DO_NOT_USE_WITH_BUG) Size

func (*Transaction_1_DO_NOT_USE_WITH_BUG) Type

func (*Transaction_1_DO_NOT_USE_WITH_BUG) VerifyAllNeedSigns

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) VerifyAllNeedSigns() (bool, error)

Verify required signatures

func (*Transaction_1_DO_NOT_USE_WITH_BUG) VerifyTargetSigns

func (trs *Transaction_1_DO_NOT_USE_WITH_BUG) VerifyTargetSigns(reqaddrs []fields.Address) (bool, error)

func (*Transaction_1_DO_NOT_USE_WITH_BUG) WriteInChainState

修改 / 恢复 状态数据库

func (*Transaction_1_DO_NOT_USE_WITH_BUG) WriteinChainState

修改 / 恢复 状态数据库

type Transaction_2_Simple

type Transaction_2_Simple struct {
	Timestamp   fields.BlockTxTimestamp
	MainAddress fields.Address
	Fee         fields.Amount

	ActionCount fields.VarUint2
	Actions     []interfaces.Action

	SignCount fields.VarUint2
	Signs     []fields.Sign

	MultisignCount fields.VarUint2
	Multisigns     []fields.Multisign
	// contains filtered or unexported fields
}

func CreateOneTxOfBTCTransfer

func CreateOneTxOfBTCTransfer(payacc *account.Account, toaddr fields.Address, amount uint64,
	feeacc *account.Account, fee *fields.Amount, timestamp int64) (*Transaction_2_Simple, error)

Create a BTC transfer transaction

func CreateOneTxOfHACDEngraved

func CreateOneTxOfHACDEngraved(mainacc *account.Account, hacdlistsplitcomma string, content string, insfee *fields.Amount, fee *fields.Amount, timestamp int64) (*Transaction_2_Simple, error)

Create a hacd in transaction

func CreateOneTxOfHACDEngravedRecovery

func CreateOneTxOfHACDEngravedRecovery(mainacc *account.Account, hacdlistsplitcomma string, insfee *fields.Amount, fee *fields.Amount, timestamp int64) (*Transaction_2_Simple, error)

Create a hacd in transaction

func CreateOneTxOfOutfeeQuantityHACDTransfer

func CreateOneTxOfOutfeeQuantityHACDTransfer(payacc *account.Account, toaddr fields.Address, hacdlistsplitcomma string,
	feeacc *account.Account, fee *fields.Amount, timestamp int64) (*Transaction_2_Simple, error)

Create a hacd transfer transaction

func CreateOneTxOfSimpleTransfer

func CreateOneTxOfSimpleTransfer(payacc *account.Account, toaddr fields.Address,
	amount *fields.Amount, fee *fields.Amount, timestamp int64) *Transaction_2_Simple

Create a general transfer transaction

func NewEmptyTransaction_2_Simple

func NewEmptyTransaction_2_Simple(master fields.Address) (*Transaction_2_Simple, error)

func (*Transaction_2_Simple) AddAction

func (trs *Transaction_2_Simple) AddAction(action interfaces.Action) error

func (*Transaction_2_Simple) AppendAction

func (trs *Transaction_2_Simple) AppendAction(action interfacev2.Action) error

func (*Transaction_2_Simple) CleanSigns

func (trs *Transaction_2_Simple) CleanSigns()

Clear clear all signatures

func (*Transaction_2_Simple) ClearHash

func (trs *Transaction_2_Simple) ClearHash()

func (*Transaction_2_Simple) Clone

func (*Transaction_2_Simple) Copy

func (*Transaction_2_Simple) FeePurity

func (trs *Transaction_2_Simple) FeePurity() uint32

Service charge content: how many tokens per byte

func (*Transaction_2_Simple) FillNeedSigns

func (trs *Transaction_2_Simple) FillNeedSigns(addrPrivateKeys map[string][]byte, appendReqs []fields.Address) error

Fill in all required signatures

func (*Transaction_2_Simple) FillTargetSign

func (trs *Transaction_2_Simple) FillTargetSign(signacc *account.Account) error

Populate a single required signature

func (*Transaction_2_Simple) GetActionList

func (trs *Transaction_2_Simple) GetActionList() []interfaces.Action

func (*Transaction_2_Simple) GetActions

func (trs *Transaction_2_Simple) GetActions() []interfacev2.Action

func (*Transaction_2_Simple) GetAddress

func (trs *Transaction_2_Simple) GetAddress() fields.Address

query

func (*Transaction_2_Simple) GetFee

func (trs *Transaction_2_Simple) GetFee() *fields.Amount

func (*Transaction_2_Simple) GetFeeOfMinerRealReceived

func (trs *Transaction_2_Simple) GetFeeOfMinerRealReceived() *fields.Amount

func (*Transaction_2_Simple) GetMessage

func (trs *Transaction_2_Simple) GetMessage() fields.TrimString16

func (*Transaction_2_Simple) GetSigns

func (trs *Transaction_2_Simple) GetSigns() []fields.Sign

Return all signatures

func (*Transaction_2_Simple) GetTimestamp

func (trs *Transaction_2_Simple) GetTimestamp() uint64

func (*Transaction_2_Simple) Hash

func (trs *Transaction_2_Simple) Hash() fields.Hash

func (*Transaction_2_Simple) HashFresh

func (trs *Transaction_2_Simple) HashFresh() fields.Hash

func (*Transaction_2_Simple) HashWithFee

func (trs *Transaction_2_Simple) HashWithFee() fields.Hash

Transaction unique hash value

func (*Transaction_2_Simple) HashWithFeeFresh

func (trs *Transaction_2_Simple) HashWithFeeFresh() fields.Hash

func (*Transaction_2_Simple) Parse

func (trs *Transaction_2_Simple) Parse(buf []byte, seek uint32) (uint32, error)

func (*Transaction_2_Simple) RecoverChainState

func (trs *Transaction_2_Simple) RecoverChainState(state interfacev2.ChainStateOperation) error

func (*Transaction_2_Simple) RequestAddressBalance

func (trs *Transaction_2_Simple) RequestAddressBalance() ([][]byte, []big.Int, error)

Balance check required

func (*Transaction_2_Simple) RequestSignAddresses

func (trs *Transaction_2_Simple) RequestSignAddresses(reqs []fields.Address, dropfeeaddr bool) ([]fields.Address, error)

Get the address to be signed from actions

func (*Transaction_2_Simple) Serialize

func (trs *Transaction_2_Simple) Serialize() ([]byte, error)

func (*Transaction_2_Simple) SerializeNoSign

func (trs *Transaction_2_Simple) SerializeNoSign() ([]byte, error)

func (*Transaction_2_Simple) SerializeNoSignEx

func (trs *Transaction_2_Simple) SerializeNoSignEx(hasfee bool) ([]byte, error)

Serialize all other data without signature content

func (*Transaction_2_Simple) SetAddress

func (trs *Transaction_2_Simple) SetAddress(addr fields.Address)

func (*Transaction_2_Simple) SetFee

func (trs *Transaction_2_Simple) SetFee(fee *fields.Amount)

func (*Transaction_2_Simple) SetMessage

func (trs *Transaction_2_Simple) SetMessage(fields.TrimString16)

func (*Transaction_2_Simple) SetSigns

func (trs *Transaction_2_Simple) SetSigns(allsigns []fields.Sign)

Set signature data

func (*Transaction_2_Simple) Size

func (trs *Transaction_2_Simple) Size() uint32

func (*Transaction_2_Simple) Type

func (trs *Transaction_2_Simple) Type() uint8

func (*Transaction_2_Simple) VerifyAllNeedSigns

func (trs *Transaction_2_Simple) VerifyAllNeedSigns() (bool, error)

Verify required signatures Reqs additional to be verified

func (*Transaction_2_Simple) VerifyTargetSigns

func (trs *Transaction_2_Simple) VerifyTargetSigns(reqaddrs []fields.Address) (bool, error)

Verify one of the signatures individually

func (*Transaction_2_Simple) WriteInChainState

func (trs *Transaction_2_Simple) WriteInChainState(state interfaces.ChainStateOperation) error

修改 / 恢复 状态数据库

func (*Transaction_2_Simple) WriteinChainState

func (trs *Transaction_2_Simple) WriteinChainState(state interfacev2.ChainStateOperation) error

修改 / 恢复 状态数据库

Jump to

Keyboard shortcuts

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