Skip to main content
Merkle Street

Protocols, markets, policy, people

Why RenJS Integrators Must Persist Deposit State

RenJS deposits cross chains and wait for confirmations, signatures and minting; saved state lets an app resume, reconcile and explain each transfer reliably.

Merkle Street Newsroom#f1cf784 min read

Why RenJS Integrators Must Persist Deposit State

RenJS integrators must persist deposit state because a cross-chain transfer runs through several steps, and a browser session can end before they finish. RenJS creates a gateway for the chosen asset, source chain and destination. The user sends funds into that gateway. The source-chain transaction must confirm; RenVM then processes it and provides the data needed for the destination transaction, such as a mint. The app has to reconnect those steps to the same deposit after a reload, lost connection or device change.

A useful analogy is a parcel with several tracking scans: each scan says where the parcel is, but no single scan completes the trip. RenJS exposes progress as the transfer moves through its stages. The app’s job is to keep enough information to find that transfer again and show what remains. For background on the routes and their present status, see which RenBridge routes still work.

What does RenJS deposit state contain?

Deposit state is the information an integrator needs to identify a transfer, reconstruct its RenJS objects and report its progress. It is not a replacement for the source or destination blockchain. Those chains remain the record of submitted transactions; RenJS coordinates the work between them.

In RenJS v2, a deposit flow can expose a gateway address, deposit details, a transaction hash and a status as it advances. The documented statuses include detected, confirmed, signed, submitted and reverted. In v3, gateway and gateway-transaction parameters are serializable, so an integrator can save them and recreate the transaction later. The precise fields vary by version and route, so integrations should follow the API for the RenJS version they use.

At minimum, preserve the transfer’s identifying parameters and the chain transaction identifiers as they become available. Store the selected asset, source and destination details, gateway or transaction parameters, and the source-chain transaction reference. Record progress for the interface, but treat it as a checkpoint: on recovery, query or resume through RenJS and the relevant chain instead of assuming the saved status is still current.

What breaks when an app loses the deposit state?

Without saved state, the app may forget which gateway address it showed, lose the reference to a detected deposit or fail to resume a transfer after the source transaction confirms. The user can then see funds leave one chain without a clear explanation of what the destination step needs. The funds may still be traceable on-chain, but the app has lost its map between the source transaction and the remaining work.

Generating a new gateway is not the same as recovering the old one. A new gateway may represent different parameters or a different destination. If the user sent funds to the earlier address, the app must restore the matching transfer details rather than silently start over. This is why persistence is part of the transaction flow, not just a convenience for keeping a progress screen tidy.

How should an integrator save and resume a deposit?

Save the transfer record as soon as the gateway is created, then update it when each stage yields new information. Use durable storage tied to the user or session, not only in-memory component state. A practical record tracks:

  • The RenJS version, network, asset, source and destination.
  • The serializable gateway or transaction parameters needed to rebuild the flow.
  • The deposit address and source-chain transaction identifier, once known.
  • The last observed stage and any destination transaction identifier.

When the user returns, load that record, recreate the gateway or transaction using the version’s supported method, and reconcile its state with current chain data. Keep the saved stage for display, but let fresh observations determine what action is next. Make updates idempotent: seeing the same transaction or event twice should update one transfer record, not create duplicate deposits or submit the destination action twice.

Persisting state does not make confirmations faster or guarantee that a destination transaction succeeds. It makes the work recoverable and the user’s view more accurate. For an integrator, the sound rule is simple: save the parameters that identify the transfer, save each transaction reference, and verify progress again whenever the flow resumes.