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/>.
Index ¶
- Variables
- func AttributeGetData(service *NeoVmService, engine *vm.ExecutionEngine) error
- func AttributeGetUsage(service *NeoVmService, engine *vm.ExecutionEngine) error
- func BlockChainGetBlock(service *NeoVmService, engine *vm.ExecutionEngine) error
- func BlockChainGetContract(service *NeoVmService, engine *vm.ExecutionEngine) error
- func BlockChainGetHeader(service *NeoVmService, engine *vm.ExecutionEngine) error
- func BlockChainGetHeight(service *NeoVmService, engine *vm.ExecutionEngine) error
- func BlockChainGetTransaction(service *NeoVmService, engine *vm.ExecutionEngine) error
- func BlockChainGetTransactionHeight(service *NeoVmService, engine *vm.ExecutionEngine) error
- func BlockGetTransaction(service *NeoVmService, engine *vm.ExecutionEngine) error
- func BlockGetTransactionCount(service *NeoVmService, engine *vm.ExecutionEngine) error
- func BlockGetTransactions(service *NeoVmService, engine *vm.ExecutionEngine) error
- func BuildParamToNative(bf *bytes.Buffer, item types.StackItems) error
- func CircularRefAndDepthDetection(value vmtypes.StackItems) bool
- func ContractCreate(service *NeoVmService, engine *vm.ExecutionEngine) error
- func ContractDestory(service *NeoVmService, engine *vm.ExecutionEngine) error
- func ContractGetCode(service *NeoVmService, engine *vm.ExecutionEngine) error
- func ContractGetStorageContext(service *NeoVmService, engine *vm.ExecutionEngine) error
- func ContractMigrate(service *NeoVmService, engine *vm.ExecutionEngine) error
- func DeserializeStackItem(r io.Reader) (items vmtypes.StackItems, err error)
- func GasPrice(engine *vm.ExecutionEngine, name string) (uint64, error)
- func GetCallingAddress(service *NeoVmService, engine *vm.ExecutionEngine) error
- func GetCodeContainer(service *NeoVmService, engine *vm.ExecutionEngine) error
- func GetEntryAddress(service *NeoVmService, engine *vm.ExecutionEngine) error
- func GetExecutingAddress(service *NeoVmService, engine *vm.ExecutionEngine) error
- func HeaderGetConsensusData(service *NeoVmService, engine *vm.ExecutionEngine) error
- func HeaderGetHash(service *NeoVmService, engine *vm.ExecutionEngine) error
- func HeaderGetIndex(service *NeoVmService, engine *vm.ExecutionEngine) error
- func HeaderGetMerkleRoot(service *NeoVmService, engine *vm.ExecutionEngine) error
- func HeaderGetNextConsensus(service *NeoVmService, engine *vm.ExecutionEngine) error
- func HeaderGetPrevHash(service *NeoVmService, engine *vm.ExecutionEngine) error
- func HeaderGetTimestamp(service *NeoVmService, engine *vm.ExecutionEngine) error
- func HeaderGetVersion(service *NeoVmService, engine *vm.ExecutionEngine) error
- func NativeInvoke(service *NeoVmService, engine *vm.ExecutionEngine) error
- func RuntimeAddressToBase58(service *NeoVmService, engine *vm.ExecutionEngine) error
- func RuntimeBase58ToAddress(service *NeoVmService, engine *vm.ExecutionEngine) error
- func RuntimeCheckWitness(service *NeoVmService, engine *vm.ExecutionEngine) error
- func RuntimeDeserialize(service *NeoVmService, engine *vm.ExecutionEngine) error
- func RuntimeGetCurrentBlockHash(service *NeoVmService, engine *vm.ExecutionEngine) error
- func RuntimeGetTime(service *NeoVmService, engine *vm.ExecutionEngine) error
- func RuntimeGetTrigger(service *NeoVmService, engine *vm.ExecutionEngine) error
- func RuntimeLog(service *NeoVmService, engine *vm.ExecutionEngine) error
- func RuntimeNotify(service *NeoVmService, engine *vm.ExecutionEngine) error
- func RuntimeSerialize(service *NeoVmService, engine *vm.ExecutionEngine) error
- func RuntimeVerifyMutiSig(service *NeoVmService, engine *vm.ExecutionEngine) error
- func SerializeStackItem(item vmtypes.StackItems) ([]byte, error)
- func StorageContextAsReadOnly(service *NeoVmService, engine *vm.ExecutionEngine) error
- func StorageDelete(service *NeoVmService, engine *vm.ExecutionEngine) error
- func StorageGet(service *NeoVmService, engine *vm.ExecutionEngine) error
- func StorageGetContext(service *NeoVmService, engine *vm.ExecutionEngine) error
- func StorageGetReadOnlyContext(service *NeoVmService, engine *vm.ExecutionEngine) error
- func StoragePut(service *NeoVmService, engine *vm.ExecutionEngine) error
- func StoreGasCost(engine *vm.ExecutionEngine) (uint64, error)
- func TransactionGetAttributes(service *NeoVmService, engine *vm.ExecutionEngine) error
- func TransactionGetHash(service *NeoVmService, engine *vm.ExecutionEngine) error
- func TransactionGetType(service *NeoVmService, engine *vm.ExecutionEngine) error
- type Execute
- type NeoVmService
- type Service
- type StorageContext
- type Validator
Constants ¶
This section is empty.
Variables ¶
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 int = 1024 METHOD_LENGTH_LIMIT int = 1024 DUPLICATE_STACK_SIZE int = 1024 * 2 VM_STEP_LIMIT int = 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" 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, } 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, } )
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!") )
var (
BYTE_ZERO_20 = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
)
var ( // Register all service for smart contract execute ServiceMap = map[string]Service{ ATTRIBUTE_GETUSAGE_NAME: {Execute: AttributeGetUsage, Validator: validatorAttribute}, ATTRIBUTE_GETDATA_NAME: {Execute: AttributeGetData, Validator: validatorAttribute}, BLOCK_GETTRANSACTIONCOUNT_NAME: {Execute: BlockGetTransactionCount, Validator: validatorBlock}, BLOCK_GETTRANSACTIONS_NAME: {Execute: BlockGetTransactions, Validator: validatorBlock}, BLOCK_GETTRANSACTION_NAME: {Execute: BlockGetTransaction, Validator: validatorBlockTransaction}, BLOCKCHAIN_GETHEIGHT_NAME: {Execute: BlockChainGetHeight}, BLOCKCHAIN_GETHEADER_NAME: {Execute: BlockChainGetHeader, Validator: validatorBlockChainHeader}, BLOCKCHAIN_GETBLOCK_NAME: {Execute: BlockChainGetBlock, Validator: validatorBlockChainBlock}, BLOCKCHAIN_GETTRANSACTION_NAME: {Execute: BlockChainGetTransaction, Validator: validatorBlockChainTransaction}, BLOCKCHAIN_GETCONTRACT_NAME: {Execute: BlockChainGetContract, Validator: validatorBlockChainContract}, BLOCKCHAIN_GETTRANSACTIONHEIGHT_NAME: {Execute: BlockChainGetTransactionHeight}, HEADER_GETINDEX_NAME: {Execute: HeaderGetIndex, Validator: validatorHeader}, HEADER_GETHASH_NAME: {Execute: HeaderGetHash, Validator: validatorHeader}, HEADER_GETVERSION_NAME: {Execute: HeaderGetVersion, Validator: validatorHeader}, HEADER_GETPREVHASH_NAME: {Execute: HeaderGetPrevHash, Validator: validatorHeader}, HEADER_GETTIMESTAMP_NAME: {Execute: HeaderGetTimestamp, Validator: validatorHeader}, HEADER_GETCONSENSUSDATA_NAME: {Execute: HeaderGetConsensusData, Validator: validatorHeader}, HEADER_GETNEXTCONSENSUS_NAME: {Execute: HeaderGetNextConsensus, Validator: validatorHeader}, HEADER_GETMERKLEROOT_NAME: {Execute: HeaderGetMerkleRoot, Validator: validatorHeader}, TRANSACTION_GETHASH_NAME: {Execute: TransactionGetHash, Validator: validatorTransaction}, TRANSACTION_GETTYPE_NAME: {Execute: TransactionGetType, Validator: validatorTransaction}, TRANSACTION_GETATTRIBUTES_NAME: {Execute: TransactionGetAttributes, Validator: validatorTransaction}, CONTRACT_CREATE_NAME: {Execute: ContractCreate}, CONTRACT_MIGRATE_NAME: {Execute: ContractMigrate}, CONTRACT_GETSTORAGECONTEXT_NAME: {Execute: ContractGetStorageContext}, CONTRACT_DESTROY_NAME: {Execute: ContractDestory}, CONTRACT_GETSCRIPT_NAME: {Execute: ContractGetCode, Validator: validatorGetCode}, RUNTIME_GETTIME_NAME: {Execute: RuntimeGetTime}, RUNTIME_CHECKWITNESS_NAME: {Execute: RuntimeCheckWitness, Validator: validatorCheckWitness}, RUNTIME_NOTIFY_NAME: {Execute: RuntimeNotify, Validator: validatorNotify}, RUNTIME_LOG_NAME: {Execute: RuntimeLog, Validator: validatorLog}, RUNTIME_GETTRIGGER_NAME: {Execute: RuntimeGetTrigger}, RUNTIME_SERIALIZE_NAME: {Execute: RuntimeSerialize, Validator: validatorSerialize}, RUNTIME_DESERIALIZE_NAME: {Execute: RuntimeDeserialize, Validator: validatorDeserialize}, RUNTIME_VERIFYMUTISIG_NAME: {Execute: RuntimeVerifyMutiSig}, NATIVE_INVOKE_NAME: {Execute: NativeInvoke}, STORAGE_GET_NAME: {Execute: StorageGet}, STORAGE_PUT_NAME: {Execute: StoragePut}, STORAGE_DELETE_NAME: {Execute: StorageDelete}, STORAGE_GETCONTEXT_NAME: {Execute: StorageGetContext}, STORAGE_GETREADONLYCONTEXT_NAME: {Execute: StorageGetReadOnlyContext}, STORAGECONTEXT_ASREADONLY_NAME: {Execute: StorageContextAsReadOnly, Validator: validatorContextAsReadOnly}, GETSCRIPTCONTAINER_NAME: {Execute: GetCodeContainer}, GETEXECUTINGSCRIPTHASH_NAME: {Execute: GetExecutingAddress}, GETCALLINGSCRIPTHASH_NAME: {Execute: GetCallingAddress}, GETENTRYSCRIPTHASH_NAME: {Execute: GetEntryAddress}, RUNTIME_BASE58TOADDRESS_NAME: {Execute: RuntimeBase58ToAddress}, RUNTIME_ADDRESSTOBASE58_NAME: {Execute: RuntimeAddressToBase58}, RUNTIME_GETCURRENTBLOCKHASH_NAME: {Execute: RuntimeGetCurrentBlockHash}, } )
Functions ¶
func AttributeGetData ¶
func AttributeGetData(service *NeoVmService, engine *vm.ExecutionEngine) error
AttributeGetData put attribute's data to vm stack
func AttributeGetUsage ¶
func AttributeGetUsage(service *NeoVmService, engine *vm.ExecutionEngine) error
AttributeGetUsage put attribute's usage to vm stack
func BlockChainGetBlock ¶
func BlockChainGetBlock(service *NeoVmService, engine *vm.ExecutionEngine) error
BlockChainGetBlock put blockchain's block to vm stack
func BlockChainGetContract ¶
func BlockChainGetContract(service *NeoVmService, engine *vm.ExecutionEngine) error
BlockChainGetContract put blockchain's contract to vm stack
func BlockChainGetHeader ¶
func BlockChainGetHeader(service *NeoVmService, engine *vm.ExecutionEngine) error
BlockChainGetHeader put blockchain's header to vm stack
func BlockChainGetHeight ¶
func BlockChainGetHeight(service *NeoVmService, engine *vm.ExecutionEngine) error
BlockChainGetHeight put blockchain's height to vm stack
func BlockChainGetTransaction ¶
func BlockChainGetTransaction(service *NeoVmService, engine *vm.ExecutionEngine) error
BlockChainGetTransaction put blockchain's transaction to vm stack
func BlockChainGetTransactionHeight ¶
func BlockChainGetTransactionHeight(service *NeoVmService, engine *vm.ExecutionEngine) error
BlockChainGetTransactionHeight put transaction in block height to vm stack
func BlockGetTransaction ¶
func BlockGetTransaction(service *NeoVmService, engine *vm.ExecutionEngine) error
BlockGetTransaction put block's transaction to vm stack
func BlockGetTransactionCount ¶
func BlockGetTransactionCount(service *NeoVmService, engine *vm.ExecutionEngine) error
BlockGetTransactionCount put block's transactions count to vm stack
func BlockGetTransactions ¶
func BlockGetTransactions(service *NeoVmService, engine *vm.ExecutionEngine) error
BlockGetTransactions put block's transactions to vm stack
func BuildParamToNative ¶
func BuildParamToNative(bf *bytes.Buffer, item types.StackItems) error
func CircularRefAndDepthDetection ¶
func CircularRefAndDepthDetection(value vmtypes.StackItems) bool
func ContractCreate ¶
func ContractCreate(service *NeoVmService, engine *vm.ExecutionEngine) error
ContractCreate create a new smart contract on blockchain, and put it to vm stack
func ContractDestory ¶
func ContractDestory(service *NeoVmService, engine *vm.ExecutionEngine) error
ContractDestory destroy a contract
func ContractGetCode ¶
func ContractGetCode(service *NeoVmService, engine *vm.ExecutionEngine) error
ContractGetCode put contract to vm stack
func ContractGetStorageContext ¶
func ContractGetStorageContext(service *NeoVmService, engine *vm.ExecutionEngine) error
ContractGetStorageContext put contract storage context to vm stack
func ContractMigrate ¶
func ContractMigrate(service *NeoVmService, engine *vm.ExecutionEngine) error
ContractMigrate migrate old smart contract to a new contract, and destroy old contract
func DeserializeStackItem ¶
func DeserializeStackItem(r io.Reader) (items vmtypes.StackItems, err error)
func GetCallingAddress ¶
func GetCallingAddress(service *NeoVmService, engine *vm.ExecutionEngine) error
GetExecutingAddress push previous context to vm stack
func GetCodeContainer ¶
func GetCodeContainer(service *NeoVmService, engine *vm.ExecutionEngine) error
GetCodeContainer push current transaction to vm stack
func GetEntryAddress ¶
func GetEntryAddress(service *NeoVmService, engine *vm.ExecutionEngine) error
GetExecutingAddress push entry call context to vm stack
func GetExecutingAddress ¶
func GetExecutingAddress(service *NeoVmService, engine *vm.ExecutionEngine) error
GetExecutingAddress push current context to vm stack
func HeaderGetConsensusData ¶
func HeaderGetConsensusData(service *NeoVmService, engine *vm.ExecutionEngine) error
HeaderGetConsensusData put header's consensus data to vm stack
func HeaderGetHash ¶
func HeaderGetHash(service *NeoVmService, engine *vm.ExecutionEngine) error
HeaderGetHash put header's hash to vm stack
func HeaderGetIndex ¶
func HeaderGetIndex(service *NeoVmService, engine *vm.ExecutionEngine) error
HeaderGetIndex put header's height to vm stack
func HeaderGetMerkleRoot ¶
func HeaderGetMerkleRoot(service *NeoVmService, engine *vm.ExecutionEngine) error
HeaderGetMerkleRoot put header's merkleroot to vm stack
func HeaderGetNextConsensus ¶
func HeaderGetNextConsensus(service *NeoVmService, engine *vm.ExecutionEngine) error
HeaderGetNextConsensus put header's consensus to vm stack
func HeaderGetPrevHash ¶
func HeaderGetPrevHash(service *NeoVmService, engine *vm.ExecutionEngine) error
HeaderGetPrevHash put header's prevblockhash to vm stack
func HeaderGetTimestamp ¶
func HeaderGetTimestamp(service *NeoVmService, engine *vm.ExecutionEngine) error
HeaderGetTimestamp put header's timestamp to vm stack
func HeaderGetVersion ¶
func HeaderGetVersion(service *NeoVmService, engine *vm.ExecutionEngine) error
HeaderGetVersion put header's version to vm stack
func NativeInvoke ¶
func NativeInvoke(service *NeoVmService, engine *vm.ExecutionEngine) error
func RuntimeAddressToBase58 ¶
func RuntimeAddressToBase58(service *NeoVmService, engine *vm.ExecutionEngine) error
func RuntimeBase58ToAddress ¶
func RuntimeBase58ToAddress(service *NeoVmService, engine *vm.ExecutionEngine) error
func RuntimeCheckWitness ¶
func RuntimeCheckWitness(service *NeoVmService, engine *vm.ExecutionEngine) 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.ExecutionEngine) error
func RuntimeGetCurrentBlockHash ¶
func RuntimeGetCurrentBlockHash(service *NeoVmService, engine *vm.ExecutionEngine) error
func RuntimeGetTime ¶
func RuntimeGetTime(service *NeoVmService, engine *vm.ExecutionEngine) error
HeaderGetNextConsensus put current block time to vm stack
func RuntimeGetTrigger ¶
func RuntimeGetTrigger(service *NeoVmService, engine *vm.ExecutionEngine) error
func RuntimeLog ¶
func RuntimeLog(service *NeoVmService, engine *vm.ExecutionEngine) error
RuntimeLog push smart contract execute event log to client
func RuntimeNotify ¶
func RuntimeNotify(service *NeoVmService, engine *vm.ExecutionEngine) error
RuntimeNotify put smart contract execute event notify to notifications
func RuntimeSerialize ¶
func RuntimeSerialize(service *NeoVmService, engine *vm.ExecutionEngine) error
func RuntimeVerifyMutiSig ¶
func RuntimeVerifyMutiSig(service *NeoVmService, engine *vm.ExecutionEngine) error
func SerializeStackItem ¶
func SerializeStackItem(item vmtypes.StackItems) ([]byte, error)
func StorageContextAsReadOnly ¶
func StorageContextAsReadOnly(service *NeoVmService, engine *vm.ExecutionEngine) error
func StorageDelete ¶
func StorageDelete(service *NeoVmService, engine *vm.ExecutionEngine) error
StorageDelete delete smart contract storage item from cache
func StorageGet ¶
func StorageGet(service *NeoVmService, engine *vm.ExecutionEngine) error
StorageGet push smart contract storage item from cache to vm stack
func StorageGetContext ¶
func StorageGetContext(service *NeoVmService, engine *vm.ExecutionEngine) error
StorageGetContext push smart contract storage context to vm stack
func StorageGetReadOnlyContext ¶
func StorageGetReadOnlyContext(service *NeoVmService, engine *vm.ExecutionEngine) error
func StoragePut ¶
func StoragePut(service *NeoVmService, engine *vm.ExecutionEngine) error
StoragePut put smart contract storage item to cache
func StoreGasCost ¶
func StoreGasCost(engine *vm.ExecutionEngine) (uint64, error)
func TransactionGetAttributes ¶
func TransactionGetAttributes(service *NeoVmService, engine *vm.ExecutionEngine) error
TransactionGetAttributes push transaction's attributes to vm stack
func TransactionGetHash ¶
func TransactionGetHash(service *NeoVmService, engine *vm.ExecutionEngine) error
GetExecutingAddress push transaction's hash to vm stack
func TransactionGetType ¶
func TransactionGetType(service *NeoVmService, engine *vm.ExecutionEngine) error
TransactionGetType push transaction's type to vm stack
Types ¶
type Execute ¶
type Execute func(service *NeoVmService, engine *vm.ExecutionEngine) error
type NeoVmService ¶
type NeoVmService struct { Store store.LedgerStore CacheDB *storage.CacheDB ContextRef context.ContextRef Notifications []*event.NotifyEventInfo Code []byte Tx *types.Transaction Time uint32 Height uint32 BlockHash scommon.Uint256 Engine *vm.ExecutionEngine PreExec bool }
NeoVmService is a struct for smart contract provide interop service
func (*NeoVmService) Invoke ¶
func (this *NeoVmService) Invoke() (interface{}, error)
Invoke a smart contract
func (*NeoVmService) SystemCall ¶
func (this *NeoVmService) SystemCall(engine *vm.ExecutionEngine) error
SystemCall provide register service for smart contract to interaction with blockchain
type StorageContext ¶
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
type Validator ¶
type Validator func(engine *vm.ExecutionEngine) error