LINK Chain で動くスマートコントラクト(極秘) / Smart Contract on LINK Chain

LINK Chain で動くスマートコントラクト(極秘) / Smart Contract on LINK Chain

Torao Takami @kuromoyo
LINE Corporation Blockchain Lab エンジニア

blockchain.tokyo#16 での発表資料です。
https://blockchain-tokyo.connpass.com/event/113023/

53850955f15249a1a9dc49df6113e400?s=128

LINE Developers

January 24, 2019
Tweet

Transcript

  1. 3.

    Fintech Platform Life Platform Contents Platform LINE Token Economy LINE

    Token Economy NEWS GAME γϣοϐϯά ほけん スマート投資 3rd Party Service … … όΠτ … …
  2. 4.

    Fintech Business LINE Tech Plus LINE Blockchain & Cryptocurrency LINE

    LVC BITBOX Cryptocurrency exchange Digital asset and blockchain business Blockchain Lab LINK Chain unchain ICON Foundation Blockchain platform development 3rd Party dApp Cryptocurrency exchange business
  3. 5.

    ⾃⼰紹介 鷹⾒ ⻁男(https://hazm.at) TAKAMI Torao @kuromoyo ⾦融系 SIer (フリー) と

    Web 系サービス開発を経て、フルスタックな Web システムや分散 システム、機械学習周辺を専⾨にエンジニアリングしています。昨年10⽉に LINE へ⼊社 し Blockchain Lab で Token Economy プラットフォームを開発中。
  4. 6.

    Whatʼs LINK Chain? Blockchain and Open Platform implementation for the

    LINE Token Economy Features Ethereum 2.0 LINK Chain 1.0 Participation public private Consensus Mechanism PoW + PoS (Casper FFG) 3-phase pBFT Finality available available Contract Runtime eWASM + EVM Python 3 dApp Administration - Service Operator Role Higher-Level API - LINK Framework Cryptocurrency / Token ETH / ERC20 Tokens LINK / LINK Point
  5. 7.

    Components of LINK Chain LINK Network C Node C Node

    C Node C Node C Node Leader S Node S Node S Node S Node S Node S Node dApp dApp dApp LINK Network • C Node … generate blocks • S Node … read only proxy Other LINK Network Root Chain dApp LINK Framework • API … higher-level API • SCAN … transaction tracker • Relayer … inter-linkchain relayer
  6. 8.

    Inside C-Node C Node Message Queue LINK Core Block DB

    State DB Interface S Node C Node LINK Framework dApp • Block generation and verification • P2P network state management • pBFT consensus mechanism https://logmi.jp/tech/articles/320359 LINK Service • Install, update and execute contracts • Control contract operation, consensus mechanism, etc. Contr act DB Contracts
  7. 9.

    Join the LINK Chain 5) Issue transaction to update whitelist

    6) And install smart contract as well 1) Request to join my dApp “Candy Point” to LINK Chain Admin Wallet space of Candy Point 3) New Admin Service Operator Wallet LINK Framework 4) Transfer mint tokens LINK Network 2) Confirm the smart contract Administrator Smart Contract
  8. 10.

    Smart Contract in Practice 環境セットアップは省略。 1. RabbitMQ, C-Node を起動 2.

    鍵 (User Address) の作成 3. Smart Contract プロジェクトの作成 4. Smart Contract のデプロイ → Contract Address 確認 5. Smart Contract の呼び出し
  9. 11.

    Smart Contract in Practice $ tbear init candypoint CandyPoint $

    cat candypoint/candypoint.py from linkservice import * TAG = 'CandyPoint' class CandyPoint(LinkContractBase): def __init__(self, db: LinkServiceDatabase) -> None: super().__init__(db) def on_install(self) -> None: super().on_install() def on_update(self) -> None: super().on_update() @external(readonly=True) def hello(self, name:str) -> str: return "Hello, %s" % name $ tbear deploy –k [keystore] candypoint transaction hash: [txhash] $ tbear txresult [txhash] ”scoreAddress": ”[contract_address]", $ cat call-hello.json { "jsonrpc": "2.0", "method": "icx_call", "params": { "from": ”[address_in_keystore]", "to": ”[contract_address]", "dataType": "call", "data": { "method": "hello", "params": { "name": "Takami Torao" } } }, "id": 1 } $ tbear call call-hello.json response : { "jsonrpc": "2.0", "result": "Hello, Takami Torao", "id": 1 } Smart Contract JSON to call method hello of CandyPoint