ICON Workshop

October 8, 2018

iBriz.aihttps://github.com/ibriz/

ICON Workshop
https://gitlab.com/ibriz/icon-workshop/wikis/ICON-Workshop
https://docs.google.com/document/d/1pLXtKy8Kpg4TJHXGGCHGa7rd2yhK5NZZMC9T9So_v1c/

Docker image: https://hub.docker.com/r/ibriz/icon-workshop/

 

Repositories

IdolToken
SCORE – https://github.com/ibriz/ibriz-icon-foundation-idoltoken
API – https://github.com/ibriz/icon-idoltoken-api
UI – https://gitlab.com/bitsbeat/icon-idoltoken-ui

ICON Dice Roll
https://gitlab.com/ibriz/icon-dice-roll

 


 

Workshop Guide:

Set up ICONex wallet and Docker if you have not done so already:

Install ICONex Wallet:

https://icon-project.github.io/docs/wallet.html#using-iconex

Point it to the Testnet:

https://icon-project.github.io/docs/icon_network.html

Install Docker:

https://www.docker.com/get-started

Check your installation:

https://docs.docker.com/get-started/#test-docker-installation

 

<Presentation Slide 3>

>docker –version

>docker pull ibriz/icon-workshop

 

Or, if you have to load from a flash drive:

>docker load -i /Volumes/iBriz1/ibriz_icon_workshop.tgz

 

>docker images

 

Keep a browser tab open to refer to the code:

repo:

SCORE:

 

<Presentation Slide 4>

>docker run -it -p 127.0.0.1:9000:9000 -p 127.0.0.1:5000:5000 –rm ibriz/icon-workshop:latest

 

Open another terminal tab with a shell for the container. You will need it later.

>docker ps    #lists the container id

>docker exec -it <container-id>  /bin/bash

(This will open in the /tbears directory)

 

>tbears –help

 

<Presentation Slide 7>

>tbears deploy dice-roll -k keystores/keystore_test1.json -c config/tbears_cli_config.json

(Password: test1_Account)

 

>tbears txresult <txhash>

 

<Presentation Slide 8>

Copy the scoreAddress from the result

 

<Presentation Slide 9>

Edit the file testcmdline/send_set_treasury.json

>vi /tbears/icon-dice-roll/testcmdline/send_set_treasury.json

Update destination SCORE address (to: attribute)

 

>tbears sendtx -k keystores/keystore_test1.json -c config/tbears_cli_config.json testcmdline/send_set_treasury.json

 

>tbears balance <score address>

 

<Presentation Slide 10>

Edit webapp/main.py to update SCORE address

>vi /tbears/icon-dice-roll/webapp/main.py

Replace the address assigned to default_score on line 17.

 

<Presentation Slide 11>

Edit the file testcmdline/send_bet.json

>vi /tbears/icon-dice-roll/testcmdline/send_bet.json

Update destination SCORE address (to: attribute)

 

>tbears sendtx -k keystores/keystore_test1.json -c config/tbears_cli_config.json testcmdline/send_bet.json

 

<Presentation Slide 12>

>tbears txresult <txhash>

>tbears balance <score address>

 

<Presentation Slide 13>

>tbears sendtx -k keystores/keystore_test1.json -c config/tbears_cli_config.json testcmdline/send_bet.json

 

<Presentation Slide 14>

Set up ICONex wallet and Docker if you have not done so already:

Install ICONex Wallet:

https://icon-project.github.io/docs/wallet.html#using-iconex

 

Copy your keystore file into the container:

>docker ps

>docker cp <UTC–2018-???> <container id>:/tbears/icon-dice-roll/keystores/keystore1.json

 

<Presentation Slide 15>

Point your wallet to the Testnet:

https://icon-project.github.io/docs/icon_network.html

 

Request ICX from the faucet app:

http://52.88.70.222/

http://icon-faucet.ibriz.ai/

 

<Presentation Slide 17>

Deploy to Testnet:

>tbears deploy dice-roll -k keystores/keystore1.json -c config/tbears_cli_config_testnet.json

 

>tbears txresult <txhash> -c config/tbears_cli_config_testnet.json

 

Check if it was successfully deployed:

https://bicon.tracker.solidwallet.io/contract/<score_address>

 

<Presentation Slide 18>

Edit the file testcmdline/send_set_treasury.json

>vi /tbears/icon-dice-roll/testcmdline/send_set_treasury.json

Update destination SCORE address (to: attribute)

 

>tbears sendtx -k keystores/keystore1.json -c config/tbears_cli_config_testnet.json testcmdline/send_set_treasury.json

 

https://bicon.tracker.solidwallet.io/contract/<score_address>

 

<Presentation Slide 19>

Edit webapp/main.py to update SCORE address

>vi /tbears/icon-dice-roll/webapp/main.py

Replace the address assigned to default_score on line 17.

On line 18 replace http://127.0.0.1:9000/api/v3 with

https://bicon.net.solidwallet.io/api/v3

 

>cd /tbears/icon-dice-roll/webapp

>python3 main.py

 

<Presentation Slide 20>

Send from your wallet to the SCORE and check with the tracker

https://bicon.tracker.solidwallet.io/contract/<score_address>