Skip to content

Section format

A Section is an indexed chunk of a binary file of dynamic length, which is defined as follows:

Section

::= id:0xnn len:0xnn×4 data:0xnn×len

(len is big-endian)

The id of a section is a single, leading byte that identifies the section. The section's length then follows and is given as a 32-bit, big-endian, unsigned integer. The byte length of the following dynamically sized data of the section should match this length.

Wasm contract result format

The format used by Wasm contracts to return results is a section format defined as follows:

Result

::= section0:Section ... sectionn:Section

Note that sections must occur in order of increasing ids. Two ids are "well-known" and specially handled by the interpreter:

  • 0x01: Stores event information.
  • 0x02: Stores state.

Section ids 0x00 to 0x0F are reserved for "well-known" usage. All others are passed through the interpreter without modification.

ZKWA format

ZK-contracts have their own binary file format with the extension ".zkwa" that contains their compiled WASM code and ZK-circuit byte code. This is a section format defined as:

ZKWA

::= section0:Section section1:Section

Note that sections must occur in order of increasing ids. The .zkwa format consists of two sections indexed by the following ids:

  • 0x02: The contract's WASM code.
  • 0x03: The contract's ZK-circuit byte code.

Partisia Blockchain Contract File

The file extension of Partisia Blockchain Contract Files is written as ".pbc". This is a section format defined as:

PbcFile

::= PbcHeader: 0xnn×4 section0:Section ... sectionn:Section

(The header is "PBSC" in ASCII)

Note that sections must occur in order of increasing ids. The .pbc format can consist of up to three sections indexed by the following ids:

  • 0x01: The contract's ABI.
  • 0x02: The contract's WASM code.
  • 0x03: The contract's ZK-circuit byte code.

Partisia All Rights Reserved © 2023