Skip to content

Execution Context

This page maps Solidity execution globals to the Neo N3 runtime calls or native contract calls used by Neo DevPack for Solidity.

Block and Transaction Context

Solidity / EVMNeo N3 MappingFidelity
block.timestampSystem.Runtime.GetTime, normalized from milliseconds to secondsExact enough for Solidity time logic.
block.numberLedger.currentIndex native contract callExact block height mapping.
block.chainidNeo network magicCompile-time network value.
blockhash(n)Ledger.getBlockHash(n)Neo block hash, not Ethereum block hash.
block.coinbaseaddress(0)Approximate; Neo dBFT has no miner account.
block.difficulty / block.prevrandaoRuntime.getRandom()Approximate; randomness model differs.
block.gaslimitPolicy.getExecFeeFactor()Approximate; Neo fee accounting differs.
block.basefeePolicy.getFeePerByte()Approximate; Neo does not use EIP-1559 base fee semantics.
tx.originFirst transaction signer script hashAvailable, but do not use for authorization.
tx.gaspricePolicy.getFeePerByte()Approximate fee signal.

Message Context

Solidity / EVMNeo N3 MappingFidelity
msg.senderSystem.Runtime.GetCallingScriptHashCaller script hash or transaction signer, depending on invocation path; internal/self-offset routes can inject a direct-caller override.
msg.valuePayment callback amount parameterOnly meaningful inside NEP-17/NEP-11 payment callbacks.
msg.dataCurrent selector plus ABI-encoded argumentsApproximate outside payment callbacks; callback data is typed.
msg.sigCurrent function selectorApproximate for internal-call semantics.

Contract Context

Solidity / EVMNeo N3 MappingFidelity
this / address(this)System.Runtime.GetExecutingScriptHashExact current contract script hash.
gasleft()System.Runtime.GasLeftNeo GAS remaining for the current invocation.
address.codeContractManagement.getContract() script bytesEmpty for non-contract addresses.
address.codehashContract script hashbytes32(0) for non-contract addresses.
selfdestruct(addr)ContractManagement.destroy()Permanent destroy, no refund semantics.

Authorization Note

On Ethereum, many contracts gate privileged paths with msg.sender. On Neo, state-changing user authority should normally be checked with Runtime.checkWitness(address). msg.sender identifies the immediate caller, while witnesses prove which account authorized the transaction.

More Detail

MIT Licensed