> For the complete documentation index, see [llms.txt](https://darksun-2.gitbook.io/darksun-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://darksun-2.gitbook.io/darksun-docs/integrations/overview-2/blockchain.md). Agents can also search and read this documentation through its [MCP server](https://darksun-2.gitbook.io/darksun-docs/~gitbook/mcp).

# Blockchain

This is the most common shape for a chain-native integration.

Use this when the blockchain itself wants to expose:

* network metadata
* chain state
* token registry information

```json
{
  "manifestVersion": "1.0",
  "id": "example_chain_native",
  "name": "Example Chain Native Integration",
  "type": "blockchain",
  "owner": "example-chain",
  "chain": "example_chain",
  "schemaVersion": "1.0",
  "endpoints": [
    { "key": "lcd", "kind": "lcd", "url": "https://lcd.example.com" },
    { "key": "token_registry", "kind": "registry", "url": "https://docs.example.com/tokens.json" }
  ],
  "capabilities": [
    {
      "key": "chain_state",
      "schema": "blockchain",
      "version": "1.0",
      "endpoint": "lcd",
      "output": { "collection": "chain_state" }
    },
    {
      "key": "assets",
      "schema": "token_registry",
      "version": "1.0",
      "endpoint": "token_registry",
      "output": { "collection": "tokens" }
    },
    {
      "key": "nft_collections",
      "schema": "nft_collections",
      "version": "1.0"
    }
  ],
  "auth": { "type": "none" },
  "verification": { "method": "onchain" },
  "metadata": {
    "discovery": {
      "standards": ["cw721"],
      "sources": ["cosmwasm-events"]
    }
  }
}
```

## Notes

* `lcd` should point to a stable chain API when possible.
* `token_registry` should expose token metadata in a format DarkSun can map.
* `output.collection` values are descriptive contracts that help DarkSun understand what to read from the payload.

## Adding a Cosmos SDK chain to DarkSun

For a DarkSun-managed chain, the runtime source of truth is `app-backend/src/chains.js`. Add one definition and enable its key in `ACTIVE_CHAINS`; the public bootstrap then sends the same definition to the frontend.

```js
example_chain: {
  key: "example_chain",
  adapter: "cosmos-sdk",
  label: "Example Chain",
  chainId: "example-1",
  bech32Prefix: "example",
  coinType: 118,
  nativeDenom: "uexample",
  nativeSymbol: "EXAMPLE",
  nativeName: "Example",
  nativeDecimals: 6,
  coingeckoId: "example",
  ecosystemCategory: "cosmos",
  walletProviders: ["keplr", "owallet", "walletconnect"],
  frontendLogoURI: "./assets/chains/example.svg",
  gasPriceStep: { low: 0.01, average: 0.025, high: 0.03 },
  nftDiscovery: {
    standards: ["cw721"],
    sources: ["cosmwasm-events"]
  },
  explorer: {
    label: "Explorer",
    accountUrl: "https://explorer.example/address/{address}",
    txUrl: "https://explorer.example/tx/{txHash}"
  },
  endpoints: {
    lcd: ["https://lcd.example"],
    rpc: ["https://rpc.example"]
  },
  capabilities: {
    portfolio: true,
    staking: true,
    governance: true,
    cw20: false,
    liquidity: false,
    farming: false,
    nfts: true,
    transactions: true
  }
}
```

With `adapter: "cosmos-sdk"`, DarkSun reuses the generic paginated balance, IBC, tokenfactory, staking, governance, transaction and wallet-transaction paths. Capability flags decide which UI actions and background indexers are enabled. A chain-specific adapter is only required when the API or transaction model is not Cosmos SDK compatible.

NFT discovery is part of the minimum chain rollout. A chain cannot be activated in the bundled runtime configuration unless it enables `capabilities.nfts`, declares at least one standard and discovery source, and has an implemented source plus adapter. CosmWasm chains use the shared CW721 wallet-event discovery shown above; other ecosystems must add their own standard-specific source and adapter in the same rollout.

For Cosmos SDK chains, list every validated provider in the chain definition. DarkSun exposes `keplr` and `owallet` through the shared injected adapter, plus `walletconnect` through the Reown mobile-session bridge; Terra Classic may additionally expose its Station providers. Enable the WalletConnect UI per deployment with `WALLETCONNECT_PROJECT_ID` in the backend environment. The public project ID is delivered to the browser through `/api/ui/config`; if it is absent or invalid, the WalletConnect controls remain hidden.

Osmosis adds an optional `stakingEconomics` block because it exposes epoch provisions through its own mint module. Standard Cosmos SDK chains can omit that block and continue using the default mint endpoints.

Optional endpoint overrides can be added without changing provider code in `config/runtime-config.json`:

```json
{
  "chains": {
    "example_chain": {
      "endpoints": {
        "lcd": ["https://private-lcd.example"],
        "rpc": ["https://private-rpc.example"]
      }
    }
  }
}
```

Finally, add a blockchain manifest to `app-backend/data/integrations/` if the chain should expose its integration sources in Ecosystem. Protocol manifests may declare `metadata.protocol.chains`; those protocols are then attached automatically to every declared active blockchain.

The minimum verification before activation is:

1. run the backend tests;
2. load a wallet with the new prefix;
3. verify native and IBC balances;
4. verify staking/governance only when their capability is enabled;
5. verify NFT discovery with a wallet that holds and has transferred an NFT;
6. verify account and transaction explorer links.
