Skip to main content

Configuration

Cocoon's configuration is split across environment variables (set in .env or passed directly to Docker Compose) and static configuration files baked into the chain image at build time. This page covers every parameter.

note

All environment variables have sensible defaults for local development. For production deployments, review every section marked with a warning and replace demo values with production ones.

Chain Configuration

These parameters define the identity and consensus rules of the chain. They are set in chain/genesis.json and compiled into the Erigon image at build time. To change them, modify the genesis file and rebuild the erigon image.

ParameterTypeDefault (Chain A)Description
config.chainIdinteger33EVM chain ID. Must be unique across all connected chains. Chain B uses 34.
config.clique.periodinteger1Block time in seconds (Clique PoA).
config.clique.epochinteger30000Clique epoch length in blocks.
gasLimithex string0x1c9c380Block gas limit (~30 million).
baseFeePerGashex string0x3B9ACA00Initial base fee (1 Gwei).
extradatahex string(sealer address encoded)Clique sealer address embedded in genesis extradata. Must contain the admin/sealer address.
allocobject10 pre-funded accountsGenesis account allocations. Replace with the operator and admin addresses for production.
danger

Production deployments: replace all alloc addresses with operator and admin addresses. The defaults are the well-known Hardhat/Anvil test accounts whose private keys are public knowledge. Any funds sent to those addresses can be stolen.

Components Configuration

Cocoon components are Erigon modules that implement the platform's extended functionality. They are enabled via a components.cfg file mounted into the Erigon container and via the GENESIS and DATADIR environment variables.

ComponentKeyDefaultDescription
Permissioned TokenstokensenabledERC-3643 token engine with compliance hooks (token_* RPC namespace).
Digital Bearer CertificatesdbcenabledRingCT confidential cash layer. Requires tokens to be enabled.
Identity RegistryidentityenabledOnchainID / ERC-734/735 identity and claims engine (id_* RPC namespace).
AuthorizationauthenabledUCAN capability delegation and EIP-8141 frame transaction handling (auth_* namespace).
Torrent StoragetorrentenabledBitTorrent-backed content-addressed document store (erigon_resolveTorrent, erigon_publishTorrent).
WebFwebfenabledOn-chain web hosting via torrent-ccip (erigon_publishWebSite, erigon_getWebSite).
ProverproverenabledZK proof generation pipeline. Can be disabled when the prover runs on a separate host.
VerifierverifierenabledValidates incoming proofs before state acceptance.
QMTreeqmtreeenabledMerkle-tree state commitment scheme used by the prover (qm_* namespace).

Backend Proxy Configuration

The backend proxy (backend/) is configured entirely via environment variables.

Core Settings

VariableTypeDefaultDescription
CHAIN_RPC_URLstringhttp://localhost:8545URL of the Erigon JSON-RPC endpoint. In Docker Compose this is http://erigon:8545.
USER_DB_URLstringhttp://localhost:8548URL of the user database service.
PROXY_PORTstring8546Port the backend proxy listens on.
AUDIT_DB_PATHstring./data/audit.dbPath to the SQLite audit log file. Use a volume-mounted path in production.
AUTH_MODEstringadvisoryadvisory: log auth failures but allow through. strict: reject unauthenticated or invalid-session calls with HTTP 401.
LOCAL_CHAIN_IDinteger33Chain ID of the local Erigon node. Used for IBAN routing. Must match chainId in genesis.
ALLOWED_ORIGINSstringhttp://localhost:3000,http://localhost:3001Comma-separated list of allowed CORS origins.
SESSION_CACHE_TTLduration5sHow long to cache validated session tokens before re-validating with user DB.

RPC Configuration

VariableTypeDefaultDescription
PERMISSION_REGISTRY_ADDRESSaddress(from deployments)Address of the on-chain PermissionRegistry contract. If blank, permission checks are skipped.
DEPLOYMENTS_PATHstring/app/deployments.jsonPath to the deployments.json file that maps contract names to addresses.

Interoperability Configuration

VariableTypeDefaultDescription
INTEROP_ENABLEDboolfalseSet to true to enable the cross-chain interop listener.
INTEROP_ADMINaddress(demo address)Ethereum address of the admin account that signs cross-chain mint/burn transactions.
INTEROP_ADMIN_KEYstring(empty)Hex-encoded private key (no 0x prefix) for the interop admin account. Required when INTEROP_ENABLED=true.
PEER_CHAINSstring(empty)Comma-separated list of peer chain descriptors in the format chainId=rpcUrl=deploymentsPath. Example: 34=http://erigon2:8545=/app/deployments.chain2.json.
danger

INTEROP_ADMIN_KEY is a signing key. Store it in a secrets manager (Vault, AWS Secrets Manager, etc.) and inject it at runtime. Never hardcode it in docker-compose.yml or commit it to version control.

Prover Configuration

The prover (prover/) is a Rust service that generates ZK proofs of chain state transitions. It communicates with Erigon over a local socket.

ParameterTypeDefaultDescription
PROVER_BACKENDstringzilkwormProof backend to use. Options: zilkworm (default, fastest), sp1, risc0.
PROVER_ENDPOINTstringhttp://localhost:9090gRPC endpoint the prover listens on. Erigon calls this to request proofs.
PROVER_WORKERSinteger2Number of parallel proof workers. Increase for higher throughput at the cost of CPU.
PROVER_BATCH_SIZEinteger100Number of blocks to batch into a single proof. Larger batches are more efficient but introduce higher latency.
PROOF_STORE_PATHstring./data/proofsDirectory where generated proofs are persisted before posting to Ethereum.
ETH_ANCHOR_RPCstring(empty)Ethereum RPC URL for posting state roots. If empty, proofs are generated but not posted.
ETH_ANCHOR_KEYstring(empty)Signing key for the Ethereum anchor transaction.

Identity and Token Contract Addresses

After first-boot contract deployment, the addresses below are written to deployments.json. Any address can be overridden by setting the corresponding environment variable on the backend service — useful when deploying to an existing chain with pre-deployed contracts.

VariableContractDescription
PERMISSION_REGISTRY_ADDRESSPermissionRegistryControls which addresses have which roles (Admin, Operator, Trader, Compliance).
MMF_TOKEN_ADDRESSMMFTokenDefault money market fund ERC-3643 token.
STABLECOIN_ADDRESSStablecoinDefault USD-pegged stablecoin used as the subscription currency.
STATE_ANCHOR_REGISTRY_ADDRESSStateAnchorRegistryOn-chain registry of posted state roots.
IDENTITY_REGISTRY_ADDRESSIdentityRegistryERC-3643 identity registry linking investor addresses to on-chain identities.
CLAIM_TOPICS_REGISTRY_ADDRESSClaimTopicsRegistryRegistry of recognized claim topics (KYC status, accreditation, jurisdiction, etc.).
TRUSTED_ISSUERS_REGISTRY_ADDRESSTrustedIssuersRegistryRegistry of claim issuers trusted by the compliance layer.

Torrent Storage Configuration

ParameterTypeDefaultDescription
TORRENT_ANNOUNCE_URLSstring list(internal tracker)BitTorrent tracker announce URLs. Comma-separated. Private trackers recommended for production.
TORRENT_CACHE_PATHstring/data/torrent-cacheLocal directory for torrent piece cache. Mount on fast local storage.
TORRENT_KEYSTORE_PATHstring/data/torrent-keystorePath to the keystore used for signing torrent-ccip content references.
TORRENT_MAX_PEERSinteger50Maximum number of BitTorrent peer connections.

Auth (UCAN) Configuration

ParameterTypeDefaultDescription
UCAN_VERIFIER_CONTRACTaddress(from deployments)Address of the on-chain UCAN verifier contract. Validates capability delegations presented in EIP-8141 frame transactions.
UCAN_REVOCATION_REGISTRYaddress(from deployments)Address of the revocation registry. The auth component checks this before accepting a delegation.
UCAN_MAX_DELEGATION_DEPTHinteger5Maximum depth of the UCAN delegation chain. Longer chains are rejected.

RPC Configuration

Erigon's RPC server is configured via command-line flags set in the container's entrypoint. The defaults expose all Cocoon namespaces.

ParameterTypeDefaultDescription
--http.apistring listeth,net,web3,token,id,auth,qm,proof,erigonComma-separated list of enabled RPC namespaces.
--http.corsdomainstring* (dev)Allowed CORS origins for direct Erigon RPC access. In production, set to the backend proxy's internal address only and do not expose port 8545 externally.
--http.addrstring0.0.0.0Address Erigon binds the HTTP RPC server to. In production, bind to 127.0.0.1 and access only via the backend proxy.
--http.portinteger8545HTTP RPC port.
--authrpc.addrstring127.0.0.1Address for the authenticated Engine API (used internally).
--authrpc.portinteger8551Engine API port.
warning

Never expose port 8545 directly to the internet. All external RPC traffic should pass through the backend proxy on port 8546, which applies session validation, CORS enforcement, and audit logging.

User Database Configuration

VariableTypeDefaultDescription
PORTinteger8548Port the user DB service listens on.
DB_PATHstring./userdb.sqlitePath to the SQLite database. Use a volume-mounted path so data persists across container restarts.
KYC_DOCS_DIRstring./kyc_docsDirectory where uploaded KYC documents are stored. Encrypt this directory at rest in production.

Frontend and Dashboard Configuration

Both the admin dashboard (dashboard/) and the investor frontends (frontend/, frontend2/) are Next.js applications built with compile-time environment variables.

Build Arg / VariableDefaultDescription
NEXT_PUBLIC_PROXY_URLhttp://backend:8546URL of the backend proxy. Set to the publicly accessible URL of the proxy when deploying for external users.
NEXT_PUBLIC_USER_DB_URLhttp://user_db:8548URL of the user database.
NEXT_PUBLIC_CHAIN_ID33Chain ID the frontend connects to. Set to 34 for the Chain B investor frontend.
NEXT_PUBLIC_BRAND(empty)Optional brand name displayed in the frontend UI.
note

Because these are compile-time NEXT_PUBLIC_ variables, changing them requires a container rebuild (docker compose up --build).