Skip to content

Connect a new Chain

If your chain is not yet connected to Union, then you can permissionlessly add support. Union supports L1s, L2s, L3s, and Rollups. The steps to connect are simple:

  1. Upload Union contracts
  2. Configure a relayer
  3. Open the connection
  4. Send assets and data

Upload Union contracts

You’ll need to upload two contracts:

Cosmos

To upload CosmWasm contracts to your Cosmos chain, you need your chain’s binary. We’ll use starsd in this example.

Terminal window
nix build github:unionlabs/union#union-ibc -L
Terminal window
mkdir ./starsd-home
./starsd init --chain-id elgafar-1 --home ./starsd-home cor-systems
./starsd keys add cor-systems --home ./starsd-home
# this will give you your address: stars1qcvavxpxw3t8d9j7mwaeq9wgytkf5vwputv5x4
  1. Upload your contract:

    Terminal window
    ./starsd tx wasm store ./contracts/union_ibc.wasm --from cor-systems --home ./starsd-home --gas auto --gas-adjustment 1.4 --gas-prices 1ustars --node https://rpc.elgafar-1.stargaze.chain.kitchen --chain-id elgafar-1 -y
    # => tx_hash: C6D45BE9A40F92D82E94C0B4D2AFA48812A9FE28E5761700E496ED29F8D53977
  2. Query your contract’s code_id:

    Terminal window
    ./starsd query tx C6D45BE9A40F92D82E94C0B4D2AFA48812A9FE28E5761700E496ED29F8D53977 --node https://rpc.elgafar-1.stargaze.chain.kitchen
    # => code_id: 5011
  3. Instantiate union-ibc

    Terminal window
    ./starsd tx wasm instantiate 5011 '{}' --node https://rpc.elgafar-1.stargaze.chain.kitchen --home ./starsd-home --from cor-systems --gas auto --gas-adjustment 1.4 --gas-prices 1ustars --label union-ibc-1 --admin stars1qcvavxpxw3t8d9j7mwaeq9wgytkf5vwputv5x4 --chain-id elgafar-1 -y
    # => txhash: D3E0D991E3874C83B43E0828C693F8E0A1E2A8C8CB518DFFF2F5F87FB6E1A7BC
  4. Query the union-ibc contract address:

    Terminal window
    ./starsd query tx D3E0D991E3874C83B43E0828C693F8E0A1E2A8C8CB518DFFF2F5F87FB6E1A7BC --node https://rpc.elgafar-1.stargaze.chain.kitchen
    # => contract_address: stars1s0x3yq0pmltxq56f4yppgmd02ret3uj5k9ftj6ug9c7lc379sw7qv396zm
  5. Upload cometbls-light-client contract:

    Terminal window
    ./starsd tx wasm store ./contracts/cometbls_light_client.wasm --from cor-systems --home ./starsd-home --gas auto --gas-adjustment 1.4 --gas-prices 1ustars --node https://rpc.elgafar-1.stargaze.chain.kitchen --chain-id elgafar-1 -y
    # => tx_hash: 187227FF10BA93B75063C9E72FBB188FA6403F43CFA80346DFC1B2F268C7C022
  6. Query cometbls-light-client code_id:

    Terminal window
    ./starsd query tx 187227FF10BA93B75063C9E72FBB188FA6403F43CFA80346DFC1B2F268C7C022 --node https://rpc.elgafar-1.stargaze.chain.kitchen
    # => code_id: 5012
  7. Instantiate cometbls-light-client, specifying the union-ibc address acquired in step 4

    Terminal window
    ./starsd tx wasm instantiate 5012 '{"ibc_host": "stars1s0x3yq0pmltxq56f4yppgmd02ret3uj5k9ftj6ug9c7lc379sw7qv396zm"}' --node https://rpc.elgafar-1.stargaze.chain.kitchen --home ./starsd-home --from cor-systems --gas auto --gas-adjustment 1.4 --gas-prices 1ustars --label union-ibc-1 --admin stars1qcvavxpxw3t8d9j7mwaeq9wgytkf5vwputv5x4 --chain-id elgafar-1 -y
    # => tx_hash: 7B6874CD6D68B735230E4F4F5C80BC92CF1AF690605C799569C01CCB7C403019
  8. Query the cometbls-light-client contract address:

    Terminal window
    ./starsd query tx 7B6874CD6D68B735230E4F4F5C80BC92CF1AF690605C799569C01CCB7C403019 --node https://rpc.elgafar-1.stargaze.chain.kitchen
    # => contract_address: stars16khctrjjnm5nn5503hhqlcu7h4pngzpzc5g3d4ej25pz47eqsnjqdctmt7
  9. Register the cometbls-light-client to union-ibc:

    Terminal window
    ./starsd tx wasm execute stars1s0x3yq0pmltxq56f4yppgmd02ret3uj5k9ftj6ug9c7lc379sw7qv396zm '{"register_client":{"client_type":"cometbls","client_address":"stars16khctrjjnm5nn5503hhqlcu7h4pngzpzc5g3d4ej25pz47eqsnjqdctmt7"}}' --home ./starsd-home --node https://rpc.elgafar-1.stargaze.chain.kitchen --chain-id elgafar-1 --from cor-systems --gas auto --gas-adjustment 1.4 --gas-prices 1ustars -y