neovm

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: LGPL-3.0 Imports: 25 Imported by: 36

Documentation

Overview

* Copyright (C) 2018 The ontology Authors * This file is part of The ontology library. * * The ontology is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The ontology is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with The ontology. If not, see <http://www.gnu.org/licenses/>.

* Copyright (C) 2018 The ontology Authors * This file is part of The ontology library. * * The ontology is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The ontology is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with The ontology. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var (
	//Gas Limit
	MIN_TRANSACTION_GAS           uint64 = 20000 // Per transaction base cost.
	BLOCKCHAIN_GETHEADER_GAS      uint64 = 100
	BLOCKCHAIN_GETBLOCK_GAS       uint64 = 200
	BLOCKCHAIN_GETTRANSACTION_GAS uint64 = 100
	BLOCKCHAIN_GETCONTRACT_GAS    uint64 = 100
	CONTRACT_CREATE_GAS           uint64 = 20000000
	CONTRACT_MIGRATE_GAS          uint64 = 20000000
	UINT_DEPLOY_CODE_LEN_GAS      uint64 = 200000
	UINT_INVOKE_CODE_LEN_GAS      uint64 = 20000
	NATIVE_INVOKE_GAS             uint64 = 1000
	STORAGE_GET_GAS               uint64 = 200
	STORAGE_PUT_GAS               uint64 = 4000
	STORAGE_DELETE_GAS            uint64 = 100
	RUNTIME_CHECKWITNESS_GAS      uint64 = 200
	RUNTIME_VERIFYMUTISIG_GAS     uint64 = 400
	RUNTIME_ADDRESSTOBASE58_GAS   uint64 = 40
	RUNTIME_BASE58TOADDRESS_GAS   uint64 = 30
	APPCALL_GAS                   uint64 = 10
	TAILCALL_GAS                  uint64 = 10
	SHA1_GAS                      uint64 = 10
	SHA256_GAS                    uint64 = 10
	HASH160_GAS                   uint64 = 20
	HASH256_GAS                   uint64 = 20
	OPCODE_GAS                    uint64 = 1

	PER_UNIT_CODE_LEN    = 1024
	METHOD_LENGTH_LIMIT  = 1024
	DUPLICATE_STACK_SIZE = 1024 * 2
	VM_STEP_LIMIT        = 400000

	// API Name
	ATTRIBUTE_GETUSAGE_NAME = "Ontology.Attribute.GetUsage"
	ATTRIBUTE_GETDATA_NAME  = "Ontology.Attribute.GetData"

	BLOCK_GETTRANSACTIONCOUNT_NAME       = "System.Block.GetTransactionCount"
	BLOCK_GETTRANSACTIONS_NAME           = "System.Block.GetTransactions"
	BLOCK_GETTRANSACTION_NAME            = "System.Block.GetTransaction"
	BLOCKCHAIN_GETHEIGHT_NAME            = "System.Blockchain.GetHeight"
	BLOCKCHAIN_GETHEADER_NAME            = "System.Blockchain.GetHeader"
	BLOCKCHAIN_GETBLOCK_NAME             = "System.Blockchain.GetBlock"
	BLOCKCHAIN_GETTRANSACTION_NAME       = "System.Blockchain.GetTransaction"
	BLOCKCHAIN_GETCONTRACT_NAME          = "System.Blockchain.GetContract"
	BLOCKCHAIN_GETTRANSACTIONHEIGHT_NAME = "System.Blockchain.GetTransactionHeight"

	HEADER_GETINDEX_NAME         = "System.Header.GetIndex"
	HEADER_GETHASH_NAME          = "System.Header.GetHash"
	HEADER_GETVERSION_NAME       = "Ontology.Header.GetVersion"
	HEADER_GETPREVHASH_NAME      = "System.Header.GetPrevHash"
	HEADER_GETTIMESTAMP_NAME     = "System.Header.GetTimestamp"
	HEADER_GETCONSENSUSDATA_NAME = "Ontology.Header.GetConsensusData"
	HEADER_GETNEXTCONSENSUS_NAME = "Ontology.Header.GetNextConsensus"
	HEADER_GETMERKLEROOT_NAME    = "Ontology.Header.GetMerkleRoot"

	TRANSACTION_GETHASH_NAME       = "System.Transaction.GetHash"
	TRANSACTION_GETTYPE_NAME       = "Ontology.Transaction.GetType"
	TRANSACTION_GETATTRIBUTES_NAME = "Ontology.Transaction.GetAttributes"

	CONTRACT_CREATE_NAME            = "Ontology.Contract.Create"
	CONTRACT_MIGRATE_NAME           = "Ontology.Contract.Migrate"
	CONTRACT_GETSTORAGECONTEXT_NAME = "System.Contract.GetStorageContext"
	CONTRACT_DESTROY_NAME           = "System.Contract.Destroy"
	CONTRACT_GETSCRIPT_NAME         = "Ontology.Contract.GetScript"

	STORAGE_GET_NAME                = "System.Storage.Get"
	STORAGE_PUT_NAME                = "System.Storage.Put"
	STORAGE_DELETE_NAME             = "System.Storage.Delete"
	STORAGE_GETCONTEXT_NAME         = "System.Storage.GetContext"
	STORAGE_GETREADONLYCONTEXT_NAME = "System.Storage.GetReadOnlyContext"

	STORAGECONTEXT_ASREADONLY_NAME = "System.StorageContext.AsReadOnly"

	RUNTIME_GETTIME_NAME             = "System.Runtime.GetTime"
	RUNTIME_CHECKWITNESS_NAME        = "System.Runtime.CheckWitness"
	RUNTIME_NOTIFY_NAME              = "System.Runtime.Notify"
	RUNTIME_LOG_NAME                 = "System.Runtime.Log"
	RUNTIME_GETTRIGGER_NAME          = "System.Runtime.GetTrigger"
	RUNTIME_SERIALIZE_NAME           = "System.Runtime.Serialize"
	RUNTIME_DESERIALIZE_NAME         = "System.Runtime.Deserialize"
	RUNTIME_BASE58TOADDRESS_NAME     = "Ontology.Runtime.Base58ToAddress"
	RUNTIME_ADDRESSTOBASE58_NAME     = "Ontology.Runtime.AddressToBase58"
	RUNTIME_GETCURRENTBLOCKHASH_NAME = "Ontology.Runtime.GetCurrentBlockHash"
	RUNTIME_VERIFYMUTISIG_NAME       = "Ontology.Runtime.VerifyMutiSig"

	NATIVE_INVOKE_NAME = "Ontology.Native.Invoke"
	WASM_INVOKE_NAME   = "Ontology.Wasm.InvokeWasm"

	GETSCRIPTCONTAINER_NAME     = "System.ExecutionEngine.GetScriptContainer"
	GETEXECUTINGSCRIPTHASH_NAME = "System.ExecutionEngine.GetExecutingScriptHash"
	GETCALLINGSCRIPTHASH_NAME   = "System.ExecutionEngine.GetCallingScriptHash"
	GETENTRYSCRIPTHASH_NAME     = "System.ExecutionEngine.GetEntryScriptHash"

	APPCALL_NAME              = "APPCALL"
	TAILCALL_NAME             = "TAILCALL"
	SHA1_NAME                 = "SHA1"
	SHA256_NAME               = "SHA256"
	HASH160_NAME              = "HASH160"
	HASH256_NAME              = "HASH256"
	UINT_DEPLOY_CODE_LEN_NAME = "Deploy.Code.Gas"
	UINT_INVOKE_CODE_LEN_NAME = "Invoke.Code.Gas"

	GAS_TABLE = initGAS_TABLE()

	GAS_TABLE_KEYS = []string{
		BLOCKCHAIN_GETHEADER_NAME,
		BLOCKCHAIN_GETBLOCK_NAME,
		BLOCKCHAIN_GETTRANSACTION_NAME,
		BLOCKCHAIN_GETCONTRACT_NAME,
		CONTRACT_CREATE_NAME,
		CONTRACT_MIGRATE_NAME,
		STORAGE_GET_NAME,
		STORAGE_PUT_NAME,
		STORAGE_DELETE_NAME,
		RUNTIME_CHECKWITNESS_NAME,
		NATIVE_INVOKE_NAME,
		APPCALL_NAME,
		TAILCALL_NAME,
		SHA1_NAME,
		SHA256_NAME,
		HASH160_NAME,
		HASH256_NAME,
		UINT_DEPLOY_CODE_LEN_NAME,
		UINT_INVOKE_CODE_LEN_NAME,
		config.WASM_GAS_FACTOR,
	}

	INIT_GAS_TABLE = map[string]uint64{
		BLOCKCHAIN_GETHEADER_NAME:      BLOCKCHAIN_GETHEADER_GAS,
		BLOCKCHAIN_GETBLOCK_NAME:       BLOCKCHAIN_GETBLOCK_GAS,
		BLOCKCHAIN_GETTRANSACTION_NAME: BLOCKCHAIN_GETTRANSACTION_GAS,
		BLOCKCHAIN_GETCONTRACT_NAME:    BLOCKCHAIN_GETCONTRACT_GAS,
		CONTRACT_CREATE_NAME:           CONTRACT_CREATE_GAS,
		CONTRACT_MIGRATE_NAME:          CONTRACT_MIGRATE_GAS,
		STORAGE_GET_NAME:               STORAGE_GET_GAS,
		STORAGE_PUT_NAME:               STORAGE_PUT_GAS,
		STORAGE_DELETE_NAME:            STORAGE_DELETE_GAS,
		RUNTIME_CHECKWITNESS_NAME:      RUNTIME_CHECKWITNESS_GAS,
		NATIVE_INVOKE_NAME:             NATIVE_INVOKE_GAS,
		APPCALL_NAME:                   APPCALL_GAS,
		TAILCALL_NAME:                  TAILCALL_GAS,
		SHA1_NAME:                      SHA1_GAS,
		SHA256_NAME:                    SHA256_GAS,
		HASH160_NAME:                   HASH160_GAS,
		HASH256_NAME:                   HASH256_GAS,
		UINT_DEPLOY_CODE_LEN_NAME:      UINT_DEPLOY_CODE_LEN_GAS,
		UINT_INVOKE_CODE_LEN_NAME:      UINT_INVOKE_CODE_LEN_GAS,
	}
)
View Source
var (
	ServiceMapDeprecated = map[string]ServiceHandler{
		BLOCKCHAIN_GETTRANSACTIONHEIGHT_NAME: BlockChainGetTransactionHeight,

		BLOCKCHAIN_GETBLOCK_NAME:       BlockChainGetBlock,
		BLOCK_GETTRANSACTIONCOUNT_NAME: BlockGetTransactionCount,
		BLOCK_GETTRANSACTIONS_NAME:     BlockGetTransactions,
		BLOCK_GETTRANSACTION_NAME:      BlockGetTransaction,

		BLOCKCHAIN_GETHEADER_NAME:    BlockChainGetHeader,
		HEADER_GETPREVHASH_NAME:      HeaderGetPrevHash,
		HEADER_GETVERSION_NAME:       HeaderGetVersion,
		HEADER_GETNEXTCONSENSUS_NAME: HeaderGetNextConsensus,
		HEADER_GETMERKLEROOT_NAME:    HeaderGetMerkleRoot,
		HEADER_GETCONSENSUSDATA_NAME: HeaderGetConsensusData,

		BLOCKCHAIN_GETTRANSACTION_NAME: BlockChainGetTransaction,
		TRANSACTION_GETATTRIBUTES_NAME: TransactionGetAttributes,

		ATTRIBUTE_GETUSAGE_NAME: AttributeGetUsage,
		ATTRIBUTE_GETDATA_NAME:  AttributeGetData,

		BLOCKCHAIN_GETHEIGHT_NAME: BlockChainGetHeight,
	}

	ServiceMapNew = map[string]ServiceHandler{
		BLOCKCHAIN_GETHEIGHT_NAME: BlockChainGetHeightNew,
		BLOCKCHAIN_GETHEADER_NAME: BlockChainGetHeaderNew,
	}

	// Register all service for smart contract execute
	ServiceMap = map[string]ServiceHandler{
		BLOCKCHAIN_GETCONTRACT_NAME: BlockChainGetContract,

		HEADER_GETINDEX_NAME:     HeaderGetIndex,
		HEADER_GETHASH_NAME:      HeaderGetHash,
		HEADER_GETTIMESTAMP_NAME: HeaderGetTimestamp,

		GETSCRIPTCONTAINER_NAME:  GetCodeContainer,
		TRANSACTION_GETHASH_NAME: TransactionGetHash,
		TRANSACTION_GETTYPE_NAME: TransactionGetType,

		CONTRACT_CREATE_NAME:            ContractCreate,
		CONTRACT_MIGRATE_NAME:           ContractMigrate,
		CONTRACT_GETSTORAGECONTEXT_NAME: ContractGetStorageContext,
		CONTRACT_DESTROY_NAME:           ContractDestory,
		CONTRACT_GETSCRIPT_NAME:         ContractGetCode,
		RUNTIME_GETTIME_NAME:            RuntimeGetTime,
		RUNTIME_CHECKWITNESS_NAME:       RuntimeCheckWitness,
		RUNTIME_NOTIFY_NAME:             RuntimeNotify,
		RUNTIME_LOG_NAME:                RuntimeLog,
		RUNTIME_GETTRIGGER_NAME:         RuntimeGetTrigger,
		RUNTIME_SERIALIZE_NAME:          RuntimeSerialize,
		RUNTIME_DESERIALIZE_NAME:        RuntimeDeserialize,
		RUNTIME_VERIFYMUTISIG_NAME:      RuntimeVerifyMutiSig,
		NATIVE_INVOKE_NAME:              NativeInvoke,
		WASM_INVOKE_NAME:                WASMInvoke,
		STORAGE_GET_NAME:                StorageGet,
		STORAGE_PUT_NAME:                StoragePut,
		STORAGE_DELETE_NAME:             StorageDelete,
		STORAGE_GETCONTEXT_NAME:         StorageGetContext,
		STORAGE_GETREADONLYCONTEXT_NAME: StorageGetReadOnlyContext,
		STORAGECONTEXT_ASREADONLY_NAME:  StorageContextAsReadOnly,
		GETEXECUTINGSCRIPTHASH_NAME:     GetExecutingAddress,
		GETCALLINGSCRIPTHASH_NAME:       GetCallingAddress,
		GETENTRYSCRIPTHASH_NAME:         GetEntryAddress,

		RUNTIME_BASE58TOADDRESS_NAME:     RuntimeBase58ToAddress,
		RUNTIME_ADDRESSTOBASE58_NAME:     RuntimeAddressToBase58,
		RUNTIME_GETCURRENTBLOCKHASH_NAME: RuntimeGetCurrentBlockHash,
	}
)
View Source
var (
	ERR_CHECK_STACK_SIZE  = errors.NewErr("[NeoVmService] vm execution exceeded the max stack size!")
	ERR_EXECUTE_CODE      = errors.NewErr("[NeoVmService] vm execution code was invalid!")
	ERR_GAS_INSUFFICIENT  = errors.NewErr("[NeoVmService] insufficient gas for transaction!")
	VM_EXEC_STEP_EXCEED   = errors.NewErr("[NeoVmService] vm execution exceeded the step limit!")
	CONTRACT_NOT_EXIST    = errors.NewErr("[NeoVmService] the given contract does not exist!")
	DEPLOYCODE_TYPE_ERROR = errors.NewErr("[NeoVmService] deploy code type error!")
	VM_EXEC_FAULT         = errors.NewErr("[NeoVmService] vm execution encountered a state fault!")
)

Functions

func AttributeGetData

func AttributeGetData(service *NeoVmService, engine *vm.Executor) error

AttributeGetData put attribute's data to vm stack

func AttributeGetUsage

func AttributeGetUsage(service *NeoVmService, engine *vm.Executor) error

AttributeGetUsage put attribute's usage to vm stack

func BlockChainGetBlock

func BlockChainGetBlock(service *NeoVmService, engine *vm.Executor) error

BlockChainGetBlock put blockchain's block to vm stack

func BlockChainGetContract

func BlockChainGetContract(service *NeoVmService, engine *vm.Executor) error

BlockChainGetContract put blockchain's contract to vm stack

func BlockChainGetHeader

func BlockChainGetHeader(service *NeoVmService, engine *vm.Executor) error

BlockChainGetHeader put blockchain's header to vm stack

func BlockChainGetHeaderNew added in v1.10.0

func BlockChainGetHeaderNew(service *NeoVmService, engine *vm.Executor) error

func BlockChainGetHeight

func BlockChainGetHeight(service *NeoVmService, engine *vm.Executor) error

BlockChainGetHeight put blockchain's height to vm stack

func BlockChainGetHeightNew added in v1.10.0

func BlockChainGetHeightNew(service *NeoVmService, engine *vm.Executor) error

func BlockChainGetTransaction

func BlockChainGetTransaction(service *NeoVmService, engine *vm.Executor) error

BlockChainGetTransaction put blockchain's transaction to vm stack

func BlockChainGetTransactionHeight

func BlockChainGetTransactionHeight(service *NeoVmService, engine *vm.Executor) error

BlockChainGetTransactionHeight put transaction in block height to vm stack

func BlockGetTransaction

func BlockGetTransaction(service *NeoVmService, engine *vm.Executor) error

BlockGetTransaction put block's transaction to vm stack

func BlockGetTransactionCount

func BlockGetTransactionCount(service *NeoVmService, engine *vm.Executor) error

BlockGetTransactionCount put block's transactions count to vm stack

func BlockGetTransactions

func BlockGetTransactions(service *NeoVmService, engine *vm.Executor) error

BlockGetTransactions put block's transactions to vm stack

func ContractCreate

func ContractCreate(service *NeoVmService, engine *vm.Executor) error

ContractCreate create a new smart contract on blockchain, and put it to vm stack

func ContractDestory

func ContractDestory(service *NeoVmService, engine *vm.Executor) error

ContractDestory destroy a contract

func ContractGetCode

func ContractGetCode(service *NeoVmService, engine *vm.Executor) error

ContractGetCode put contract to vm stack

func ContractGetStorageContext

func ContractGetStorageContext(service *NeoVmService, engine *vm.Executor) error

ContractGetStorageContext put contract storage context to vm stack

func ContractMigrate

func ContractMigrate(service *NeoVmService, engine *vm.Executor) error

ContractMigrate migrate old smart contract to a new contract, and destroy old contract

func GasPrice

func GasPrice(gasTable map[string]uint64, engine *vm.Executor, name string) (uint64, error)

func GetCallingAddress

func GetCallingAddress(service *NeoVmService, engine *vm.Executor) error

GetExecutingAddress push previous context to vm stack

func GetCodeContainer

func GetCodeContainer(service *NeoVmService, engine *vm.Executor) error

GetCodeContainer push current transaction to vm stack

func GetEntryAddress

func GetEntryAddress(service *NeoVmService, engine *vm.Executor) error

GetExecutingAddress push entry call context to vm stack

func GetExecutingAddress

func GetExecutingAddress(service *NeoVmService, engine *vm.Executor) error

GetExecutingAddress push current context to vm stack

func HeaderGetConsensusData

func HeaderGetConsensusData(service *NeoVmService, engine *vm.Executor) error

HeaderGetConsensusData put header's consensus data to vm stack

func HeaderGetHash

func HeaderGetHash(service *NeoVmService, engine *vm.Executor) error

HeaderGetHash put header's hash to vm stack

func HeaderGetIndex

func HeaderGetIndex(service *NeoVmService, engine *vm.Executor) error

HeaderGetIndex put header's height to vm stack

func HeaderGetMerkleRoot

func HeaderGetMerkleRoot(service *NeoVmService, engine *vm.Executor) error

HeaderGetMerkleRoot put header's merkleroot to vm stack

func HeaderGetNextConsensus

func HeaderGetNextConsensus(service *NeoVmService, engine *vm.Executor) error

HeaderGetNextConsensus put header's consensus to vm stack

func HeaderGetPrevHash

func HeaderGetPrevHash(service *NeoVmService, engine *vm.Executor) error

HeaderGetPrevHash put header's prevblockhash to vm stack

func HeaderGetTimestamp

func HeaderGetTimestamp(service *NeoVmService, engine *vm.Executor) error

HeaderGetTimestamp put header's timestamp to vm stack

func HeaderGetVersion

func HeaderGetVersion(service *NeoVmService, engine *vm.Executor) error

HeaderGetVersion put header's version to vm stack

func NativeInvoke

func NativeInvoke(service *NeoVmService, engine *vm.Executor) error

func RuntimeAddressToBase58 added in v1.5.1

func RuntimeAddressToBase58(service *NeoVmService, engine *vm.Executor) error

func RuntimeBase58ToAddress added in v1.5.1

func RuntimeBase58ToAddress(service *NeoVmService, engine *vm.Executor) error

func RuntimeCheckWitness

func RuntimeCheckWitness(service *NeoVmService, engine *vm.Executor) error

RuntimeCheckWitness provide check permissions service If param address isn't exist in authorization list, check fail

func RuntimeDeserialize

func RuntimeDeserialize(service *NeoVmService, engine *vm.Executor) error

TODO check consistency with original implementation

func RuntimeGetCurrentBlockHash added in v1.5.2

func RuntimeGetCurrentBlockHash(service *NeoVmService, engine *vm.Executor) error

func RuntimeGetTime

func RuntimeGetTime(service *NeoVmService, engine *vm.Executor) error

HeaderGetNextConsensus put current block time to vm stack

func RuntimeGetTrigger

func RuntimeGetTrigger(service *NeoVmService, engine *vm.Executor) error

func RuntimeLog

func RuntimeLog(service *NeoVmService, engine *vm.Executor) error

RuntimeLog push smart contract execute event log to client

func RuntimeNotify

func RuntimeNotify(service *NeoVmService, engine *vm.Executor) error

RuntimeNotify put smart contract execute event notify to notifications

func RuntimeSerialize

func RuntimeSerialize(service *NeoVmService, engine *vm.Executor) error

func RuntimeVerifyMutiSig added in v1.7.0

func RuntimeVerifyMutiSig(service *NeoVmService, engine *vm.Executor) error

func StorageContextAsReadOnly added in v0.9.2

func StorageContextAsReadOnly(service *NeoVmService, engine *vm.Executor) error

func StorageDelete

func StorageDelete(service *NeoVmService, engine *vm.Executor) error

StorageDelete delete smart contract storage item from cache

func StorageGet

func StorageGet(service *NeoVmService, engine *vm.Executor) error

StorageGet push smart contract storage item from cache to vm stack

func StorageGetContext

func StorageGetContext(service *NeoVmService, engine *vm.Executor) error

StorageGetContext push smart contract storage context to vm stack

func StorageGetReadOnlyContext added in v0.9.2

func StorageGetReadOnlyContext(service *NeoVmService, engine *vm.Executor) error

func StoragePut

func StoragePut(service *NeoVmService, engine *vm.Executor) error

StoragePut put smart contract storage item to cache

func StoreGasCost

func StoreGasCost(gasTable map[string]uint64, engine *vm.Executor) (uint64, error)

func TransactionGetAttributes

func TransactionGetAttributes(service *NeoVmService, engine *vm.Executor) error

TransactionGetAttributes push transaction's attributes to vm stack

func TransactionGetHash

func TransactionGetHash(service *NeoVmService, engine *vm.Executor) error

GetExecutingAddress push transaction's hash to vm stack

func TransactionGetType

func TransactionGetType(service *NeoVmService, engine *vm.Executor) error

TransactionGetType push transaction's type to vm stack

func WASMInvoke added in v1.8.0

func WASMInvoke(service *NeoVmService, engine *vm.Executor) error

neovm contract call wasmvm contract

Types

type HeaderValue added in v1.10.0

type HeaderValue struct {
	Height    uint32
	Hash      common.Uint256
	Timestamp uint32
}

func (*HeaderValue) ToArray added in v1.10.0

func (self *HeaderValue) ToArray() []byte

type NeoVmService

type NeoVmService struct {
	Store         store.LedgerStore
	CacheDB       *storage.CacheDB
	ContextRef    context.ContextRef
	Notifications []*event.NotifyEventInfo
	Code          []byte
	GasTable      map[string]uint64
	Tx            *types.Transaction
	Time          uint32
	Height        uint32
	BlockHash     scommon.Uint256
	Engine        *vm.Executor
	PreExec       bool
}

NeoVmService is a struct for smart contract provide interop service

func (*NeoVmService) GetNeoContract added in v1.8.1

func (this *NeoVmService) GetNeoContract(address scommon.Address) ([]byte, error)

func (*NeoVmService) Invoke

func (this *NeoVmService) Invoke() (interface{}, error)

Invoke a smart contract

func (*NeoVmService) SystemCall

func (this *NeoVmService) SystemCall(engine *vm.Executor) error

SystemCall provide register service for smart contract to interaction with blockchain

type ServiceHandler added in v1.10.0

type ServiceHandler func(service *NeoVmService, engine *vm.Executor) error

type StorageContext

type StorageContext struct {
	Address    common.Address
	IsReadOnly bool
}

StorageContext store smart contract address

func NewStorageContext

func NewStorageContext(address common.Address) *StorageContext

NewStorageContext return a new smart contract storage context

func (*StorageContext) ToArray

func (this *StorageContext) ToArray() []byte

ToArray return address byte array

Jump to

Keyboard shortcuts

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