Documentation ¶
Overview ¶
Package transaction contains Neo transaction definition.
This is one of the core structures of Neo blockchain.
Index ¶
- Constants
- Variables
- type AttrType
- type Attribute
- type ConditionAnd
- func (c *ConditionAnd) DecodeBinarySpecific(r *io.BinReader, maxDepth int)
- func (c *ConditionAnd) EncodeBinary(w *io.BinWriter)
- func (c *ConditionAnd) MarshalJSON() ([]byte, error)
- func (c *ConditionAnd) Match(ctx MatchContext) (bool, error)
- func (c *ConditionAnd) ToStackItem() stackitem.Item
- func (c *ConditionAnd) Type() WitnessConditionType
- type ConditionBoolean
- func (c *ConditionBoolean) DecodeBinarySpecific(r *io.BinReader, maxDepth int)
- func (c *ConditionBoolean) EncodeBinary(w *io.BinWriter)
- func (c *ConditionBoolean) MarshalJSON() ([]byte, error)
- func (c *ConditionBoolean) Match(_ MatchContext) (bool, error)
- func (c *ConditionBoolean) ToStackItem() stackitem.Item
- func (c *ConditionBoolean) Type() WitnessConditionType
- type ConditionCalledByContract
- func (c *ConditionCalledByContract) DecodeBinarySpecific(r *io.BinReader, _ int)
- func (c *ConditionCalledByContract) EncodeBinary(w *io.BinWriter)
- func (c *ConditionCalledByContract) MarshalJSON() ([]byte, error)
- func (c *ConditionCalledByContract) Match(ctx MatchContext) (bool, error)
- func (c *ConditionCalledByContract) ToStackItem() stackitem.Item
- func (c *ConditionCalledByContract) Type() WitnessConditionType
- type ConditionCalledByEntry
- func (c ConditionCalledByEntry) DecodeBinarySpecific(_ *io.BinReader, _ int)
- func (c ConditionCalledByEntry) EncodeBinary(w *io.BinWriter)
- func (c ConditionCalledByEntry) MarshalJSON() ([]byte, error)
- func (c ConditionCalledByEntry) Match(ctx MatchContext) (bool, error)
- func (c ConditionCalledByEntry) ToStackItem() stackitem.Item
- func (c ConditionCalledByEntry) Type() WitnessConditionType
- type ConditionCalledByGroup
- func (c *ConditionCalledByGroup) DecodeBinarySpecific(r *io.BinReader, _ int)
- func (c *ConditionCalledByGroup) EncodeBinary(w *io.BinWriter)
- func (c *ConditionCalledByGroup) MarshalJSON() ([]byte, error)
- func (c *ConditionCalledByGroup) Match(ctx MatchContext) (bool, error)
- func (c *ConditionCalledByGroup) ToStackItem() stackitem.Item
- func (c *ConditionCalledByGroup) Type() WitnessConditionType
- type ConditionGroup
- func (c *ConditionGroup) DecodeBinarySpecific(r *io.BinReader, _ int)
- func (c *ConditionGroup) EncodeBinary(w *io.BinWriter)
- func (c *ConditionGroup) MarshalJSON() ([]byte, error)
- func (c *ConditionGroup) Match(ctx MatchContext) (bool, error)
- func (c *ConditionGroup) ToStackItem() stackitem.Item
- func (c *ConditionGroup) Type() WitnessConditionType
- type ConditionNot
- func (c *ConditionNot) DecodeBinarySpecific(r *io.BinReader, maxDepth int)
- func (c *ConditionNot) EncodeBinary(w *io.BinWriter)
- func (c *ConditionNot) MarshalJSON() ([]byte, error)
- func (c *ConditionNot) Match(ctx MatchContext) (bool, error)
- func (c *ConditionNot) ToStackItem() stackitem.Item
- func (c *ConditionNot) Type() WitnessConditionType
- type ConditionOr
- func (c *ConditionOr) DecodeBinarySpecific(r *io.BinReader, maxDepth int)
- func (c *ConditionOr) EncodeBinary(w *io.BinWriter)
- func (c *ConditionOr) MarshalJSON() ([]byte, error)
- func (c *ConditionOr) Match(ctx MatchContext) (bool, error)
- func (c *ConditionOr) ToStackItem() stackitem.Item
- func (c *ConditionOr) Type() WitnessConditionType
- type ConditionScriptHash
- func (c *ConditionScriptHash) DecodeBinarySpecific(r *io.BinReader, _ int)
- func (c *ConditionScriptHash) EncodeBinary(w *io.BinWriter)
- func (c *ConditionScriptHash) MarshalJSON() ([]byte, error)
- func (c *ConditionScriptHash) Match(ctx MatchContext) (bool, error)
- func (c *ConditionScriptHash) ToStackItem() stackitem.Item
- func (c *ConditionScriptHash) Type() WitnessConditionType
- type Conflicts
- type MatchContext
- type NotValidBefore
- type NotaryAssisted
- type OracleResponse
- type OracleResponseCode
- type Reserved
- type Signer
- type Transaction
- func (t *Transaction) Bytes() []byte
- func (t *Transaction) DecodeBinary(br *io.BinReader)
- func (t *Transaction) DecodeHashableFields(buf []byte) error
- func (t *Transaction) EncodeBinary(bw *io.BinWriter)
- func (t *Transaction) EncodeHashableFields() ([]byte, error)
- func (t *Transaction) FeePerByte() int64
- func (t *Transaction) GetAttributes(typ AttrType) []Attribute
- func (t *Transaction) HasAttribute(typ AttrType) bool
- func (t *Transaction) HasSigner(hash util.Uint160) bool
- func (t *Transaction) Hash() util.Uint256
- func (t *Transaction) MarshalJSON() ([]byte, error)
- func (t *Transaction) Sender() util.Uint160
- func (t *Transaction) Size() int
- func (t *Transaction) ToStackItem() stackitem.Item
- func (t *Transaction) UnmarshalJSON(data []byte) error
- type Witness
- type WitnessAction
- type WitnessCondition
- type WitnessConditionType
- type WitnessRule
- type WitnessScope
Constants ¶
const ( // ReservedLowerBound is the lower bound of reserved attribute types. ReservedLowerBound = 0xe0 // ReservedUpperBound is the upper bound of reserved attribute types. ReservedUpperBound = 0xff )
const ( // MaxScriptLength is the limit for transaction's script length. MaxScriptLength = math.MaxUint16 // MaxTransactionSize is the upper limit size in bytes that a transaction can reach. It is // set to be 102400. MaxTransactionSize = 102400 // MaxAttributes is maximum number of attributes including signers that can be contained // within a transaction. It is set to be 16. MaxAttributes = 16 // DummyVersion represents reserved transaction version for trimmed transactions. DummyVersion = 255 )
const ( // MaxInvocationScript is the maximum length of allowed invocation // script. It should fit 11/21 multisignature for the committee. MaxInvocationScript = 1024 // MaxVerificationScript is the maximum allowed length of verification // script. It should be appropriate for 11/21 multisignature committee. MaxVerificationScript = 1024 )
const MaxOracleResultSize = math.MaxUint16
MaxOracleResultSize is the maximum allowed oracle answer size.
Variables ¶
var ( ErrInvalidResponseCode = errors.New("invalid oracle response code") ErrInvalidResult = errors.New("oracle response != success, but result is not empty") )
Various validation errors.
var ( ErrInvalidVersion = errors.New("only version 0 is supported") ErrNegativeSystemFee = errors.New("negative system fee") ErrNegativeNetworkFee = errors.New("negative network fee") ErrTooBigFees = errors.New("too big fees: int64 overflow") ErrEmptySigners = errors.New("signers array should contain sender") ErrNonUniqueSigners = errors.New("transaction signers should be unique") ErrInvalidAttribute = errors.New("invalid attribute") ErrEmptyScript = errors.New("no script") )
Various errors for transaction validation.
var ErrInvalidWitnessNum = errors.New("number of signers doesn't match witnesses")
ErrInvalidWitnessNum returns when the number of witnesses does not match signers.
Functions ¶
This section is empty.
Types ¶
type AttrType ¶ added in v0.91.0
type AttrType uint8
AttrType represents the purpose of the attribute.
type Attribute ¶
type Attribute struct { Type AttrType Value interface { io.Serializable // contains filtered or unexported methods } }
Attribute represents a Transaction attribute.
func (*Attribute) DecodeBinary ¶
DecodeBinary implements the Serializable interface.
func (*Attribute) EncodeBinary ¶
EncodeBinary implements the Serializable interface.
func (*Attribute) MarshalJSON ¶
MarshalJSON implements the json Marshaller interface.
func (*Attribute) UnmarshalJSON ¶ added in v0.75.0
UnmarshalJSON implements the json.Unmarshaller interface.
type ConditionAnd ¶ added in v0.98.0
type ConditionAnd []WitnessCondition
ConditionAnd is a set of conditions required to match.
func (*ConditionAnd) DecodeBinarySpecific ¶ added in v0.98.0
func (c *ConditionAnd) DecodeBinarySpecific(r *io.BinReader, maxDepth int)
DecodeBinarySpecific implements the WitnessCondition interface allowing to deserialize condition-specific data.
func (*ConditionAnd) EncodeBinary ¶ added in v0.98.0
func (c *ConditionAnd) EncodeBinary(w *io.BinWriter)
EncodeBinary implements the WitnessCondition interface allowing to serialize condition.
func (*ConditionAnd) MarshalJSON ¶ added in v0.98.0
func (c *ConditionAnd) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*ConditionAnd) Match ¶ added in v0.98.0
func (c *ConditionAnd) Match(ctx MatchContext) (bool, error)
Match implements the WitnessCondition interface checking whether this condition matches given context.
func (*ConditionAnd) ToStackItem ¶ added in v0.99.0
func (c *ConditionAnd) ToStackItem() stackitem.Item
ToStackItem implements the WitnessCondition interface allowing to convert to stackitem.Item.
func (*ConditionAnd) Type ¶ added in v0.98.0
func (c *ConditionAnd) Type() WitnessConditionType
Type implements the WitnessCondition interface and returns condition type.
type ConditionBoolean ¶ added in v0.98.0
type ConditionBoolean bool
ConditionBoolean is a boolean condition type.
func (*ConditionBoolean) DecodeBinarySpecific ¶ added in v0.98.0
func (c *ConditionBoolean) DecodeBinarySpecific(r *io.BinReader, maxDepth int)
DecodeBinarySpecific implements the WitnessCondition interface allowing to deserialize condition-specific data.
func (*ConditionBoolean) EncodeBinary ¶ added in v0.98.0
func (c *ConditionBoolean) EncodeBinary(w *io.BinWriter)
EncodeBinary implements the WitnessCondition interface allowing to serialize condition.
func (*ConditionBoolean) MarshalJSON ¶ added in v0.98.0
func (c *ConditionBoolean) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*ConditionBoolean) Match ¶ added in v0.98.0
func (c *ConditionBoolean) Match(_ MatchContext) (bool, error)
Match implements the WitnessCondition interface checking whether this condition matches given context.
func (*ConditionBoolean) ToStackItem ¶ added in v0.99.0
func (c *ConditionBoolean) ToStackItem() stackitem.Item
ToStackItem implements WitnessCondition interface allowing to convert to stackitem.Item.
func (*ConditionBoolean) Type ¶ added in v0.98.0
func (c *ConditionBoolean) Type() WitnessConditionType
Type implements the WitnessCondition interface and returns condition type.
type ConditionCalledByContract ¶ added in v0.98.0
ConditionCalledByContract is a condition matching calling script hash.
func (*ConditionCalledByContract) DecodeBinarySpecific ¶ added in v0.98.0
func (c *ConditionCalledByContract) DecodeBinarySpecific(r *io.BinReader, _ int)
DecodeBinarySpecific implements the WitnessCondition interface allowing to deserialize condition-specific data.
func (*ConditionCalledByContract) EncodeBinary ¶ added in v0.98.0
func (c *ConditionCalledByContract) EncodeBinary(w *io.BinWriter)
EncodeBinary implements the WitnessCondition interface allowing to serialize condition.
func (*ConditionCalledByContract) MarshalJSON ¶ added in v0.98.0
func (c *ConditionCalledByContract) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*ConditionCalledByContract) Match ¶ added in v0.98.0
func (c *ConditionCalledByContract) Match(ctx MatchContext) (bool, error)
Match implements the WitnessCondition interface checking whether this condition matches given context.
func (*ConditionCalledByContract) ToStackItem ¶ added in v0.99.0
func (c *ConditionCalledByContract) ToStackItem() stackitem.Item
ToStackItem implements the WitnessCondition interface allowing to convert to stackitem.Item.
func (*ConditionCalledByContract) Type ¶ added in v0.98.0
func (c *ConditionCalledByContract) Type() WitnessConditionType
Type implements the WitnessCondition interface and returns condition type.
type ConditionCalledByEntry ¶ added in v0.98.0
type ConditionCalledByEntry struct{}
ConditionCalledByEntry is a condition matching entry script or one directly called by it.
func (ConditionCalledByEntry) DecodeBinarySpecific ¶ added in v0.98.0
func (c ConditionCalledByEntry) DecodeBinarySpecific(_ *io.BinReader, _ int)
DecodeBinarySpecific implements the WitnessCondition interface allowing to deserialize condition-specific data.
func (ConditionCalledByEntry) EncodeBinary ¶ added in v0.98.0
func (c ConditionCalledByEntry) EncodeBinary(w *io.BinWriter)
EncodeBinary implements the WitnessCondition interface allowing to serialize condition.
func (ConditionCalledByEntry) MarshalJSON ¶ added in v0.98.0
func (c ConditionCalledByEntry) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (ConditionCalledByEntry) Match ¶ added in v0.98.0
func (c ConditionCalledByEntry) Match(ctx MatchContext) (bool, error)
Match implements the WitnessCondition interface checking whether this condition matches given context.
func (ConditionCalledByEntry) ToStackItem ¶ added in v0.99.0
func (c ConditionCalledByEntry) ToStackItem() stackitem.Item
ToStackItem implements the WitnessCondition interface allowing to convert to stackitem.Item.
func (ConditionCalledByEntry) Type ¶ added in v0.98.0
func (c ConditionCalledByEntry) Type() WitnessConditionType
Type implements the WitnessCondition interface and returns condition type.
type ConditionCalledByGroup ¶ added in v0.98.0
ConditionCalledByGroup is a condition matching calling script group.
func (*ConditionCalledByGroup) DecodeBinarySpecific ¶ added in v0.98.0
func (c *ConditionCalledByGroup) DecodeBinarySpecific(r *io.BinReader, _ int)
DecodeBinarySpecific implements the WitnessCondition interface allowing to deserialize condition-specific data.
func (*ConditionCalledByGroup) EncodeBinary ¶ added in v0.98.0
func (c *ConditionCalledByGroup) EncodeBinary(w *io.BinWriter)
EncodeBinary implements the WitnessCondition interface allowing to serialize condition.
func (*ConditionCalledByGroup) MarshalJSON ¶ added in v0.98.0
func (c *ConditionCalledByGroup) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*ConditionCalledByGroup) Match ¶ added in v0.98.0
func (c *ConditionCalledByGroup) Match(ctx MatchContext) (bool, error)
Match implements the WitnessCondition interface checking whether this condition matches given context.
func (*ConditionCalledByGroup) ToStackItem ¶ added in v0.99.0
func (c *ConditionCalledByGroup) ToStackItem() stackitem.Item
ToStackItem implements WitnessCondition interface allowing to convert to stackitem.Item.
func (*ConditionCalledByGroup) Type ¶ added in v0.98.0
func (c *ConditionCalledByGroup) Type() WitnessConditionType
Type implements the WitnessCondition interface and returns condition type.
type ConditionGroup ¶ added in v0.98.0
ConditionGroup is a condition matching executing script group.
func (*ConditionGroup) DecodeBinarySpecific ¶ added in v0.98.0
func (c *ConditionGroup) DecodeBinarySpecific(r *io.BinReader, _ int)
DecodeBinarySpecific implements the WitnessCondition interface allowing to deserialize condition-specific data.
func (*ConditionGroup) EncodeBinary ¶ added in v0.98.0
func (c *ConditionGroup) EncodeBinary(w *io.BinWriter)
EncodeBinary implements the WitnessCondition interface allowing to serialize condition.
func (*ConditionGroup) MarshalJSON ¶ added in v0.98.0
func (c *ConditionGroup) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*ConditionGroup) Match ¶ added in v0.98.0
func (c *ConditionGroup) Match(ctx MatchContext) (bool, error)
Match implements the WitnessCondition interface checking whether this condition matches given context.
func (*ConditionGroup) ToStackItem ¶ added in v0.99.0
func (c *ConditionGroup) ToStackItem() stackitem.Item
ToStackItem implements the WitnessCondition interface allowing to convert to stackitem.Item.
func (*ConditionGroup) Type ¶ added in v0.98.0
func (c *ConditionGroup) Type() WitnessConditionType
Type implements the WitnessCondition interface and returns condition type.
type ConditionNot ¶ added in v0.98.0
type ConditionNot struct {
Condition WitnessCondition
}
ConditionNot inverses the meaning of contained condition.
func (*ConditionNot) DecodeBinarySpecific ¶ added in v0.98.0
func (c *ConditionNot) DecodeBinarySpecific(r *io.BinReader, maxDepth int)
DecodeBinarySpecific implements the WitnessCondition interface allowing to deserialize condition-specific data.
func (*ConditionNot) EncodeBinary ¶ added in v0.98.0
func (c *ConditionNot) EncodeBinary(w *io.BinWriter)
EncodeBinary implements the WitnessCondition interface allowing to serialize condition.
func (*ConditionNot) MarshalJSON ¶ added in v0.98.0
func (c *ConditionNot) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*ConditionNot) Match ¶ added in v0.98.0
func (c *ConditionNot) Match(ctx MatchContext) (bool, error)
Match implements the WitnessCondition interface checking whether this condition matches given context.
func (*ConditionNot) ToStackItem ¶ added in v0.99.0
func (c *ConditionNot) ToStackItem() stackitem.Item
ToStackItem implements the WitnessCondition interface allowing to convert to stackitem.Item.
func (*ConditionNot) Type ¶ added in v0.98.0
func (c *ConditionNot) Type() WitnessConditionType
Type implements the WitnessCondition interface and returns condition type.
type ConditionOr ¶ added in v0.98.0
type ConditionOr []WitnessCondition
ConditionOr is a set of conditions one of which is required to match.
func (*ConditionOr) DecodeBinarySpecific ¶ added in v0.98.0
func (c *ConditionOr) DecodeBinarySpecific(r *io.BinReader, maxDepth int)
DecodeBinarySpecific implements the WitnessCondition interface allowing to deserialize condition-specific data.
func (*ConditionOr) EncodeBinary ¶ added in v0.98.0
func (c *ConditionOr) EncodeBinary(w *io.BinWriter)
EncodeBinary implements the WitnessCondition interface allowing to serialize condition.
func (*ConditionOr) MarshalJSON ¶ added in v0.98.0
func (c *ConditionOr) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*ConditionOr) Match ¶ added in v0.98.0
func (c *ConditionOr) Match(ctx MatchContext) (bool, error)
Match implements the WitnessCondition interface checking whether this condition matches given context.
func (*ConditionOr) ToStackItem ¶ added in v0.99.0
func (c *ConditionOr) ToStackItem() stackitem.Item
ToStackItem implements the WitnessCondition interface allowing to convert to stackitem.Item.
func (*ConditionOr) Type ¶ added in v0.98.0
func (c *ConditionOr) Type() WitnessConditionType
Type implements the WitnessCondition interface and returns condition type.
type ConditionScriptHash ¶ added in v0.98.0
ConditionScriptHash is a condition matching executing script hash.
func (*ConditionScriptHash) DecodeBinarySpecific ¶ added in v0.98.0
func (c *ConditionScriptHash) DecodeBinarySpecific(r *io.BinReader, _ int)
DecodeBinarySpecific implements the WitnessCondition interface allowing to deserialize condition-specific data.
func (*ConditionScriptHash) EncodeBinary ¶ added in v0.98.0
func (c *ConditionScriptHash) EncodeBinary(w *io.BinWriter)
EncodeBinary implements the WitnessCondition interface allowing to serialize condition.
func (*ConditionScriptHash) MarshalJSON ¶ added in v0.98.0
func (c *ConditionScriptHash) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*ConditionScriptHash) Match ¶ added in v0.98.0
func (c *ConditionScriptHash) Match(ctx MatchContext) (bool, error)
Match implements the WitnessCondition interface checking whether this condition matches given context.
func (*ConditionScriptHash) ToStackItem ¶ added in v0.99.0
func (c *ConditionScriptHash) ToStackItem() stackitem.Item
ToStackItem implements the WitnessCondition interface allowing to convert to stackitem.Item.
func (*ConditionScriptHash) Type ¶ added in v0.98.0
func (c *ConditionScriptHash) Type() WitnessConditionType
Type implements the WitnessCondition interface and returns condition type.
type Conflicts ¶ added in v0.92.0
Conflicts represents attribute for conflicting transactions.
func (*Conflicts) DecodeBinary ¶ added in v0.92.0
DecodeBinary implements the io.Serializable interface.
func (*Conflicts) EncodeBinary ¶ added in v0.92.0
EncodeBinary implements the io.Serializable interface.
type MatchContext ¶ added in v0.98.0
type MatchContext interface { GetCallingScriptHash() util.Uint160 GetCurrentScriptHash() util.Uint160 CallingScriptHasGroup(*keys.PublicKey) (bool, error) CurrentScriptHasGroup(*keys.PublicKey) (bool, error) IsCalledByEntry() bool }
MatchContext is a set of methods from execution engine needed to perform the witness check.
type NotValidBefore ¶ added in v0.92.0
type NotValidBefore struct {
Height uint32 `json:"height"`
}
NotValidBefore represents attribute with the height transaction is not valid before.
func (*NotValidBefore) DecodeBinary ¶ added in v0.92.0
func (n *NotValidBefore) DecodeBinary(br *io.BinReader)
DecodeBinary implements the io.Serializable interface.
func (*NotValidBefore) EncodeBinary ¶ added in v0.92.0
func (n *NotValidBefore) EncodeBinary(w *io.BinWriter)
EncodeBinary implements the io.Serializable interface.
type NotaryAssisted ¶ added in v0.92.0
type NotaryAssisted struct {
NKeys uint8 `json:"nkeys"`
}
NotaryAssisted represents attribute for notary service transactions.
func (*NotaryAssisted) DecodeBinary ¶ added in v0.92.0
func (n *NotaryAssisted) DecodeBinary(br *io.BinReader)
DecodeBinary implements the io.Serializable interface.
func (*NotaryAssisted) EncodeBinary ¶ added in v0.92.0
func (n *NotaryAssisted) EncodeBinary(w *io.BinWriter)
EncodeBinary implements the io.Serializable interface.
type OracleResponse ¶ added in v0.92.0
type OracleResponse struct { ID uint64 `json:"id"` Code OracleResponseCode `json:"code"` Result []byte `json:"result"` }
OracleResponse represents oracle response.
func (*OracleResponse) DecodeBinary ¶ added in v0.92.0
func (r *OracleResponse) DecodeBinary(br *io.BinReader)
DecodeBinary implements the io.Serializable interface.
func (*OracleResponse) EncodeBinary ¶ added in v0.92.0
func (r *OracleResponse) EncodeBinary(w *io.BinWriter)
EncodeBinary implements the io.Serializable interface.
type OracleResponseCode ¶ added in v0.92.0
type OracleResponseCode byte
OracleResponseCode represents result code of oracle response.
const ( Success OracleResponseCode = 0x00 ProtocolNotSupported OracleResponseCode = 0x10 ConsensusUnreachable OracleResponseCode = 0x12 NotFound OracleResponseCode = 0x14 Timeout OracleResponseCode = 0x16 Forbidden OracleResponseCode = 0x18 ResponseTooLarge OracleResponseCode = 0x1a InsufficientFunds OracleResponseCode = 0x1c ContentTypeNotSupported OracleResponseCode = 0x1f Error OracleResponseCode = 0xff )
Enumeration of possible oracle response types.
func (OracleResponseCode) IsValid ¶ added in v0.92.0
func (c OracleResponseCode) IsValid() bool
IsValid checks if c is valid response code.
func (OracleResponseCode) MarshalJSON ¶ added in v0.94.1
func (c OracleResponseCode) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (OracleResponseCode) String ¶ added in v0.94.1
func (i OracleResponseCode) String() string
func (*OracleResponseCode) UnmarshalJSON ¶ added in v0.94.1
func (c *OracleResponseCode) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type Reserved ¶ added in v0.92.0
type Reserved struct {
Value []byte
}
Reserved represents an attribute for experimental or private usage.
func (*Reserved) DecodeBinary ¶ added in v0.92.0
DecodeBinary implements the io.Serializable interface.
func (*Reserved) EncodeBinary ¶ added in v0.92.0
EncodeBinary implements the io.Serializable interface.
type Signer ¶ added in v0.91.0
type Signer struct { Account util.Uint160 `json:"account"` Scopes WitnessScope `json:"scopes"` AllowedContracts []util.Uint160 `json:"allowedcontracts,omitempty"` AllowedGroups []*keys.PublicKey `json:"allowedgroups,omitempty"` Rules []WitnessRule `json:"rules,omitempty"` }
Signer implements a Transaction signer.
func (*Signer) DecodeBinary ¶ added in v0.91.0
DecodeBinary implements the Serializable interface.
func (*Signer) EncodeBinary ¶ added in v0.91.0
EncodeBinary implements the Serializable interface.
type Transaction ¶
type Transaction struct { // The trading version which is currently 0. Version uint8 // Random number to avoid hash collision. Nonce uint32 // Fee to be burned. SystemFee int64 // Fee to be distributed to consensus nodes. NetworkFee int64 // Maximum blockchain height exceeding which // transaction should fail verification. E.g. if VUB=N, then transaction // can be accepted to block with index N, but not to block with index N+1. ValidUntilBlock uint32 // Code to run in NeoVM for this transaction. Script []byte // Transaction attributes. Attributes []Attribute // Transaction signers list (starts with Sender). Signers []Signer // The scripts that comes with this transaction. // Scripts exist out of the verification script // and invocation script. Scripts []Witness // Trimmed indicates this is a transaction from trimmed // data. Trimmed bool // contains filtered or unexported fields }
Transaction is a process recorded in the Neo blockchain.
func New ¶ added in v0.90.0
func New(script []byte, gas int64) *Transaction
New returns a new transaction to execute given script and pay given system fee.
func NewTransactionFromBytes ¶ added in v0.90.0
func NewTransactionFromBytes(b []byte) (*Transaction, error)
NewTransactionFromBytes decodes byte array into *Transaction.
func NewTrimmedTX ¶
func NewTrimmedTX(hash util.Uint256) *Transaction
NewTrimmedTX returns a trimmed transaction with only its hash and Trimmed to true.
func (*Transaction) Bytes ¶
func (t *Transaction) Bytes() []byte
Bytes converts the transaction to []byte.
func (*Transaction) DecodeBinary ¶
func (t *Transaction) DecodeBinary(br *io.BinReader)
DecodeBinary implements the Serializable interface.
func (*Transaction) DecodeHashableFields ¶ added in v0.94.0
func (t *Transaction) DecodeHashableFields(buf []byte) error
DecodeHashableFields decodes a part of transaction which should be hashed.
func (*Transaction) EncodeBinary ¶
func (t *Transaction) EncodeBinary(bw *io.BinWriter)
EncodeBinary implements the Serializable interface.
func (*Transaction) EncodeHashableFields ¶ added in v0.94.0
func (t *Transaction) EncodeHashableFields() ([]byte, error)
EncodeHashableFields returns serialized transaction's fields which are hashed.
func (*Transaction) FeePerByte ¶ added in v0.90.0
func (t *Transaction) FeePerByte() int64
FeePerByte returns NetworkFee of the transaction divided by its size.
func (*Transaction) GetAttributes ¶ added in v0.92.0
func (t *Transaction) GetAttributes(typ AttrType) []Attribute
GetAttributes returns the list of transaction's attributes of the given type. Returns nil in case if attributes not found.
func (*Transaction) HasAttribute ¶ added in v0.92.0
func (t *Transaction) HasAttribute(typ AttrType) bool
HasAttribute returns true iff t has an attribute of type typ.
func (*Transaction) HasSigner ¶ added in v0.92.0
func (t *Transaction) HasSigner(hash util.Uint160) bool
HasSigner returns true in case if hash is present in the list of signers.
func (*Transaction) Hash ¶
func (t *Transaction) Hash() util.Uint256
Hash returns the hash of the transaction.
func (*Transaction) MarshalJSON ¶ added in v0.75.0
func (t *Transaction) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*Transaction) Sender ¶ added in v0.90.0
func (t *Transaction) Sender() util.Uint160
Sender returns the sender of the transaction which is always on the first place in the transaction's signers list.
func (*Transaction) Size ¶ added in v0.92.0
func (t *Transaction) Size() int
Size returns size of the serialized transaction.
func (*Transaction) ToStackItem ¶ added in v0.99.1
func (t *Transaction) ToStackItem() stackitem.Item
ToStackItem converts Transaction to stackitem.Item.
func (*Transaction) UnmarshalJSON ¶ added in v0.75.0
func (t *Transaction) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type Witness ¶
type Witness struct { InvocationScript []byte `json:"invocation"` VerificationScript []byte `json:"verification"` }
Witness contains 2 scripts.
func (*Witness) DecodeBinary ¶
DecodeBinary implements the Serializable interface.
func (*Witness) EncodeBinary ¶
EncodeBinary implements the Serializable interface.
func (Witness) ScriptHash ¶
ScriptHash returns the hash of the VerificationScript.
type WitnessAction ¶ added in v0.98.0
type WitnessAction byte
WitnessAction represents an action to perform in WitnessRule if WitnessCondition matches.
const ( // WitnessDeny rejects current witness if condition is met. WitnessDeny WitnessAction = 0 // Deny // WitnessAllow approves current witness if condition is met. WitnessAllow WitnessAction = 1 // Allow )
func (WitnessAction) String ¶ added in v0.98.0
func (i WitnessAction) String() string
type WitnessCondition ¶ added in v0.98.0
type WitnessCondition interface { // Type returns a type of this condition. Type() WitnessConditionType // Match checks whether this condition matches current context. Match(MatchContext) (bool, error) // EncodeBinary allows to serialize condition to its binary // representation (including type data). EncodeBinary(*io.BinWriter) // DecodeBinarySpecific decodes type-specific binary data from the given // reader (not including type data). DecodeBinarySpecific(*io.BinReader, int) // ToStackItem converts WitnessCondition to stackitem.Item. ToStackItem() stackitem.Item json.Marshaler }
WitnessCondition is a condition of WitnessRule.
func DecodeBinaryCondition ¶ added in v0.98.0
func DecodeBinaryCondition(r *io.BinReader) WitnessCondition
DecodeBinaryCondition decodes and returns condition from the given binary stream.
func UnmarshalConditionJSON ¶ added in v0.98.0
func UnmarshalConditionJSON(data []byte) (WitnessCondition, error)
UnmarshalConditionJSON unmarshalls condition from the given JSON data.
type WitnessConditionType ¶ added in v0.98.0
type WitnessConditionType byte
WitnessConditionType encodes a type of witness condition.
const ( // WitnessBoolean is a generic boolean condition. WitnessBoolean WitnessConditionType = 0x00 // Boolean // WitnessNot reverses another condition. WitnessNot WitnessConditionType = 0x01 // Not // WitnessAnd means that all conditions must be met. WitnessAnd WitnessConditionType = 0x02 // And // WitnessOr means that any of conditions must be met. WitnessOr WitnessConditionType = 0x03 // Or // WitnessScriptHash matches executing contract's script hash. WitnessScriptHash WitnessConditionType = 0x18 // ScriptHash // WitnessGroup matches executing contract's group key. WitnessGroup WitnessConditionType = 0x19 // Group // WitnessCalledByEntry matches when current script is an entry script or is called by an entry script. WitnessCalledByEntry WitnessConditionType = 0x20 // CalledByEntry // WitnessCalledByContract matches when current script is called by the specified contract. WitnessCalledByContract WitnessConditionType = 0x28 // CalledByContract // WitnessCalledByGroup matches when current script is called by contract belonging to the specified group. WitnessCalledByGroup WitnessConditionType = 0x29 // CalledByGroup // MaxConditionNesting limits the maximum allowed level of condition nesting. MaxConditionNesting = 2 )
func (WitnessConditionType) String ¶ added in v0.98.0
func (i WitnessConditionType) String() string
type WitnessRule ¶ added in v0.98.0
type WitnessRule struct { Action WitnessAction `json:"action"` Condition WitnessCondition `json:"condition"` }
WitnessRule represents a single rule for Rules witness scope.
func (*WitnessRule) DecodeBinary ¶ added in v0.98.0
func (w *WitnessRule) DecodeBinary(br *io.BinReader)
DecodeBinary implements the Serializable interface.
func (*WitnessRule) EncodeBinary ¶ added in v0.98.0
func (w *WitnessRule) EncodeBinary(bw *io.BinWriter)
EncodeBinary implements the Serializable interface.
func (*WitnessRule) MarshalJSON ¶ added in v0.98.0
func (w *WitnessRule) MarshalJSON() ([]byte, error)
UnmarshalJSON implements the json.Unmarshaler interface.
func (*WitnessRule) ToStackItem ¶ added in v0.99.0
func (w *WitnessRule) ToStackItem() stackitem.Item
ToStackItem implements Convertible interface.
func (*WitnessRule) UnmarshalJSON ¶ added in v0.98.0
func (w *WitnessRule) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type WitnessScope ¶ added in v0.90.0
type WitnessScope byte
WitnessScope represents set of witness flags for Transaction signer.
const ( // None specifies that no contract was witnessed. Only sign the transaction. None WitnessScope = 0 // CalledByEntry witness is only valid in entry script and ones directly called by it. // No params is needed, as the witness/permission/signature given on first invocation will // automatically expire if entering deeper internal invokes. This can be default safe // choice for native NEO/GAS (previously used on Neo 2 as "attach" mode). CalledByEntry WitnessScope = 0x01 // CustomContracts define custom hash for contract-specific. CustomContracts WitnessScope = 0x10 // CustomGroups define custom pubkey for group members. CustomGroups WitnessScope = 0x20 // Rules is a set of conditions with boolean operators. Rules WitnessScope = 0x40 // WitnessRules // Global allows this witness in all contexts (default Neo2 behavior). // This cannot be combined with other flags. Global WitnessScope = 0x80 )
func ScopesFromString ¶ added in v0.90.0
func ScopesFromString(s string) (WitnessScope, error)
ScopesFromString converts string of comma-separated scopes to a set of scopes (case-sensitive). String can combine several scopes, e.g. be any of: 'Global', 'CalledByEntry,CustomGroups' etc. In case of an empty string an error will be returned.
func (WitnessScope) MarshalJSON ¶ added in v0.90.0
func (s WitnessScope) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (WitnessScope) String ¶ added in v0.90.0
func (i WitnessScope) String() string
func (*WitnessScope) UnmarshalJSON ¶ added in v0.90.0
func (s *WitnessScope) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
Source Files ¶
- attribute.go
- attrtype.go
- attrtype_string.go
- conflicts.go
- doc.go
- not_valid_before.go
- notary_assisted.go
- oracle.go
- oracleresponsecode_string.go
- reserved.go
- signer.go
- transaction.go
- witness.go
- witness_condition.go
- witness_rule.go
- witness_scope.go
- witness_scope_string.go
- witnessaction_string.go
- witnessconditiontype_string.go