Skip to main content
This guide shows how to route on-chain deposits through your institutional custody provider using action delegates. This is the Tier 2 integration pattern - the most common setup for institutional platforms.

Prerequisites

  • @keystoneos/react and @keystoneos/node installed
  • KeystoneProvider configured with settlements:write scope
  • A backend that can submit transactions via your custody provider (Fireblocks, BitGo, etc.)

Why action delegates exist

Institutional platforms do not let end-users sign transactions in the browser. Assets are held in custody wallets managed by Fireblocks, BitGo, or similar infrastructure. When a settlement requires a deposit to escrow, the transaction must route through the custody provider’s API. Action delegates bridge this gap. Instead of the widget interacting with the blockchain directly, it calls your backend, which submits the transaction through your signing infrastructure.

The deposit flow

Frontend setup

Configuring the provider with action delegates

Pass onDepositRequired (and optionally onApprovalRequired) to the KeystoneProvider. These callbacks fire when the user triggers a deposit from the UI.

Building the deposit button component

The useDeposit hook manages the multi-step deposit flow. It returns the current status, deposit info for preview, and the deposit() function to trigger the flow.

Backend implementation

Your backend receives the pre-encoded calldata from the frontend and submits it to your custody provider. The calldata is already ABI-encoded by the KeyStone API - your backend just needs to forward it.

Fireblocks

BitGo

Generic signing infrastructure

If you use a different custody provider or your own HSM, the pattern is the same - forward the pre-encoded calldata:

Deposit status states

The useDeposit hook progresses through these states:

Error handling

Common failure scenarios

Implementing robust error handling

Security considerations

  • The backend deposit endpoint should authenticate the request (verify the session or user identity before submitting a transaction)
  • Validate that the escrowAddress matches a known KeyStone escrow contract before signing
  • Implement rate limiting on the deposit endpoint
  • Log all deposit submissions with the settlement ID, leg index, and caller identity for audit

Next steps

Real-time Tracking

Track deposit progress and settlement state in real time.

Action Delegates Reference

Full reference for all action delegate callbacks.

useDeposit Reference

Full API reference for the useDeposit hook.

Escrow Deposits Guide

Server-side guide for escrow deposits using the SDK.