Deployment

Environment variables

The environment variables the Carbonized web app reads, with placeholder values.

Web app (.env.local)

Onchain configuration

VariableRequiredDescription
NEXT_PUBLIC_NETWORKyesrobinhood-mainnet (chain id 4663), robinhood (testnet, 46630; alias robinhood-testnet), hardhat, polygon, amoy (alias mumbai) or anything else for Sepolia. Default: hardhat in development, sepolia otherwise. Any value other than robinhood-mainnet shows the red/amber "Testnet / unaudited" banner on the landing page and in the app.
NEXT_PUBLIC_CHAIN_IDrecommendedChain id. Used as the chain id for contract config; 31337 triggers Hardhat address fallbacks.
NEXT_PUBLIC_RPC_URLrecommendedHTTP RPC for the target chain. Falls back to the chain's default (Hardhat: http://127.0.0.1:8545).
NEXT_PUBLIC_LOGS_RPC_URLoptionalRPC used for eth_getLogs history scans. Defaults to https://robinhood-rpc.publicnode.com for chain 4663 and https://robinhood-sepolia-rpc.publicnode.com for chain 46630. Set it when NEXT_PUBLIC_RPC_URL is a plan that caps log ranges.
NEXT_PUBLIC_EXPLORER_URLoptionalBlock explorer base URL used for transaction and address links. Defaults: https://robinhoodchain.blockscout.com (mainnet), https://explorer.testnet.chain.robinhood.com (testnet).
NEXT_PUBLIC_CARBON_CREDIT_NFTyesCarbonCreditNFT address
NEXT_PUBLIC_CARBON_CREDIT_TOKENyesCarbonCreditToken for the marketplace's methodology (Verra in the testnet deployment)
NEXT_PUBLIC_CARBON_MARKETPLACEyesCarbonMarketplace address
NEXT_PUBLIC_CARBON_PRICE_ORACLEyesCarbonPriceOracle address
NEXT_PUBLIC_EMISSION_VERIFIERyesEmissionVerifier address
NEXT_PUBLIC_payment token_ADDRESSyesPayment token address: real payment token (6 decimals) on mainnet, mock payment token on testnet. The app reads decimals() of this address once and never assumes 18. It must be the same token the marketplace was deployed with.
NEXT_PUBLIC_CARBON_REGISTRYyesCarbonRegistry address: company/trader profiles, emissions and KYB. Without it the Company and Trader pages show a "Registry not configured" state.
NEXT_PUBLIC_DEPLOY_BLOCKrecommendedFirst block to scan when rebuilding history from event logs (emissions timeline, activity feeds, portfolio events). If unset the app scans only the last 20,000 blocks.
NEXT_PUBLIC_CARBON_CREDIT_TOKEN_GOLD_STANDARD, NEXT_PUBLIC_CARBON_CREDIT_TOKEN_ICM_COMPLIANCEoptionalCarbonCreditToken addresses for the other two methodology pools (used by pages that show all pools).

A missing or zero address shows a banner in the app shell listing the unset variables.

CARB utility token (optional)

All five are optional and are not listed as missing in the app banner. When they are unset, the Token and Governance pages and the Issuer Bond panel show a "CARB is not live yet" state. CARB is not launched yet; see the CARB section.

VariableRequiredDescription
NEXT_PUBLIC_CARB_TOKENoptionalCARB token address: Carbonized's own CarbToken or an external (launchpad) token. Symbol and decimals are read from the contract.
NEXT_PUBLIC_CARB_EXTERNALoptionaltrue when CARB is an external token: shows the External token info line. Written by update-carb-env.js.
NEXT_PUBLIC_CARB_VOTESoptionalCarbVotes voting wrapper (vCARB) for an external CARB without votes. When set, governance needs CARB deposited here and delegated.
NEXT_PUBLIC_CARB_STAKINGoptionalCarbStaking address (tier, stake, unstake, withdraw). Also enables the fee-tier info line on the Sell Credits and Marketplace pages.
NEXT_PUBLIC_ISSUER_BONDoptionalIssuerBond address. Shows the Bond panel on the Issuer page.
NEXT_PUBLIC_GOVERNORoptionalCarbGovernor address (proposals, votes).
NEXT_PUBLIC_TIMELOCKoptionalCarbTimelock address (queue and execute).

Wallet, contact and backend

VariableRequiredDescription
NEXT_PUBLIC_REOWN_PROJECT_IDfor WalletConnectProject id from https://dashboard.reown.com. See Reown AppKit.
NEXT_PUBLIC_CONTACT_EMAILoptionalContact email shown in the app and on the legal pages.
NEXT_PUBLIC_BACKEND_URLoptional, leave empty by defaultBase URL of an off-chain depository backend. Registration, profiles and emissions come from the onchain registry, so the app works without a backend. Only set it if you run such a backend yourself: when it is set, the company registration flow sends the registration details, including email and phone, to that server. Its origin is added to the Content-Security-Policy automatically.

Site and platform

VariableDescription
NEXT_PUBLIC_APP_URLOptional public URL of the site. When unset, production builds use the Vercel-provided domain (VERCEL_PROJECT_PRODUCTION_URL, then VERCEL_URL).
SKIP_ENV_VALIDATIONSet to any value to skip environment validation. Not needed for a normal deployment.
NEXT_PUBLIC_UMAMI_URL, NEXT_PUBLIC_UMAMI_WEBSITE_IDOptional analytics

Restart after changes

NEXT_PUBLIC_* values are inlined by Next.js. Restart pnpm dev after editing .env.local.

Security headers and CSP

Security headers and a Content-Security-Policy are set in next.config.ts. Custom RPC, explorer, backend and analytics origins are added to the CSP automatically from the NEXT_PUBLIC_* URLs above, so you do not edit the policy by hand.

Optional: accounts and comments

The site deploys with only the NEXT_PUBLIC_* variables above. Sign-in with Google and blog comments switch on automatically once all of the following server-only variables are set (otherwise the UI shows "Comments are not enabled yet" and /api/auth and /api/comments answer 503). Set them in your hosting provider's secret store; never expose them to the browser or commit them.

VariableDescription
DATABASE_URLPostgres connection string (Neon)
BETTER_AUTH_SECRETRandom secret, e.g. generated with openssl rand -base64 32
BETTER_AUTH_URLPublic URL of the site
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRETGoogle OAuth client credentials

Example: Robinhood Chain Mainnet

See Robinhood Chain Mainnet for prerequisites and the checklist.

NEXT_PUBLIC_NETWORK=robinhood-mainnet
NEXT_PUBLIC_CHAIN_ID=4663
NEXT_PUBLIC_RPC_URL=https://rpc.mainnet.chain.robinhood.com
NEXT_PUBLIC_REOWN_PROJECT_ID=your_reown_project_id
NEXT_PUBLIC_payment token_ADDRESS=0x...   # real payment token, supplied by the operator
NEXT_PUBLIC_CARBON_CREDIT_NFT=0x...
NEXT_PUBLIC_CARBON_CREDIT_TOKEN=0x...
NEXT_PUBLIC_CARBON_MARKETPLACE=0x...
NEXT_PUBLIC_CARBON_PRICE_ORACLE=0x...
NEXT_PUBLIC_EMISSION_VERIFIER=0x...
NEXT_PUBLIC_CARBON_REGISTRY=0x...
NEXT_PUBLIC_DEPLOY_BLOCK=your_deploy_block

Example: Robinhood Chain Testnet

NEXT_PUBLIC_NETWORK=robinhood
NEXT_PUBLIC_CHAIN_ID=46630
NEXT_PUBLIC_RPC_URL=https://rpc.testnet.chain.robinhood.com/rpc
NEXT_PUBLIC_REOWN_PROJECT_ID=your_reown_project_id
NEXT_PUBLIC_CARBON_CREDIT_NFT=0x...
NEXT_PUBLIC_CARBON_CREDIT_TOKEN=0x...
NEXT_PUBLIC_CARBON_MARKETPLACE=0x...
NEXT_PUBLIC_CARBON_PRICE_ORACLE=0x...
NEXT_PUBLIC_EMISSION_VERIFIER=0x...
NEXT_PUBLIC_payment token_ADDRESS=0x...
NEXT_PUBLIC_CARBON_REGISTRY=0x...
NEXT_PUBLIC_DEPLOY_BLOCK=your_deploy_block

Deploying the contracts

Deployer keys, RPC overrides and explorer API keys are used only by your Hardhat setup, from a git-ignored .env. They are never read by the web app and must never be committed or placed in NEXT_PUBLIC_* variables. See Robinhood Chain Mainnet and Robinhood Chain Testnet.