Local Sygma Setup
The local setup contains preconfigured resources including:
- two EVM networks running on Ganache with Sygma contracts already deployed
- The networks are named
EVM1 and EVM2 respectively
- one Substrate network with Sygma pallets already implemented
- The network is named
Substrate
- three relayer instances listening for, voting, and executing on events
- a fee oracle
More details can be found in the local configuration.
To interact with the local setup using the Sygma SDK, set SYGMA_ENV environment variable as local.
Running the local setup example
We will be running the example provided inside the Sygma SDK repository.
1) Clone the Sygma Relayer repository
First, clone the Sygma relayer repository into a directory of your choice:
git clone https://github.com/sygmaprotocol/sygma-relayer.git
2) Start local setup
cd into the cloned sygma-relayer folder, and then run the following command, which will start the dockerized setup:
:::note Be aware
The make example will require several GB's of space on your machine while it is running. You can follow this documentation to prune unused containers, networks, images, and volumes after you are done with the example in full.
:::
3) Clone the Sygma SDK repository
Next, clone the Sygma SDK repository into a directory of your choice, and then cd into that folder:
git clone git@github.com:sygmaprotocol/sygma-sdk.git
cd sygma-sdk/
4) Build the SDK
If you haven't already done so, install dependencies with:
And build the SDK by running:
4) Run the EVM-to-Substrate token transfer example
-
cd into the evm-to-substrate-fungible-transfer example inside the /sygma-sdk/examples folder
-
Update RPC Urls and transfer parameters in the example with local configuration
-
run:
This will start a local ERC-20 transfer of the ERC20LRTest token using the local Sygma setup. It will use ethers together with the sygma-sdk to create a transfer from the EVM1 network to the Substrate network.
5) Run the Substrate-to-EVM token transfer example
To demonstrate the exact same transfer in the other direction, you can use the example substrate-to-evm-fungible-transfer and follow similar steps of the previous example.
Similarly, this will use @polkadot/api together with the sygma-sdk to create an ERC20LRTest transfer from the Substrate network to the EVM1 network.
:::note
To easily verify the bridging transactions, we have added console logs that will print out the transaction hashes and token balances. Additionally, you can verify the Substrate transactions (called extrinsics in the Dotsama ecosystem) by connecting to the locally hosted node using Polkadot.js. This will give you access to the Polkadot.js block explorer. From here, you can paste in the Substrate transaction hashes to verify the chain state.
:::
Make changes to onchain Sygma setup
Once you start the local setup, it is possible to configure the Sygma EVM contracts or Sygma Substrate pallets, since all node RPC endpoints are exposed and you can interact with them as with any regular node.
Local Sygma Setup
The local setup contains preconfigured resources including:
EVM1andEVM2respectivelySubstrateMore details can be found in the local configuration.
To interact with the local setup using the Sygma SDK, set
SYGMA_ENVenvironment variable aslocal.Running the local setup example
We will be running the example provided inside the Sygma SDK repository.
1) Clone the Sygma Relayer repository
First, clone the Sygma relayer repository into a directory of your choice:
2) Start local setup
cdinto the cloned sygma-relayer folder, and then run the following command, which will start the dockerized setup::::note Be aware
The
make examplewill require several GB's of space on your machine while it is running. You can follow this documentation to prune unused containers, networks, images, and volumes after you are done with the example in full.:::
3) Clone the Sygma SDK repository
Next, clone the Sygma SDK repository into a directory of your choice, and then
cdinto that folder:git clone git@github.com:sygmaprotocol/sygma-sdk.git cd sygma-sdk/4) Build the SDK
If you haven't already done so, install dependencies with:
And build the SDK by running:
4) Run the EVM-to-Substrate token transfer example
cdinto theevm-to-substrate-fungible-transferexample inside the/sygma-sdk/examplesfolderUpdate RPC Urls and transfer parameters in the example with local configuration
run:
This will start a local ERC-20 transfer of the
ERC20LRTesttoken using the local Sygma setup. It will useetherstogether with the sygma-sdk to create a transfer from theEVM1network to theSubstratenetwork.5) Run the Substrate-to-EVM token transfer example
To demonstrate the exact same transfer in the other direction, you can use the example
substrate-to-evm-fungible-transferand follow similar steps of the previous example.Similarly, this will use
@polkadot/apitogether with the sygma-sdk to create anERC20LRTesttransfer from theSubstratenetwork to theEVM1network.:::note
To easily verify the bridging transactions, we have added console logs that will print out the transaction hashes and token balances. Additionally, you can verify the Substrate transactions (called
extrinsicsin the Dotsama ecosystem) by connecting to the locally hosted node using Polkadot.js. This will give you access to the Polkadot.js block explorer. From here, you can paste in the Substrate transaction hashes to verify the chain state.:::
Make changes to onchain Sygma setup
Once you start the local setup, it is possible to configure the Sygma EVM contracts or Sygma Substrate pallets, since all node RPC endpoints are exposed and you can interact with them as with any regular node.