Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Account Reference

Pre-Alpha Disclaimer: This is an early pre-alpha release for exploring the SDK and starting development only. There is no real encryption — all data is completely public and stored as plaintext on-chain. Do not submit any sensitive or real data. Encryption keys and the trust model are not final; do not rely on any encryption guarantees or key material until mainnet. All interfaces, APIs, and data formats are subject to change without notice. The Solana program and all on-chain data will be wiped periodically and everything will be deleted when we transition to Encrypt Alpha 1. This software is provided “as is” without warranty of any kind; use is entirely at your own risk and dWallet Labs assumes no liability for any damages arising from its use.

All 7 account types in the Encrypt Solana program. Each account starts with a 2-byte prefix: discriminator(1) | version(1), followed by the account data.

Account Discriminators

DiscriminatorAccount Type
1EncryptConfig
2Authority
3DecryptionRequest
4EncryptDeposit
5RegisteredGraph
6Ciphertext
7NetworkEncryptionKey

EncryptConfig (disc 1)

Program-wide configuration. PDA seeds: ["encrypt_config"].

OffsetFieldSizeDescription
0discriminator11
1version11
2current_epoch8Current epoch (LE u64)
10enc_per_input8ENC fee per input (LE u64)
18enc_per_output8ENC fee per output (LE u64)
26max_enc_per_op8Max ENC fee per operation (LE u64)
34max_ops_per_graph2Max operations per graph (LE u16)
36gas_base8Base SOL gas fee (LE u64)
44gas_per_input8SOL gas fee per input (LE u64)
52gas_per_output8SOL gas fee per output (LE u64)
60gas_per_byte8SOL gas fee per byte (LE u64)
68enc_mint32ENC SPL token mint address
100enc_vault32ENC vault token account address
132bump1PDA bump

Total: 2 + 131 = 133 bytes


Authority (disc 2)

Authorized operator (executor/decryptor). PDA seeds: ["authority", pubkey].

OffsetFieldSizeDescription
0discriminator12
1version11
2pubkey32Authority’s public key
34active1Active flag (0 = deactivated)
35bump1PDA bump

Total: 2 + 34 = 36 bytes


DecryptionRequest (disc 3)

Decryption request with result storage. Keypair account (not PDA) – no seed conflicts on multiple requests.

OffsetFieldSizeDescription
0discriminator13
1version11
2ciphertext32Ciphertext account pubkey
34ciphertext_digest32Digest snapshot at request time
66requester32Who requested decryption
98fhe_type1FHE type (determines result size)
99total_len4Expected result byte count (LE u32)
103bytes_written4Bytes written so far (LE u32)
107result dataNPlaintext bytes (N = byte_width of fhe_type)

Total: 2 + 105 + byte_width(fhe_type) bytes

Status is determined by bytes_written:

  • 0 = pending (decryptor has not responded)
  • == total_len = complete (result is ready)

EncryptDeposit (disc 4)

Fee deposit for a user. PDA seeds: ["encrypt_deposit", owner].

OffsetFieldSizeDescription
0discriminator14
1version11
2owner32Deposit owner pubkey
34enc_balance8ENC token balance (LE u64)
42gas_balance8SOL gas balance (LE u64)
50pending_enc_withdrawal8Pending ENC withdrawal (LE u64)
58pending_gas_withdrawal8Pending SOL withdrawal (LE u64)
66withdrawal_epoch8Epoch when withdrawal becomes available (LE u64)
74num_txs8Transaction counter (LE u64)
82bump1PDA bump

Total: 2 + 81 = 83 bytes


RegisteredGraph (disc 5)

A reusable computation graph stored on-chain. PDA seeds: ["registered_graph", graph_hash].

OffsetFieldSizeDescription
0discriminator15
1version11
2graph_hash32SHA-256 hash of graph data
34registrar32Who registered the graph
66num_inputs2Number of inputs (LE u16)
68num_outputs2Number of outputs (LE u16)
70num_ops2Number of operations (LE u16)
72finalized1Finalized flag
73bump1PDA bump
74graph_data_len2Actual graph data length (LE u16)
76graph_data4096Graph data (padded to max)

Total: 2 + 4170 = 4172 bytes

Maximum graph data: 4096 bytes.


Ciphertext (disc 6)

An encrypted value. Keypair account (not PDA) – the account pubkey IS the ciphertext identifier.

OffsetFieldSizeDescription
0discriminator16
1version11
2ciphertext_digest32Hash of the encrypted blob (zero until committed)
34authorized32Who can use this ([0; 32] = public)
66network_encryption_public_key32FHE key it was encrypted under
98fhe_type1Type discriminant (EBool=0, EUint64=4, etc.)
99status1Pending(0) or Verified(1)

Total: 2 + 98 = 100 bytes

Status values:

  • 0 = PENDING – waiting for executor to commit
  • 1 = VERIFIED – digest is valid, ciphertext can be used as input

NetworkEncryptionKey (disc 7)

FHE network public key. PDA seeds: ["network_encryption_key", key_bytes].

OffsetFieldSizeDescription
0discriminator17
1version11
2network_encryption_public_key32FHE network public key bytes
34active1Active flag (0 = deactivated)
35bump1PDA bump

Total: 2 + 34 = 36 bytes


Account Type Summary

AccountDiscTypeSize (bytes)PDA Seeds
EncryptConfig1PDA133["encrypt_config"]
Authority2PDA36["authority", pubkey]
DecryptionRequest3Keypair107 + N
EncryptDeposit4PDA83["encrypt_deposit", owner]
RegisteredGraph5PDA4172["registered_graph", graph_hash]
Ciphertext6Keypair100
NetworkEncryptionKey7PDA36["network_encryption_key", key_bytes]