build_nef

Function build_nef 

Source
pub fn build_nef(script: &[u8], compiler: &str) -> Result<Vec<u8>, String>
Expand description

Build a NEF (Neo Executable Format) file from raw NeoVM bytecode.

The implementation follows the Neo N3 specification:

  • Magic header NEF3
  • Compiler identifier (fixed 64 bytes, UTF-8, padded with zeros)
  • Source URL (varstring, max 256 bytes)
  • Reserved byte (must be 0)
  • Method token table (varint count + entries, max 128 entries)
  • Reserved 2 bytes (must be 0)
  • Script payload (varbytes)
  • Checksum (first four bytes of double SHA256 over all previous bytes)

§Arguments

  • script - The NeoVM bytecode
  • compiler - Compiler identifier string (max 64 bytes)

§Returns

Complete NEF file as byte vector