SmartBridge.
SmartBridge — Automate CEX deposits from your DeFi wallet using Chainlink CRE
What it is
SmartBridge helps users who need to move tokens from their self-custody DeFi wallet to a centralized exchange (CEX) overcome the friction and risk of manually looking up deposit addresses across different blockchain networks. Copying the wrong address — or the right address on the wrong network — is a common and often irreversible mistake that leads to permanent fund loss.
SmartBridge solves this using Chainlink Runtime Environment (CRE). Here is how it works:
Step 1 — Register once: The user registers their exchange API credentials through a CRE workflow. The registry bearer token that protects this backend is stored and managed by Chainlink's Vault DON using Distributed Key Generation (DKG) — meaning no single node ever holds the full secret. Credentials are stored AES-256-GCM encrypted in the registry backend and never written on-chain.
Step 2 — Transfer on demand: When the user wants to send tokens to their CEX, they trigger a single workflow with just their wallet address, token, network, and amount. The CRE workflow automatically queries the correct deposit address directly from the exchange API. Critically, a Byzantine Fault Tolerant quorum of independent DON nodes must all independently resolve and agree on the same deposit address before any funds move — eliminating the possibility of a single compromised node redirecting the transfer.
Step 3 — On-chain execution: Once consensus is reached, the workflow submits a DON-signed report to the SmartBridgeReceiver smart contract via the Chainlink KeystoneForwarder, which executes the ERC-20 token transfer to the verified deposit address.
The result is a one-command CEX deposit flow with no manual address lookup, no copy-paste errors, and cryptographic guarantees that the destination address was verified by a decentralized network before a single token moved.
How it Works
SmartBridge is built on three layers: CRE workflows, a registry backend, and a Solidity consumer contract.
CRE Workflows (TypeScript) Two workflows are built using the Chainlink CRE SDK (@chainlink/cre-sdk). Both are compiled to WASM via Javy and executed by the DON.
The registration workflow accepts an HTTP trigger containing the user's wallet address and exchange API credentials. It uses HTTPClient inside runInNodeMode to POST the credentials to the registry backend, authenticated via a bearer token fetched from the Vault DON using secretsProvider — Chainlink's DKG-backed threshold secret management.
The transfer workflow accepts an HTTP trigger with wallet address, token, network, and amount. It uses runInNodeMode so that every DON node independently calls the registry backend's /deposit-address endpoint, which signs and forwards the request to the Binance API to resolve the correct deposit address. consensusIdenticalAggregation then requires a Byzantine Fault Tolerant quorum of nodes to agree on the exact same address before execution continues. Once consensus is reached, the workflow ABI-encodes the transfer parameters, generates a DON-signed report via runtime.report(), and submits it on-chain via EVMClient.writeReport().
Registry Backend (Node.js + TypeScript) A lightweight Express server with three endpoints: credential registration, deposit address resolution, and health check. All stored credentials are AES-256-GCM encrypted at rest. The backend handles Binance API HMAC-SHA256 request signing server-side using Node.js crypto — this was necessary because the Javy WASM runtime that executes CRE workflow code does not expose Web Crypto APIs, making it impossible to compute HMAC signatures inside the workflow itself.
Smart Contract (Solidity) SmartBridgeReceiver.sol inherits Chainlink's ReceiverTemplate, which handles KeystoneForwarder signature validation automatically. The contract implements _processReport() which ABI-decodes the incoming report as (address token, address recipient, uint256 amount) and calls IERC20(token).transfer(recipient, amount) to complete the transfer.
Stack: Chainlink CRE SDK, Viem (ABI encoding), Zod (config validation), Node.js 22 + TypeScript (backend), Solidity 0.8.19, Sepolia testnet.
Links
Created by
- Adepoju Emmanuel Oluwafemi