Skip to content
Last update: January 26, 2024

Transaction broadcast

Info

Relevant JSON-RPC method: custodian_createTransaction

Responsibility

In MMI integrations, it is normally the custodian that broadcasts transactions. The custodian_createTransaction payload contains a property metadata.rpcUrl which is the URL of the JSON-RPC endpoint that the custodian should use to broadcast the transaction and monitor it until it is mined. The custodian can also use this RPC URL to get the nonce for signing the transaction.

Custodians may consider allowing their users to add their own JSON-RPC endpoints; this will allow supporting any chain. In turn, from a custodian web app, these chains can be added to MMI using the EIP-3085 wallet_addEthereumChain method described here.

It is also possible for parties other than custodians to broadcast transactions. The property metadata.custodianPublishesTransaction, if it is false, is an indication that the custodian should not publish the transaction. Additionally, a custodian may refuse to publish a transaction - they can indicate this by changing metadata.custodianPublishesTransaction to false in the webhook they send with the signature.

In such an instance, MMI’s backend will pick up the signature and RPC URL provided in the webhook and then publish the transaction.

How to support multiple chains

Supporting the same address on multiple chains is vital for bridging, as cross chain bridges generally allocate assets to the same address on both sides of the bridge. If you implement the Custodian JSON-RPC API, you can support whatever chains you wish.

custodian_createTransaction

The custodian_createTransaction method on the Custodian JSON-RPC API takes a second parameter, which includes the property chainId.

This is the network that the user intended to create the transaction on.

This parameter is needed to sign an ethereum transaction, and custodians can also use it to decide where to broadcast the transaction.

custodian_listAccountChainIds

A custodian_listAccountChainIds method exists on the Custodian JSON-RPC API which is executed when the extension is unlocked, for each custodian account stored in MMI.

This method takes a single parameter, the ethereum account address in question. Custodians may ignore this parameter if users use their addresses with all their configured chains.

Within the extension, this is used for two purposes:

  • Preventing users from copying their address when they have an unsupported network selected
  • Warning users that a specific chain is not supported before they send a transaction

When custodians (or their users) add a new chain, support for this chain can be signalled by adding it to the response for this command.