Skip to content

Latest commit

 

History

History
133 lines (82 loc) · 2.74 KB

TUTORIAL.md

File metadata and controls

133 lines (82 loc) · 2.74 KB

Install and running tutorial

Currently only solo mode is supported.

1. Environment Setup

Requirements

  • Go-lang >= 1.9
  • Docker >= 17.12.0
  • Rabbitmq >= 3.7.7
  • Dep >= 1.11
  1. Install Engine

    go get github.com/it-chain/engine
  2. Move to engine folder

    cd $GOPATH/src/github.com/it-chain/engine
  3. Install dependencies

    dep ensure
    
  4. Run engine

    Make sure to run rabbitmq and docker before run it-chain

    go install it-chain.go
    it-chain

    [tutorial]run

  5. Check block on http://localhost:4444/blocks

    [tutorial]api-blocks

2. Installing a icode

Sample icode url: https://github.com/junbeomlee/learn-icode

  1. Fork learn-icode

    [tutorial]fork

  2. Add deploy key

    How to generate key?

    In terminal or cmd, type ssh-keygen -t rsa

    Then you can see .ssh directory on the path where you typed keygen command

    In .ssh, there's id_rsa, id_rsa.pub. You need to add Deploy keys to github using id_rsa.pub

    [tutorial]sshkey

    • If you clone public repository, you can skip this process.
  3. Deploy learn-icode

    • Deploy with ssh key

      it-chain ivm deploy [learn-icode-url] [ssh-private-key-path] [password]

      deploy command clone from target repsoitory, and create docker container with that code
      If you don't set ssh key password, you can skip to write [password]

      [tutorial]deploy

      [tutorial]deploy-result

    • Deploy with no ssh key

      it-chain ivm deploy [learn-icode-url]

      We support to clone public repository. You can deploy learn-icode with no ssh [tutorial]deploy

    • Check docker container

      docker ps

      [tutorial]docker

    • Check icode on http://localhost:4444/icodes

      [tutorial]api-icodes

3. Invoke a Transaction

  1. Invoke initA function using cmd (initA function sets key value A to zero)
it-chain ivm invoke [IcodeID] initA

[tutorial]invoke

  1. After invoking a initA, query getA (getA function get value of key A)
it-chain ivm query [IcodeID] getA

[tutorial]query

  1. If you invoke incA, you can increase the value of A
it-chain ivm invoke [IcodeID] incA

[tutorial]incA

  1. Check block on http://localhost:4444/blocks