Expand description
Core primitive types used throughout arknet.
These types are the on-the-wire and on-chain vocabulary. Layout must stay stable: any breaking change is a protocol hard fork.
§Crypto agility
Signatures, public keys, and KEM keys carry a SignatureScheme /
KemScheme / VrfScheme tag in their first byte. At launch only the
0x01 variants (Ed25519, X25519, Ristretto255 VRF, BLS12-381 threshold)
are implemented, but the wire format reserves the remaining space so a
governance-scheduled post-quantum migration can ship without breaking
transaction encoding.
See docs/SECURITY.md §4 (Cryptographic Primitives) and §12 (PQ Migration).
Structs§
- Address
- 20-byte account address. Derived as
blake3(pubkey_bytes)[0..20]. - AppHash
- Application-layer state digest after applying a block’s transactions.
- Block
Hash - Block hash. Computed over a canonical [
BlockHeader] borsh encoding. - Channel
Id - Payment channel identifier.
- JobId
- Inference job identifier. Unique per job.
- NodeId
- Node identifier — 32-byte hash of the node’s consensus pubkey.
- PoolId
- Computation pool identifier —
hash(model_id || quantization)[0..16]. - PubKey
- A scheme-tagged public key.
- Role
Bitmap - Bitmap of active roles on a node. Multiple roles can be enabled simultaneously.
- Signature
- A scheme-tagged signature.
- State
Root - Merkle root of the state trie. Included in every [
BlockHeader]. - TeeCapability
- On-chain TEE capability record for a compute node.
- TxHash
- Transaction hash. Distinct newtype from block hashes to prevent cross-type
collision attacks — see
DOMAIN_TX/DOMAIN_BLOCK.
Enums§
- KemScheme
- Key-encapsulation-mechanism (KEM) identifier. Used for prompt encryption.
- Signature
Scheme - Signature scheme identifier. First byte of every encoded
Signature/PubKey. - TeePlatform
- Trusted Execution Environment platform identifier.
- VrfScheme
- Verifiable Random Function scheme — used for unpredictable verifier selection.
Constants§
- ARK_
SUPPLY_ CAP - Protocol-level hard cap on ARK supply (1B ARK).
- ATOMS_
PER_ ARK - Atomic units per whole ARK token.
- DOMAIN_
BLOCK - Domain tag for block (header) hashes. See
DOMAIN_TX. - DOMAIN_
RECEIPT_ ROOT - Domain tag for block-body receipt Merkle roots.
- DOMAIN_
TX - Domain tag for transaction hashes. Prepended to borsh-encoded bytes before
hashing so that
hash(tx) != hash(block)even when their borsh happens to collide. - DOMAIN_
TX_ ROOT - Domain tag for block-body tx Merkle roots.
- MAX_
TEE_ QUOTE_ BYTES - Maximum size of a TEE attestation quote (16 KiB). Intel TDX quotes are typically ~5 KB; AMD SEV-SNP reports ~4 KB. This cap prevents abuse while leaving room for certificate chains.
Type Aliases§
- Amount
- Token amount in atomic units. 1 ARK =
ATOMS_PER_ARKark_atom(9 decimals). - Gas
- Gas units consumed by a transaction. Fee markets price in
ark_atom/gas. - Hash256
- 256-bit digest. SHA-256 on-chain, BLAKE3 for fast local hashing.
- Height
- Block height.
- Nonce
- Per-account transaction counter. Increments by 1 with each committed tx from the same sender; replay is detected at the state-application layer.
- Timestamp
- Unix timestamp in milliseconds.