ZK Compression
  • Introduction
    • Overview
    • Intro to Development
  • Event
    • 🗓️Event: 1000x Hackathon
  • Release Notes
    • JS - v0.21.0
  • Learn
    • In a Nutshell
    • Core Concepts
      • Compressed Account Model
      • State Trees
      • Validity Proofs
      • Lifecycle of a Transaction
      • Limitations
  • Developers
    • TypeScript Client
    • JSON RPC Methods
      • getCompressedAccount
      • getCompressedBalance
      • getCompressedTokenAccountBalance
      • getCompressedBalanceByOwner
      • getCompressedMintTokenHolders
      • getCompressedTokenBalancesByOwnerV2
      • getCompressedAccountsByOwner
      • getMultipleCompressedAccounts
      • getCompressedTokenAccountsByOwner
      • getCompressedTokenAccountsByDelegate
      • getTransactionWithCompressionInfo
      • getCompressedAccountProof
      • getMultipleCompressedAccountProofs
      • getMultipleNewAddressProofs
      • getValidityProof
      • getCompressionSignaturesForAccount
      • getCompressionSignaturesForAddress
      • getCompressionSignaturesForOwner
      • getCompressionSignaturesForTokenOwner
      • getLatestCompressionSignatures
      • getLatestNonVotingSignatures
      • getIndexerSlot
      • getIndexerHealth
    • Addresses and URLs
    • Creating Airdrops with Compressed Tokens
    • Using Token-2022
    • Add Compressed Token Support to Your Wallet
    • Create programs with the program-template
  • Node Operators
    • Run a Node
  • resources
    • Security
    • Privacy Policy
Powered by GitBook
On this page

Was this helpful?

  1. Learn
  2. Core Concepts

Lifecycle of a Transaction

PreviousValidity ProofsNextLimitations

Last updated 2 months ago

Was this helpful?

ZK Compression transactions are fully compatible with Solana's Transaction and Versioned Transaction formats. There are three key nuances in building transactions with compressed accounts as compared to regular accounts:

  • Instructions must specify the list of all compressed accounts being read or written to. To read or write to a compressed account, the instruction must send the current account state on-chain and prove its validity

  • Each unique state tree that gets read or written to (via any compressed account) needs to be specified as per Solana's regular on-chain

  • To read any compressed account state on-chain, the client must send a validity proof alongside the instruction data to the chain. Depending on your program logic, the validity proof can prove A) the validity of all specified read accounts and B) the non-existence of a specified PDA within the compressed address space, e.g., for creating a new compressed PDA account

We can express a transaction more generally as:

(state, validityProof) -> state transition -> state'

Here's what this looks like when updating a single compressed PDA account:

The custom Solana program executing the state transition Data -> Data' should require its client to pack the instructions efficiently. In the above scenario, the total data that's sent to the chain is: address (same), owner program (same), data, data'-data, validity proof

The compressed account after its update looks like this:

On-chain Protocol Execution

To write compressed state, a custom caller program must invoke the Light System Program via CPI. The system program then does the following:

In this example, we assume that the client previously created said compressed account and thereafter fetched its compressed account info from an

Runs relevant checks (, etc.)

the "old" leaf of the compressed account that is being written to

the new compressed account hash to the state tree and advances the tree's state root

the new compressed account state onto the Solana ledger

An then parses the transaction and compressed state and provides the read state to clients via the

RPC node
sum check
Verifies the validity proof
Nullifies
Appends
Emits
RPC node
ZK Compression RPC API
account access lists
Simplified: Read and Write compressed accounts
Full representation of a compressed account with PDA