IMA-SDK is a tool for dApp developers that emulates SKALE Node + IMA env on a single machine for dev purposes. This article will demonstrate how to setup and use the IMA-SDK in combination with IMA-JS library for dApp development.
- Docker
- docker-compose
- nodejs (any version)
- Clone this repo
- Copy .env template and fill variables:
cp .env-compose-sample .env
nano .env
- Export environment variables:
export $(grep -v '^#' .env | xargs)
- Put SSL cert & key to
ssl
folder (names should bessl_key
andssl_cert
):
This step is optional You should have SSL certs and setup redirects by yourself
cp privkey.pem ~/skale-ima-sdk/ssl/ssl_key
cp cert.pem ~/skale-ima-sdk/ssl/ssl_cert
- Execute to run SDK and deploy contracts:
SDK_VERSION={put sdk version here} WAIT=True bash scripts/run_sdk.sh
Now sChain and Mainnet parts are available:
# sChain
http://$IP_ADDRESS:15000
http://$DOMAIN_NAME/schain # if you have SSL certs and domain name
https://$DOMAIN_NAME/schain # if you have SSL certs and domain name
# Mainnet
http://$IP_ADDRESS:1545
http://$DOMAIN_NAME/mainnet # if you have SSL certs and domain name
https://$DOMAIN_NAME/mainnet # if you have SSL certs and domain name
When you're done, stop SDK:
CLEANUP=True bash scripts/stop_sdk.sh
Mainnet chain ID: 0x561
sChain chain ID: 0x12345
You can pass any number of additional accounts to the SDK.
All accounts will have pre-allocated ETH both on Mainnet and sChain sides.
To do that add additional_accounts.json
file in the root of the project. Structure of the file:
[
{
"private_key": "0x...",
"address": "0x.."
},
{
"private_key": "0x...",
"address": "0x.."
}
...
]
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - &&
sudo apt-get install -y nodejs &&
node --version
git clone https://github.com/skalenetwork/skale-ima-sdk.git
cd skale-ima-sdk
The ABIs generated for the IMA smart contracts deployed to mainnet/testnet and the SKALE Chain can be found in the following folder:
skale-ima-sdk/contracts_data/proxyMainnet.json # Mainnet part
skale-ima-sdk/contracts_data/proxySchain_Bob.json # sChain part
Init repo for development
bash scripts/setup_ima.sh
Build and publish image:
DOCKER_USERNAME= DOCKER_PASSWORD= CONTAINER_NAME=ima_sdk BRANCH=develop VERSION=0.0.0 bash helper-scripts/build_and_publish.sh
tail -f data_dir/all_ima_deploy_mn.txt # Monitor IMA Mainnet deployment
tail -f data_dir/all_ima_deploy_sc.txt # Monitor IMA SKALE Chain deployment
tail -f data_dir/all_ima_registration.txt # Monitor IMA registration
tail -f data_dir/all_ima_loop.txt # Monitor IMA agent
CLEANUP=True bash scripts/stop_sdk.sh # Remove data files for rebuild
docker ps # Show running containers
docker stop [NAMES] # Stop container before rebuilding
Reach out to the developer community on Discord:
All contributions are made under the GNU Affero General Public License v3. See LICENSE.
Copyright (C) 2020-present SKALE Labs