Documentation ¶
Index ¶
- Constants
- func IsValidAttributeType(usage TransactionAttributeUsage) bool
- func ParseMultisigTransactionCode(code []byte) []common.Uint160
- type BalanceTxInput
- type ILedgerStore
- type Payload
- type Transaction
- func NewBookKeeperTransaction(pubKey *crypto.PubKey, isAdd bool, cert []byte, issuer *crypto.PubKey) (*Transaction, error)
- func NewDataFileTransaction(path string, fileName string, note string, issuer *crypto.PubKey) (*Transaction, error)
- func NewDeployTransaction(fc *code.FunctionCode, programHash common.Uint160, ...) (*Transaction, error)
- func NewInvokeTransaction(fc []byte, codeHash common.Uint160, programhash common.Uint160) (*Transaction, error)
- func NewIssueAssetTransaction(outputs []*TxOutput) (*Transaction, error)
- func NewLockAssetTransaction(programHash common.Uint160, assetID common.Uint256, amount common.Fixed64, ...) (*Transaction, error)
- func NewPrivacyPayloadTransaction(fromPrivKey []byte, fromPubkey *crypto.PubKey, toPubkey *crypto.PubKey, ...) (*Transaction, error)
- func NewRecordTransaction(recordType string, recordData []byte) (*Transaction, error)
- func NewRegisterAssetTransaction(asset *asset.Asset, amount common.Fixed64, issuer *crypto.PubKey, ...) (*Transaction, error)
- func NewTransferAssetTransaction(inputs []*UTXOTxInput, outputs []*TxOutput) (*Transaction, error)
- func (tx *Transaction) AppendNewSignature(sig []byte) error
- func (tx *Transaction) Deserialize(r io.Reader) error
- func (tx *Transaction) DeserializeUnsigned(r io.Reader) error
- func (tx *Transaction) DeserializeUnsignedWithoutType(r io.Reader) error
- func (tx *Transaction) GenerateAssetMaps()
- func (tx *Transaction) GetMergedAssetIDValueFromOutputs() TransactionResult
- func (tx *Transaction) GetMergedAssetIDValueFromReference() (TransactionResult, error)
- func (tx *Transaction) GetMessage() []byte
- func (tx *Transaction) GetOutputHashes() ([]common.Uint160, error)
- func (tx *Transaction) GetProgramHashes() ([]common.Uint160, error)
- func (tx *Transaction) GetPrograms() []*program.Program
- func (tx *Transaction) GetReference() (map[*UTXOTxInput]*TxOutput, error)
- func (tx *Transaction) GetReference1() (map[*UTXOTxInput]*TxOutput, error)
- func (tx *Transaction) GetTransactionResults() (TransactionResult, error)
- func (tx *Transaction) Hash() common.Uint256
- func (tx *Transaction) ParseTransactionCode() []common.Uint160
- func (tx *Transaction) ParseTransactionSig() (havesig, needsig int, err error)
- func (tx *Transaction) Serialize(w io.Writer) error
- func (tx *Transaction) SerializeUnsigned(w io.Writer) error
- func (tx *Transaction) SetHash(hash common.Uint256)
- func (tx *Transaction) SetPrograms(programs []*program.Program)
- func (tx *Transaction) ToArray() []byte
- func (tx *Transaction) Type() common.InventoryType
- func (tx *Transaction) Verify() error
- type TransactionAttributeUsage
- type TransactionPool
- type TransactionResult
- type TransactionType
- type TxAttribute
- type TxOutput
- type UTXOTxInput
- type UTXOUnspent
Constants ¶
View Source
const ( // encoded public key length 0x21 || encoded public key (33 bytes) || OP_CHECKSIG(0xac) PublickKeyScriptLen = 35 // signature length(0x40) || 64 bytes signature SignatureScriptLen = 65 // 1byte m || 3 encoded public keys with leading 0x40 (34 bytes * 3) || // 1byte n + 1byte OP_CHECKMULTISIG // FIXME: if want to support 1/2 multisig MinMultisigCodeLen = 105 )
Variables ¶
This section is empty.
Functions ¶
func IsValidAttributeType ¶
func IsValidAttributeType(usage TransactionAttributeUsage) bool
Types ¶
type BalanceTxInput ¶
type BalanceTxInput struct { AssetID common.Uint256 Value common.Fixed64 ProgramHash common.Uint160 }
func (*BalanceTxInput) Deserialize ¶
func (bi *BalanceTxInput) Deserialize(r io.Reader) error
func (*BalanceTxInput) Serialize ¶
func (bi *BalanceTxInput) Serialize(w io.Writer)
type ILedgerStore ¶
type ILedgerStore interface { GetTransaction(hash Uint256) (*Transaction, error) GetQuantityIssued(AssetId Uint256) (Fixed64, error) }
var TxStore ILedgerStore
type Transaction ¶
type Transaction struct { TxType TransactionType PayloadVersion byte Payload Payload Attributes []*TxAttribute UTXOInputs []*UTXOTxInput BalanceInputs []*BalanceTxInput Outputs []*TxOutput Programs []*program.Program AssetOutputs map[common.Uint256][]*TxOutput AssetInputAmount map[common.Uint256]common.Fixed64 AssetOutputAmount map[common.Uint256]common.Fixed64 OutputsRef []*TxOutput // contains filtered or unexported fields }
func NewDataFileTransaction ¶
func NewDeployTransaction ¶
func NewDeployTransaction(fc *code.FunctionCode, programHash common.Uint160, name, codeversion, author, email, desp string, language types.LangType) (*Transaction, error)
initial a new transaction with publish payload
func NewInvokeTransaction ¶
func NewInvokeTransaction(fc []byte, codeHash common.Uint160, programhash common.Uint160) (*Transaction, error)
initial a new transaction with invoke payload
func NewIssueAssetTransaction ¶
func NewIssueAssetTransaction(outputs []*TxOutput) (*Transaction, error)
func NewLockAssetTransaction ¶
func NewPrivacyPayloadTransaction ¶
func NewPrivacyPayloadTransaction(fromPrivKey []byte, fromPubkey *crypto.PubKey, toPubkey *crypto.PubKey, payloadType payload.EncryptedPayloadType, data []byte) (*Transaction, error)
func NewRecordTransaction ¶
func NewRecordTransaction(recordType string, recordData []byte) (*Transaction, error)
initial a new transaction with record payload
func NewTransferAssetTransaction ¶
func NewTransferAssetTransaction(inputs []*UTXOTxInput, outputs []*TxOutput) (*Transaction, error)
func (*Transaction) AppendNewSignature ¶
func (tx *Transaction) AppendNewSignature(sig []byte) error
func (*Transaction) Deserialize ¶
func (tx *Transaction) Deserialize(r io.Reader) error
deserialize the Transaction
func (*Transaction) DeserializeUnsigned ¶
func (tx *Transaction) DeserializeUnsigned(r io.Reader) error
func (*Transaction) DeserializeUnsignedWithoutType ¶
func (tx *Transaction) DeserializeUnsignedWithoutType(r io.Reader) error
func (*Transaction) GenerateAssetMaps ¶
func (tx *Transaction) GenerateAssetMaps()
func (*Transaction) GetMergedAssetIDValueFromOutputs ¶
func (tx *Transaction) GetMergedAssetIDValueFromOutputs() TransactionResult
func (*Transaction) GetMergedAssetIDValueFromReference ¶
func (tx *Transaction) GetMergedAssetIDValueFromReference() (TransactionResult, error)
func (*Transaction) GetMessage ¶
func (tx *Transaction) GetMessage() []byte
func (*Transaction) GetOutputHashes ¶
func (tx *Transaction) GetOutputHashes() ([]common.Uint160, error)
func (*Transaction) GetProgramHashes ¶
func (tx *Transaction) GetProgramHashes() ([]common.Uint160, error)
func (*Transaction) GetPrograms ¶
func (tx *Transaction) GetPrograms() []*program.Program
func (*Transaction) GetReference ¶
func (tx *Transaction) GetReference() (map[*UTXOTxInput]*TxOutput, error)
func (*Transaction) GetReference1 ¶
func (tx *Transaction) GetReference1() (map[*UTXOTxInput]*TxOutput, error)
func (*Transaction) GetTransactionResults ¶
func (tx *Transaction) GetTransactionResults() (TransactionResult, error)
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() common.Uint256
func (*Transaction) ParseTransactionCode ¶
func (tx *Transaction) ParseTransactionCode() []common.Uint160
func (*Transaction) ParseTransactionSig ¶
func (tx *Transaction) ParseTransactionSig() (havesig, needsig int, err error)
func (*Transaction) Serialize ¶
func (tx *Transaction) Serialize(w io.Writer) error
Serialize the Transaction
func (*Transaction) SerializeUnsigned ¶
func (tx *Transaction) SerializeUnsigned(w io.Writer) error
Serialize the Transaction data without contracts
func (*Transaction) SetHash ¶
func (tx *Transaction) SetHash(hash common.Uint256)
func (*Transaction) SetPrograms ¶
func (tx *Transaction) SetPrograms(programs []*program.Program)
func (*Transaction) ToArray ¶
func (tx *Transaction) ToArray() []byte
func (*Transaction) Type ¶
func (tx *Transaction) Type() common.InventoryType
func (*Transaction) Verify ¶
func (tx *Transaction) Verify() error
type TransactionAttributeUsage ¶
type TransactionAttributeUsage byte
const ( Nonce TransactionAttributeUsage = 0x00 Script TransactionAttributeUsage = 0x20 DescriptionUrl TransactionAttributeUsage = 0x81 Description TransactionAttributeUsage = 0x90 )
type TransactionPool ¶
type TransactionPool interface { // add a transaction to the pool. Add(*Transaction) error //returns all transactions that were in the pool. Dump() ([]*Transaction, error) }
type TransactionType ¶
type TransactionType byte
const ( BookKeeping TransactionType = 0x00 IssueAsset TransactionType = 0x01 BookKeeper TransactionType = 0x02 LockAsset TransactionType = 0x03 PrivacyPayload TransactionType = 0x20 RegisterAsset TransactionType = 0x40 TransferAsset TransactionType = 0x80 Record TransactionType = 0x81 DeployCode TransactionType = 0xd0 InvokeCode TransactionType = 0xd1 DataFile TransactionType = 0x12 )
type TxAttribute ¶
type TxAttribute struct { Usage TransactionAttributeUsage Data []byte Size uint32 }
func NewTxAttribute ¶
func NewTxAttribute(u TransactionAttributeUsage, data []byte) TxAttribute
func (*TxAttribute) Deserialize ¶
func (tx *TxAttribute) Deserialize(r io.Reader) error
func (*TxAttribute) GetSize ¶
func (tx *TxAttribute) GetSize() uint32
func (*TxAttribute) ToArray ¶
func (tx *TxAttribute) ToArray() []byte
type TxOutput ¶
func (*TxOutput) Deserialize ¶
type UTXOTxInput ¶
type UTXOTxInput struct { ReferTxID common.Uint256 //the index of transcation ReferTxOutputIndex uint16 }
func (*UTXOTxInput) Deserialize ¶
func (ui *UTXOTxInput) Deserialize(r io.Reader) error
func (*UTXOTxInput) Equals ¶
func (ui *UTXOTxInput) Equals(other *UTXOTxInput) bool
func (*UTXOTxInput) Serialize ¶
func (ui *UTXOTxInput) Serialize(w io.Writer)
func (*UTXOTxInput) ToArray ¶
func (ui *UTXOTxInput) ToArray() []byte
func (*UTXOTxInput) ToString ¶
func (ui *UTXOTxInput) ToString() string
type UTXOUnspent ¶
func (*UTXOUnspent) Deserialize ¶
func (uu *UTXOUnspent) Deserialize(r io.Reader) error
func (*UTXOUnspent) Serialize ¶
func (uu *UTXOUnspent) Serialize(w io.Writer)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.