A minimal implementation of a Solana L2 rollup that batches transactions and submits them to the Solana L1 for settlement.
Tiny Rollup is an educational implementation of a Layer 2 rollup on Solana that demonstrates:
- Transaction batching and sequencing
- State management with Merkle roots
- JSON-RPC interface compatibility
- L1 settlement via Solana transactions
- Rust 1.70+
- Solana CLI (for local testing)
Installation
git clone [email protected]:collin5/tiny-rollup.git
cd tiny-rollup
cargo build# Start local Solana validator
solana-test-validator
# Start the rollup
cargo run -- --solana-rpc http://localhost:8899 --port 8890 --db-path ./rollup_dbcargo run -- --solana-rpc https://api.devnet.solana.com --port 8899 --db-path ./rollup_db# Get latest blockhash
curl -X POST http://localhost:8899 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getLatestBlockhash",
"params": []
}'
# Get account balance
curl -X POST http://localhost:8899 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getBalance",
"params": ["11111111111111111111111111111111"]
}'getAccountInfo- Get L2 account informationgetBalance- Get account balance in lamportssendTransaction- Submit transaction to L2getLatestBlockhash - Get current L2 blockhashsimulateTransaction- Simulate transaction executiongetTransaction- Get transaction details (TODO)
- Transaction Processing: Validate and execute Solana transactions in L2
- State Management: In-memory + persistent storage with RocksDB
- Sequencer: Batch transactions every 2 seconds (up to 100 tx/batch)
- JSON-RPC Server: Compatible with Solana RPC methods
- L1 Submission: Submit batches to Solana mainnet/devnet
- Account Management: Basic lamports transfer between accounts
- Implement sparse Merkle tree for state commitments
- Generate proper state roots for L1 verification
- Add state root to batch submissions
- Implement challenge period for fraud proofs
- Add state transition verification
- Create fraud proof generation
- Add support for EVM bytecode execution
- Add cross-chain message passing
