GithubHelp home page GithubHelp logo

forktonguedpygmy / skale-ima-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from skalenetwork/skale-ima-sdk

1.0 0.0 0.0 335 KB

Skale Network

License: GNU Affero General Public License v3.0

Shell 33.84% JavaScript 23.49% Dockerfile 3.00% Solidity 39.67%

skale-ima-sdk's Introduction

SKALE IMA SDK

Discord

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.

Usage guide

Prerequisites

  • Docker
  • docker-compose
  • nodejs (any version)

Initial setup

  1. Clone this repo
  2. Copy .env template and fill variables:
cp .env-compose-sample .env
nano .env
  1. Export environment variables:
export $(grep -v '^#' .env | xargs)
  1. Put SSL cert & key to ssl folder (names should be ssl_key and ssl_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

Run SDK

  1. 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

Usage

Mainnet chain ID: 0x561 sChain chain ID: 0x12345

Helpful info

Pass additional accounts

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.."
    }
    ...
]

Install Nodejs

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - &&
sudo apt-get install -y nodejs &&
node --version

Clone this repo

git clone https://github.com/skalenetwork/skale-ima-sdk.git
cd skale-ima-sdk

Access ABIs

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

Development

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 

Troubleshooting

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: Discord

License

All contributions are made under the GNU Affero General Public License v3. See LICENSE.

Copyright (C) 2020-present SKALE Labs

skale-ima-sdk's People

Contributors

dmytrotkk avatar cstrangedk avatar sergiy-skalelabs avatar payvint avatar tarasglek avatar

Stargazers

forktonguepygmy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.