Skip to main content

Module neo

Module neo 

Source
Expand description

Neo N3 Utilities Module

Provides Neo N3 blockchain-specific utilities for NEF (Neo Executable Format) generation and method tokens.

§Key Components

§NEF Format

The Neo Executable Format (NEF) is the standard container for Neo N3 smart contracts, containing bytecode, metadata, and optional method tokens.

Structs§

MethodToken
Method token for cross-contract calls in NEF format.
ParsedNef
Result of parsing a NEF file via parse_nef.

Constants§

MAX_CALL_FLAGS
Bitmask of valid CallFlags values (CallFlags.All). Used to validate call flags in method tokens.
MAX_METHOD_TOKENS
Maximum number of method tokens allowed in a single NEF file. Method tokens enable optimized cross-contract calls. The NEF3 spec permits up to 512 entries; real-world contracts compiled by Neo.Compiler.CSharp / Neow3j can exceed 128.
MAX_SCRIPT_SIZE
Maximum script size in NEF (512 KB)
MAX_TOKEN_METHOD_LENGTH
Maximum byte length of a method name stored in a NEF method token. Method names exceeding this limit will be truncated.
NEF_HEADER_SIZE
NEF header size in bytes
NEF_MAGIC
NEF file magic bytes (“NEF3”)
NEF_SOURCE_MAX_BYTES
Publicly exposed maximum byte length for the NEF source field.

Functions§

build_nef
Build a NEF (Neo Executable Format) file from raw NeoVM bytecode.
build_nef_with_tokens
Build a NEF file with method tokens for cross-contract calls.
clamp_nef_source
Clamp a NEF source string to the maximum allowed byte length, preserving UTF-8 boundaries.
clamp_nef_source_with_flag
Clamp a NEF source string and report whether truncation occurred.
compute_contract_hash
Compute the Neo N3 contract hash for a deployment transaction.
format_uint160_hex_be
Format a Neo UInt160 (little-endian bytes) as a 0x-prefixed big-endian hex string.
parse_nef
Parse a Neo N3 NEF3 file produced by build_nef_with_tokens.
parse_uint160_hex_be
Parse a Neo UInt160 from a 0x-prefixed (or raw) big-endian hex string.