chaintope / workshop202107

ブロックチェーン勉強会で用いたWorkshopのサンプルコード

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README

2021年7月ブロックチェーン勉強会のworkshopで用いるサンプルコード

  1. Dockerを使った開発モードのtapyrus nodeの立て方と操作方法については以下を参照

  2. Gluebyの使い方については以下を参照

How to use

Gluebyの一番基本的なContractであるGlueby::Contract::Paymentを用いた送金処理をrake taskとして実装している。 以下の手順に従っでtaskを試すことができる。

  1. tapyrus nodeを起動する

    docker-compose up -d tapyrusd
  2. dbを作成する。

    bundle exec rails db:migrate
  3. faucet, sender, receiverのwalletを生成する。以下のコマンドを3回発行する。

    bundle exec rails tapyrus:createwallet
  4. 生成されたwallet idをlib/tasks/tapyrus.rakeのFAUCET_ID, SENDER_ID, RECEIVER_IDに設定する。

  5. blockを生成する。

    bundle exec rails tapyrus:generate
    bundle exec rails glueby:contract:block_syncer:start
  6. faucetからTCPを引き出す(faucetからsenderに送金する)。

    bundle exec rails tapyrus:faucet
  7. blockを生成してtransactionを確定させる。

    bundle exec rails tapyrus:generate
    bundle exec rails glueby:contract:block_syncer:start
  8. senderからreceiverにTCPを送金する。

    bundle exec rails tapyrus:payment
    bundle exec rails tapyrus:generate
    bundle exec rails glueby:contract:block_syncer:start
  9. faucet, sender, receiverの残高を確認する。

    bundle exec rails tapyrus:getbalance

その他の情報

  • lib/tasks/tapyrus.rakeのより詳細な情報については、 skeleton ブランチを参照
  • Gluebyのその他のContractの使用例については、 all_samples ブランチを参照
  • Gluebyを用いたWeb Appの作成方法については、 web_ui ブランチを参照

About

ブロックチェーン勉強会で用いたWorkshopのサンプルコード


Languages

Language:Ruby 77.0%Language:HTML 12.5%Language:JavaScript 7.6%Language:CSS 1.5%Language:Dockerfile 1.4%