Skip to main content
The console crate provides the foundational plaintext types and data structures for the snarkVM virtual machine. It contains implementations for accounts, cryptographic primitives, program types, and network configurations.

Architecture

The console module is organized into several sub-crates:
  • account - Account types and cryptographic key management
  • types - Primitive data types (Field, Group, Scalar, Boolean, Integer, String)
  • program - Program data structures (Identifier, Value, Plaintext, Record, etc.)
  • network - Network traits and implementations (MainnetV0, TestnetV0, CanaryV0)
  • algorithms - Cryptographic algorithms (BHP, Poseidon, Pedersen)
  • collections - Data structures like Merkle trees

Module Structure

Core Features

Account Management

The account module provides types for:
  • Private keys and key derivation
  • View keys for decryption
  • Compute keys for program execution
  • Addresses derived from keys
  • Digital signatures

Type System

The types module implements:
  • Field elements over the base field
  • Group elements on elliptic curves
  • Scalar elements over the scalar field
  • Boolean values
  • Signed and unsigned integers (I8-I128, U8-U128)
  • String types
  • Address types

Program Data Structures

The program module defines:
  • Literals (primitive values)
  • Plaintext (literals, structs, arrays)
  • Records (encrypted state with owner)
  • Values (plaintext, record, or future)
  • Identifiers and program IDs
  • Request/Response types for function calls

Network Abstractions

The network module provides:
  • Network trait with consensus parameters
  • MainnetV0, TestnetV0, CanaryV0 implementations
  • Cryptographic function interfaces (hash, commit, merkle trees)
  • Consensus version heights and configuration

Generic Network Parameter

Most types in the console module are generic over a Network type parameter:
This allows the same code to work across different Aleo networks (mainnet, testnet, etc.) with different consensus rules and cryptographic parameters.

Example Usage

Account Types

Private keys, view keys, addresses, and signatures

Console Types

Field, Group, Scalar, Boolean, Integer, and String types

Program Types

Identifiers, Values, Plaintext, Records, and program data

Network Traits

Network implementations and consensus parameters

See Also