Cardano Sidechain: Architecture & Implementation
Making a sidechain of Cardano is possible, but it’s a highly technical undertaking that involves building a parallel blockchain that connects to the Cardano mainnet via a bridge protocol. Here’s a breakdown of what it takes:
🔹 Core Concepts
-
Sidechain Definition A sidechain is an independent blockchain that runs in parallel to Cardano. It has its own consensus rules, tokenomics, and block producers, but is linked to Cardano via a two-way bridge that allows tokens (like ADA or native tokens) to move back and forth.
-
Base Layer Connection Cardano provides support for sidechains via:
- Ouroboros family of protocols (consensus that can be adapted for your chain).
- Sidechain toolkit (IOG has released prototype frameworks).
- Bridge smart contracts on Cardano that lock/release assets.
🔹 Steps to Create a Cardano Sidechain
1. Design the Consensus & Chain Rules
- You can reuse Ouroboros (Praos, Chronos, Leios, etc.) for security and compatibility.
- Or implement your own (e.g., Proof-of-Authority, Delegated PoS, or even hybrid consensus).
- Decide block times, validator set, governance model, etc.
2. Set Up Infrastructure
-
Deploy nodes/validators that will produce blocks on your sidechain.
-
Choose your execution layer:
- EVM-compatible (like Milkomeda C1)
- WASM or custom VM
- Plutus-based (native Cardano scripting carried over).
3. Implement the Bridge
- On Cardano mainnet, deploy bridge contracts that lock tokens.
- On your sidechain, mirror those tokens as wrapped assets.
- Users can move ADA or native tokens to the sidechain and back securely.
4. Tokenomics & Governance
- Decide if your sidechain has its own token for gas and governance.
- You may also just use wrapped ADA as the fee token.
5. Interoperability
- Enable communication between the sidechain and Cardano using cross-chain messaging protocols.
- (Example: Milkomeda enables Ethereum-style contracts running with Cardano as settlement.)
🔹 Tools & References
- Cardano Sidechains Toolkit (by IOG) → an open-source framework for launching sidechains.
- Milkomeda → an existing Cardano sidechain providing EVM compatibility.
- Midnight → IOG’s privacy-focused sidechain (uses zero-knowledge proofs).
- Hydra → not a sidechain, but a state channel scaling protocol you may integrate if your sidechain needs high throughput.
🔹 Practical Path
- Start with a testnet chain using the Cardano sidechain toolkit.
- Decide your execution model (do you want EVM compatibility or stick to Cardano native contracts?).
- Run validator nodes and configure bridge contracts.
- Integrate wallets and explorers so users can interact.
- Deploy dApps or governance experiments on your sidechain.
👉 Sidechains are a big engineering effort: you’ll need expertise in Haskell/Plutus, Rust, or Solidity (if EVM-based), plus infrastructure devops for chain deployment.
🚀 Step-by-Step Guide: Spinning Up a Cardano Sidechain Testnet (Preview)
Generated by AI
0) What You’ll Build
- A Partner Chains Substrate node running in PoA mode.
- Governance & D-Param contracts on the Cardano Preview testnet.
- Two local validators producing blocks.
1) Prereqs
- Linux/macOS with Docker, Git, Nix, and Rust installed.
- Clone and build the toolkit:
git clone https://github.com/input-output-hk/partner-chains.git
cd partner-chains
nix develop
cargo build
2) Run Cardano Testnet Services (Preview)
2.1 Ogmios + cardano-node (Preview)
Run Ogmios using the preview tag:
docker run -it --name cardano-ogmios \
-p 1337:1337 \
-v cardano-preview-db:/db \
cardanosolutions/cardano-node-ogmios:latest-preview
👉 This connects to Preview automatically. Your node DB will persist in the cardano-preview-db volume.
2.2 Kupo (Preview)
Run Kupo and point it to Ogmios:
docker run -d --name kupo -p 1442:1442 \
cardanosolutions/kupo:v2.11.0 \
--ogmios-host cardano-ogmios \
--ogmios-port 1337
2.3 Get Test ADA
Request funds from the Preview faucet: 👉 https://docs.cardano.org/cardano-testnet/tools/faucet/
3) Configure pc-contracts-cli
Install the CLI:
nix run .#pc-contracts-cli -- --help
or via npm:
npm i -g @partner-chains/pc-contracts-cli
Create config.json:
{
"genesisUtxo": "TXHASH#INDEX",
"governanceAuthority": "hex-governance-key",
"runtimeConfig": {
"network": "preview",
"ogmios": { "host": "localhost", "port": 1337, "secure": false },
"kupo": { "host": "localhost", "port": 1442, "secure": false }
},
"paymentSigningKeyFile": "/absolute/path/payment.skey",
"stakeSigningKeyFile": "/absolute/path/stake.skey"
}
⚠️ Note the "network": "preview" setting.
4) Initialize Governance on Preview
nix run .#pc-contracts-cli -- init-governance
Set your PoA-style D-Param (2 permissioned validators, no open registrants):
nix run .#pc-contracts-cli -- insert-d-parameter \
--d-parameter-permissioned-candidates-count 2 \
--d-parameter-registered-candidates-count 0
5) Generate Validator Keys
Each validator needs AURA + GRANDPA keys:
cargo install --locked subkey --git https://github.com/paritytech/substrate
# Aura (block production)
subkey generate --scheme sr25519
# Grandpa (finality)
subkey generate --scheme ed25519
6) Whitelist Validators on Preview
nix run .#pc-contracts-cli -- update-permissioned-candidates \
--add-candidate "SIDECHAIN_KEY_1:AURA_KEY_1:GRANDPA_KEY_1" \
--add-candidate "SIDECHAIN_KEY_2:AURA_KEY_2:GRANDPA_KEY_2"
7) Start Partner-Chains Nodes
Build a chainspec:
./target/debug/partner-chains-node build-spec --chain local > local.json
./target/debug/partner-chains-node build-spec \
--chain local.json --raw --disable-default-bootnode > local.raw.json
Insert validator keys:
./target/debug/partner-chains-node key insert \
--base-path /data/node1 \
--chain ./local.raw.json \
--scheme Sr25519 \
--suri "<aura mnemonic>" \
--key-type aura
./target/debug/partner-chains-node key insert \
--base-path /data/node1 \
--chain ./local.raw.json \
--scheme Ed25519 \
--suri "<grandpa mnemonic>" \
--key-type gran
Run nodes:
./target/debug/partner-chains-node \
--chain ./local.raw.json \
--base-path /data/node1 \
--validator --name PC-VAL-1
./target/debug/partner-chains-node \
--chain ./local.raw.json \
--base-path /data/node2 \
--validator --name PC-VAL-2 \
--port 30334 --rpc-port 9934 --ws-port 9945
8) Smoke Test
Check chain info:
curl -s http://localhost:9933 \
-H 'content-type: application/json' \
--data '{"jsonrpc":"2.0","id":1,"method":"system_chain","params":[]}'
Or open Polkadot.js Apps → connect to ws://localhost:9944.
✅ You now have a PoA-style Cardano-connected sidechain running on Preview.
Would you like me to also prep a ready-to-use Docker Compose file for Ogmios + Kupo + Partner-Chains nodes (all wired to Preview), so you can spin up the whole setup in one command?