Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

AstarNetwork/ink-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecation

This project is no longer actively maintained by the team. For the active version, please visit the new ink! Playground maintained by Parity Technologies.

ink! playground

https://ink-playground.com/

Introduction

ink! playground is the browser IDE for Substrate's smart contract(srml-contract). This will be similar to Remix, the smart contract IDE of Ethereum. Currently, if developers want to run ink! smart contract, they have to install substrate and ink into local environment. But this takes many steps, and also it is not easy to run stably because of version compatibility issues or so. By using ink! playground, Substrate developers can test contracts easily just by writing main code on browser. It doesn't require installing Substrate or running Substrate node. This is very useful for Substrate smart contract developers. For the future works, ink! playground also provides high level security audits. This is for developer who wants to make high secured smart contracts like for enterprise use.

Demo

You can try from here

Imgur

Usage

Refer this page fow the usage of ink! playground. https://www.notion.so/staketechnologies/beaa0bab965a4b809b6f649b0db3b232

Specification

overview

ink! playground consists of three docker containers.

  • ink container
  • api container
  • web front container

ink container

Dockerfile is located at ink/Dockerfile

Rust and ink environment is set in the docker image, and this is called from api container. mounted directory is /code/ink_compile/

api container

Configure is written at "rest_api" in docker-compose.yml Dockerfile is located at python/Dockerfile Django source code is in /code/rest_api/test_app

This is an api server to compile ink! code into wasm. This container calls ink container for compiling.

web front container

Configure is written at "web_front" in docker-compose.yml Dockerfile is located at node/Dockerfile ReactJS source code is in is /code/web_front/

How to run

Environment

Docker should be installed.

Installing

git clone https://github.com/stakedtechnologies/ink-playground.git
cd ink-playground

#make .env file
./init.sh <PUBLIC_DNS>

At <PUBLIC_DNS>, insert public dns of the server (exclude "http://"). If you want to test locally, do like this: ./init.sh localhost

Running

./build.sh
docker build -t ink_env ink
docker-compose up -d

open another terminal and do the following.

#start api server
docker-compose exec rest_api python3 websocket_app/server.py

open another terimnal and do the following.

#only for the first time before running
docker-compose exec web_front yarn install

#start web front server
docker-compose exec web_front yarn start

After running, you can access to page by http://localhost/

Stopping

docker-compose down