Upgrade to Pro — share decks privately, control downloads, hide ads and more …

BBc-1 ハンズオン : デジタル通貨の送金とスワップを通して学ぶBBc-1 トランザクショ...

BBc-1 ハンズオン : デジタル通貨の送金とスワップを通して学ぶBBc-1 トランザクション / BBc-1 Hands on: Digital Currency Transfer and Swap

BBc-1 の開発中の共通ライブラリとデジタル通貨ライブラリ、および payment.py サンプルアプリケーションを用いたチュートリアルのスライドです。

beyond-blockchain.org

June 15, 2018
Tweet

More Decks by beyond-blockchain.org

Other Decks in Technology

Transcript

  1. BBc-1 BBc-1 ( ) / (1) (2) (3) BBc-1 —

    BBc-1 — 2020-05-14 – p.3/29
  2. #JUDPJO ##D$PSF ϨοδϟʔαϒγεςϜ ΞϓϦέʔγϣϯ ͦ ͷ ଞ ͞ · ͟

    · ͳ Ξ ϓ Ϧ ͷ Մ ೳ ੑ ڞ௨ϥΠϒϥϦ ##D ։ൃ߲໨ ஍ Ҭ ௨ ՟ Ξ ϓ Ϧ ϙ Π ϯ τ Ξ ϓ Ϧ དྷ ྺ ূ ໌ Ξ ϓ Ϧ ʜ ॳظʹ͓͍ͯଘࡏূ໌Λґଘ ΞϯΧϦϯά ֤ϊʔυʹ͓͚Δه࿥ʹ͸ ֤छσʔλϕʔεΛར༻Մೳ TRMJUF.Z42-ͦͷଞ%# BBc-1 σδλϧ௨՟ϥΠϒϥϦ ͦͷଞͷϥΠϒϥϦ CCDMJC 1ZUIPO (P +4 FUD Bitcoin Ethereum ( ) (Proof of Context) ( ) ( ) BBc-1 — BBc-1 — 2020-05-14 – p.4/29
  3. bbc1 Python bbc1env $ source bbc1env/bin/activate GitHub git clone $

    git clone -b develop https://github.com/beyond-blockchain/bbc1-lib-std.git $ cd bbc1-lib-std tar pip $ python setup.py sdist $ pip install dist/bbc1-lib-std-0.19.tar.gz dist tar pip install BBc-1 — BBc-1 — 2020-05-14 – p.6/29
  4. ( SQLite3 ) ( ) ( ) ( ) (

    ) BBc-1 — BBc-1 — 2020-05-14 – p.7/29
  5. GitHub git clone ( ) $ git clone -b develop

    https://github.com/beyond-blockchain/bbc1-lib-tokens.git $ cd bbc1-lib-tokens tar pip (Python ) $ python setup.py sdist $ pip install dist/bbc1-lib-tokens-0.16.tar.gz dist tar pip install bbc_core.py $ bbc_core.py --no_nodekey BBc-1 — BBc-1 — 2020-05-14 – p.8/29
  6. payment GitHub git clone $ git clone https://github.com/beyond-blockchain/examples.git $ cd

    examples/payment payment.py BBc-1 BBc-1 — BBc-1 — 2020-05-14 – p.12/29
  7. payment ( ) ( (mint) ) ( ) BBc-1 —

    BBc-1 — 2020-05-14 – p.13/29
  8. $ python payment.py --help (bbc_core.py ) $ python payment.py setup

    “./.bbc1_app_support” BBc-1 — BBc-1 — 2020-05-14 – p.14/29
  9. alice bob $ python payment.py def-user alice $ python payment.py

    def-user bob alice bob ( ) BBc-1 — BBc-1 — 2020-05-14 – p.15/29
  10. $ python payment.py user alice ∗bob bob ( bob )

    alice $ python payment.py user alice ∗alice bob BBc-1 — BBc-1 — 2020-05-14 – p.16/29
  11. $ python payment.py def-currency Yen JPY default_spec.json (mint) ( )

    $ python payment.py currency ∗Yen BBc-1 — BBc-1 — 2020-05-14 – p.17/29
  12. alice 1,000 $ python payment.py issue 1000 alice mint alice

    bob $ python payment.py status alice balance = 1000JPY. $ python payment.py status bob balance = 0JPY. BBc-1 — BBc-1 — 2020-05-14 – p.18/29
  13. alice bob 100 $ python payment.py transfer 100 bob alice

    mint $ python payment.py status alice balance = 900JPY. $ python payment.py status bob balance = 100JPY. BBc-1 — BBc-1 — 2020-05-14 – p.19/29
  14. 2 $ python payment.py def-currency Dollar USD decimal_2.json mint (

    ) $ python payment.py currency Yen ∗Dollar BBc-1 — BBc-1 — 2020-05-14 – p.20/29
  15. (1) ( ) bob 10 $ python payment.py issue 10

    bob mint alice bob $ python payment.py status alice balance = 0.00USD. $ python payment.py status bob balance = 10.00USD. BBc-1 — BBc-1 — 2020-05-14 – p.21/29
  16. (2) $ python payment.py currency Yen ∗Yen Dollar alice bob

    1 110 (bob alice 110 1 ) $ python payment.py swap 110 bob 1 Dollar alice, bob, mint, mint BBc-1 — BBc-1 — 2020-05-14 – p.22/29
  17. (3) alice bob $ python payment.py status alice balance =

    790JPY. $ python payment.py status bob balance = 210JPY. $ python payment.py currency Dollar Yen ∗Dollar $ python payment.py status alice balance = 1.00USD. $ python payment.py status bob balance = 9.00USD. BBc-1 — BBc-1 — 2020-05-14 – p.23/29
  18. token lib mint token_lib.BBcMint mint.transfer() . . . transaction mint.store.sign()

    . . . mint.store.sign_and_insert() . . . BBc-1 — BBc-1 — 2020-05-14 – p.27/29
  19. 319 mint.swap(counter_mint, user.user_id, counter_user.user_id, value1, value2, keypair_this=user.keypair, keypair_that=counter_user.keypair, keypair_mint=currency.keypair, keypair_counter_mint=counter_currency.keypair)

    ⇓ tx = mint.transfer(user.user_id, counter_user.user_id, value1) counter_mint.transfer(counter_user.user_id, user.user_id, value2, transaction=tx) mint.store.sign(tx, counter_user.user_id, counter_user.keypair) mint.store.sign(tx, mint.mint_id, currency.keypair) mint.store.sign(tx, counter_mint.mint_id, counter_currency.keypair) mint.store.sign_and_insert(tx, user.user_id, user.keypair, mint.idPublickeyMap) BBc-1 — BBc-1 — 2020-05-14 – p.28/29