Full Local Setup
Deploy local Sovereign Chain
This guide will help you deploy a full sovereign local network connected to MultiversX network. This includes all the smart contracts and dependent services needed. Follow these steps carefully to ensure a successful deployment.
Step 1: Get the mx-chain-go
Repository
Before proceeding, ensure that a SSH key for GitHub is configured on your machine.
-
Clone the GitHub repository:
git clone git@github.com:multiversx/mx-chain-go.git
-
Checkout the specific Sovereign Chain SDK branch and navigate to testnet directory:
cd mx-chain-go && git fetch && git checkout d699ffd6a29513c573b1d212861f932e037d8f67 && cd scripts/testnet
infod699ffd6a29513c573b1d212861f932e037d8f67
is the commit hash we recommend to be used. If you want to use the latest version you can use the branchfeat/chain-go-sdk
. -
Run the prerequisites script:
./prerequisites.sh
infoThe prerequisites script verifies and downloads the necessary packages to run the nodes and clones the required repositories:
- mx-chain-deploy-go: Initializes the configuration for the chain and deployment parameters.
- mx-chain-proxy-go: Repository for the proxy.
- mx-chain-sovereign-bridge-go: Repository for the cross-chain service.
- mx-chain-tools-go: Repository for updating elastic indices.
Step 2: Deploy Sovereign setup
Navigate to the sovereignBridge
folder:
cd sovereignBridge
-
Install the software dependencies and download the cross-chain contracts by running the sovereign bridge prerequisites script:
./prerequisites.sh
-
Create a new wallet:
mxpy wallet new --format pem --outfile ~/wallet.pem
infoThis wallet is the owner for cross chain smart contracts and is used by the sovereign bridge service.
noteYou can use any wallet of your choice, but for the purpose of this guide we are generating a new wallet.
-
Get funds in this wallet on the chain (testnet/devnet/mainnet) you want the sovereign to be connected to.
-
Update the configuration file
config/configs.cfg
with paths you want to use, wallet location and main chain constants. The following example shows the paths you have to use in order to connect to public MultiversX testnet:# Sovereign Paths
SOVEREIGN_DIRECTORY="~/sovereign"
TXS_OUTFILE_DIRECTORY="${SOVEREIGN_DIRECTORY}/txsOutput"
CONTRACTS_DIRECTORY="${SOVEREIGN_DIRECTORY}/contracts"
# Owner Configuration
WALLET="~/wallet.pem"
# Main Chain Constants
PROXY = https://testnet-gateway.multiversx.com
CHAIN_ID = Tnote- SOVEREIGN_DIRECTORY, TXS_OUTFILE_DIRECTORY, CONTRACTS_DIRECTORY - represent the paths to the location where the deployment scripts will generate the outputs.
- WALLET - should represent the wallet generated at Step 2.2.
- PROXY - in this case, for the purpose of the test, the used proxy is the testnet one. Of course that the proper proxy should be used when deploying your own set of contracts depending on the development phase of your project.
- CHAIN_ID - should represent the chain ID of the chain where the contracts are to be deployed.
- "1" for Mainnet;
- "D" for Devnet;
- "T" for Testnet;
- or use you own local network ID
-
Source the script:
source script.sh
-
Deploy all cross-chain contracts on main chain and deploy Sovereign Chain with all required services:
deploySovereignWithCrossChainContracts
infodeploySovereignWithCrossChainContracts
command will:- deploy all main chain smart contracts and update sovereign configs
- deploy sovereign nodes and the main chain observer
Step 3: Deploy services
You can find the documentation on how to deploy services here.
Stop and clean local Sovereign Chain
-
Navigate to
mx-chain-go/scripts/testnet/sovereignBridge
. Source the script:source script.sh
-
Stop and clean the chain, and all sovereign services:
stopAndCleanSovereign
Upgrade and reset local Sovereign Chain
-
Navigate to
mx-chain-go/scripts/testnet/sovereignBridge
. Source the script:source script.sh
-
Upgrade and reset the chain, and all sovereign services:
sovereignUpgradeAndReset