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.

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.
MAX_SCRIPT_SIZE
Maximum script size in NEF (512 KB)
MAX_SOURCE_LENGTH πŸ”’
Maximum byte length for the NEF source field (URL or identifier).
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.
calculate_checksum πŸ”’
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.
clamp_utf8 πŸ”’
compute_contract_hash
Compute the Neo N3 contract hash for a deployment transaction.
emit_push_bytes πŸ”’
emit_push_u32 πŸ”’
format_uint160_hex_be
Format a Neo UInt160 (little-endian bytes) as a 0x-prefixed big-endian hex string.
hash160 πŸ”’
parse_uint160_hex_be
Parse a Neo UInt160 from a 0x-prefixed (or raw) big-endian hex string.
write_fixed_string πŸ”’
write_varbytes πŸ”’
write_varint πŸ”’
write_varstring πŸ”’