Skip to content

Cheatsheet

Order of Precedence of Operators

Neo DevPack for Solidity exactly mimics the Solidity operator precedence rules.

Global Variables Comparison

A quick reference for mapping EVM global context to NeoVM intrinsics:

For a guided, topic-by-topic version of these mappings, see Semantic Mapping.

EVM GlobalNeoVM EquivalentNotes
msg.senderRuntime.getCallingScriptHash()Accurate mapping.
msg.valueamount in onNEP17PaymentOnly available during transfer hooks.
msg.dataselector || abi.encode(args)In callbacks maps to typed data param; outside produces selector + encoded args.
msg.sigCurrent function selectorApproximated; internal calls differ.
block.timestampRuntime.getTime()Seconds since epoch.
block.numberLedger.currentIndex()Blockchain height.
block.coinbaseaddress(0)dBFT has no miner.
block.sha3Ledger.currentHashDeprecated in Solidity 0.8+.
tx.originFirst signer hashNot recommended for auth. Use witnesses.
thisRuntime.getExecutingScriptHash()Accurate mapping.
address.balanceGAS.balanceOf(address)Auto-mapped to GAS token.
address.transfer()GAS.transfer(...)Auto-mapped.
gasleft()Runtime.gasLeft()Execution GAS budget.

Cryptography Intrinsics

EVM HashNeo Native Contract Call
keccak256(data)CryptoLib.keccak256(data)
sha256(data)CryptoLib.sha256(data)
ecrecover(hash, v, r, s)CryptoLib.recoverSecp256K1(...), then keccak256 + rightmost 20-byte address derivation

Security Best Practices

  1. Authorization: Prefer Runtime.checkWitness(address) over msg.sender == address.
  2. Wildcards: Always compile with --deny-wildcard-contracts and --deny-wildcard-methods for production to restrict the manifest.
  3. Values: NeoVM stores integers as BigInteger, but Neo DevPack for Solidity emits Solidity 0.8 fixed-width overflow guards outside unchecked blocks. Use unchecked only when wraparound is intentional and tested.
  4. Upgrades: Use ContractManagement.update() instead of Ethereum-style proxy contracts. Proxy storage delegates are not supported.

MIT Licensed