Skip to main content

Crosschain Transaction

You can perform a crosschain transaction via the DEMOS network with the help of the DEMOS sdk. Here is how you can send tokens on Sepolia testnet via DEMOS using the sdk:

0. Imports

The following imports will be needed to create the transaction.

1. Creating the EVM payload

You can create the payload for Sepolia via the crosschain module of the sdk as follows:
The evm_tx will be a signed transaction to move 0.000000001 Sepolia ETH from the connected wallet to0xda3ea78Af43E6B1c63A08cD0058973F14e5556b0.

2. Converting the payload into an XMScript

The XMScript contains information that helps a DEMOS node understand what to do with a signed crosschain payload.
The xmscript will be embedded into a DEMOS transaction and sent to the DEMOS network in the upcoming sections.

3. Creating a DEMOS instance

A DEMOS identity is needed to sign the outgoing DEMOS transaction.

4. Converting the XMScript to a Demos transaction

You can convert the xmscript into a DEMOS transaction by calling prepareXMPayload and passing the xmscript and the Demos instance.
The tx will be a signed Demos transaction containing the Sepolia tx.

5. Broadcasting to a Demos node

You can now broadcast the transaction as shown: