Set up ConceroClient
ConceroClient allows your dApp contracts to send and receive messages from Concero Routers.
Anyone can attempt to submit cross-chain messages. If your contract is not configured to allowlist trusted relayer and verifier modules, this can lead to incorrect message acceptance. Therefore, it is critical to configure your client correctly.
1. Install Contracts
First, add the Concero contracts to your project:
npm install @concero/contracts2. Inherit from ConceroClient
To make things easier, we recommend that your dApp contract inherits from ConceroClient. There's always an option to go lower level and inherit straight from ConceroClientBase to build custom message verification logic.
pragma solidity ^0.8.28;
// @concero/contracts/ConceroClient/ConceroClient.sol
abstract contract ConceroClient is ConceroClientBase {
constructor(address conceroRouter) ConceroClientBase(conceroRouter) {}
}
import {ConceroClient} from "@concero/contracts/ConceroClient/ConceroClient.sol";
import {MessageCodec} from "@concero/contracts/common/libraries/MessageCodec.sol";
contract YourDapp is ConceroClient {
using MessageCodec for bytes;
constructor(address conceroRouter) ConceroClient(conceroRouter) {}
/// @dev This internal hook is where your business logic goes.
function _conceroReceive(bytes calldata messageReceipt) internal override {
// Decode the payload
bytes calldata payload = messageReceipt.calldataPayload();
// Use the decoded message payload for your business logic
// (e.g., abi.decode(payload, (uint256, address)))
}
}3. Set up your Concero Client
After developing your contract, follow these steps to deploy and configure it.
Deploy your contract
Deploy your contract to the destination chain. During deployment, ensure you pass the correct conceroRouter address for that specific chain to the constructor.
Allow Relayer Libraries
ConceroClientBase requires you to allowlist the relayer libraries used to submit messages. Use _setIsRelayerLibAllowed(address relayerLib, bool isAllowed) to toggle whether a specific relayer library is trusted.
Allow Verifier Libraries
ConceroClient requires you to allowlist verifier libraries that verify message authenticity. Use _setIsValidatorAllowed(address validatorLib, bool isAllowed) (current interface naming) to toggle whether a specific verifier library is trusted.
Set Required Verifier Count
You must specify how many verifier assertions are required for a message to be considered valid by your contract. Use _setRequiredValidatorsCount(uint256 count) (current interface naming) to set the exact number of required verifications.
Message Lifecycle
The following diagram illustrates how a message flows from the ConceroRouter to your application logic, including the internal security checks performed by ConceroClient.