Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
BBc-1 実習 / Beyond Blockchain One : Practice
Search
Kenji Saito
PRO
August 01, 2018
Technology
1
250
BBc-1 実習 / Beyond Blockchain One : Practice
2018年8月1日(水)、ブロックチェーンハブ主催で開催されたブロックチェーンアカデミー「BBc-1 実習」(【ハンズオン】スマートコントラクトプログラミング (4)) にて使用したスライドです。
Kenji Saito
PRO
August 01, 2018
Tweet
Share
More Decks by Kenji Saito
See All by Kenji Saito
デジタルトランスフォーメーションと民主主義 / Digital Transformation and Democracy
ks91
PRO
0
2
We Never Took the Kobayashi Maru Test Until Now. What Do You Think of Our Solutions? — Journeys of the Mind Through a No-Win Game
ks91
PRO
0
14
思いつきが武器になる:研究というゲームを始めよう / Ideas Are Your Equipments : Let the Game of Research Begin!
ks91
PRO
0
73
ロボットを雰囲気(ヴァイブ)でプログラミングするこどもたち / Children Vibe-Programming Robots
ks91
PRO
0
21
アカデミーキャンプ 2025 SuuuuuuMMeR「燃えろ!!ロボコン」 / Academy Camp 2025 SuuuuuuMMeR "Burn the Spirit, Robocon!!" DAY 3
ks91
PRO
0
30
アカデミーキャンプ 2025 SuuuuuuMMeR「燃えろ!!ロボコン」 / Academy Camp 2025 SuuuuuuMMeR "Burn the Spirit, Robocon!!" DAY 2
ks91
PRO
0
33
アカデミーキャンプ 2025 SuuuuuuMMeR「燃えろ!!ロボコン」 / Academy Camp 2025 SuuuuuuMMeR "Burn the Spirit, Robocon!!" DAY 1
ks91
PRO
0
160
未来へのフォワードキャスト / Forward Cast to the Future
ks91
PRO
0
86
発表と総括 / Presentations and Summary
ks91
PRO
0
61
Other Decks in Technology
See All in Technology
AWS環境のリソース調査を Claude Code で効率化 / aws investigate with cc devio2025
masahirokawahara
2
1.4k
自作JSエンジンに推しプロポーザルを実装したい!
sajikix
1
160
生成AIでセキュリティ運用を効率化する話
sakaitakeshi
0
260
なぜスクラムはこうなったのか?歴史が教えてくれたこと/Shall we explore the roots of Scrum
sanogemaru
5
1.3k
Skrub: machine-learning with dataframes
gaelvaroquaux
0
120
COVESA VSSによる車両データモデルの標準化とAWS IoT FleetWiseの活用
osawa
0
170
フィンテック養成勉強会#56
finengine
0
130
エラーとアクセシビリティ
schktjm
0
1k
ヘブンバーンズレッドにおける、世界観を活かしたミニゲーム企画の作り方
gree_tech
PRO
0
570
ChatGPTとPlantUML/Mermaidによるソフトウェア設計
gowhich501
1
120
生成AI時代のデータ基盤設計〜ペースレイヤリングで実現する高速開発と持続性〜 / Levtech Meetup_Session_2
sansan_randd
1
140
LLM翻訳ツールの開発と海外のお客様対応等への社内導入事例
gree_tech
PRO
0
580
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
800
Making Projects Easy
brettharned
117
6.4k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
How to Ace a Technical Interview
jacobian
279
23k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.5k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Visualization
eitanlees
148
16k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.8k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Transcript
BBc-1 (4) CSO / SFC ( https://speakerdeck.com/ks91 )
[email protected]
BBc-1
— (4) — 2018-08-01 – p.1/43
1. : 2. : 3. / BBc-1 — (4) —
2018-08-01 – p.2/43
1. BBc-1 2. BBc-1 3. 4. Ethereum ( ) BBc-1
— (4) — 2018-08-01 – p.3/43
1. BBc-1 BBc-1 BBc-1 — (4) — 2018-08-01 – p.4/43
BBc-1 BBc-1 / (1) (2) (3) BBc-1 — (4) —
2018-08-01 – p.5/43
#JUDPJO ##D$PSF ϨοδϟʔαϒγεςϜ ΞϓϦέʔγϣϯ ͦ ͷ ଞ ͞ · ͟
· ͳ Ξ ϓ Ϧ ͷ Մ ೳ ੑ ڞ௨ϥΠϒϥϦ ##D ։ൃ߲ Ҭ ௨ ՟ Ξ ϓ Ϧ ϙ Π ϯ τ Ξ ϓ Ϧ དྷ ྺ ূ ໌ Ξ ϓ Ϧ ʜ ॳظʹ͓͍ͯଘࡏূ໌Λґଘ ΞϯΧϦϯά ֤ϊʔυʹ͓͚Δهʹ ֤छσʔλϕʔεΛར༻Մೳ TRMJUF.Z42-ͦͷଞ%# BBc-1 σδλϧ௨՟ϥΠϒϥϦ ͦͷଞͷϥΠϒϥϦ Bitcoin Ethereum ( ) ( ) BBc-1 — (4) — 2018-08-01 – p.6/43
2. BBc-1 : https://github.com/beyond-blockchain/bbc1/blob/develop/docs/BBc1_core_tutorial_installation_ja.md Python BBc-1 — (4) — 2018-08-01
– p.7/43
Python 3.5.0 (3.6.0 ) ( + pipenv) macOS + Homebrew
$ brew install libtool automake pkg-config libffi autoconf openssl Linux (Ubuntu 16.04 LTS ) $ sudo apt install -y git tzdata openssh-server libffi-dev net-tools autoconf automake libtool libssl-dev pkg-config make Windows 10 Linux (Ubuntu 16.04 LTS ) BBc-1 — (4) — 2018-08-01 – p.8/43
Python (venv) macOS ‘python3.6’ ‘python3’ $ python3.6 -m venv bbcenv
$ source bbcenv/bin/activate (bbcenv) $ pip install -U pip (bbcenv) $ deactivate BBc-1 — (4) — 2018-08-01 – p.9/43
pip $ pip install bbc1 develop $ bbc_core.py --no_nodekey --no_nodekey
Python 3.7.0 “bad argument to internal function” $ pip install -U --force-reinstall --no-binary :all: gevent <CTRL>+C BBc-1 — (4) — 2018-08-01 – p.10/43
(develop pip ) pip install $ git clone https://github.com/beyond-blockchain/bbc1.git $
cd bbc1 $ python setup.py sdist $ pip install dist/bbc1-1.0.1.tar.gz dist tar pip install BBc-1 — (4) — 2018-08-01 – p.11/43
3. BBc-1 Core : https://github.com/beyond-blockchain/bbc1/blob/develop/docs/BBc1_core_tutorial_file_proof_ja.md BBc-1 — (4) — 2018-08-01
– p.12/43
file proof ( ) ( ) ( ) BBc-1 —
(4) — 2018-08-01 – p.13/43
bbc_core.py venv file_proof $ source bbcenv/bin/activate BBc-1 — (4) —
2018-08-01 – p.14/43
--help $ file_proof.py --help file_proof.py $ file_proof.py keypair $ file_proof.py
setup BBc-1 — (4) — 2018-08-01 – p.15/43
$ cat > test.txt BBC HEAVEN. <CTRL>+D $ more test.txt
BBC HEAVEN. file_proof.py BBc-1 Core $ file_proof.py store test.txt BBc-1 Core BBc-1 — (4) — 2018-08-01 – p.16/43
(1) ——- Dump of the transaction data —— * transaction_id:
b’de0af83d66170096dac81c4889bed3e1a20b6ab3eb3ae789adf8a580e25c100c’ version: 0 timestamp: 1529296860 Event[]: 0 Reference[]: 0 Relation[]: 1 [0] asset_group_id: b’45b2a200ccdcdcc3fb80cc9d423e1069f3ca726157f6492b4a70a48e4a1713ab’ Asset: asset_id: b’8bd26d0774050015181185de631c48bdfba411b64fb318f3cbfe8df2dcc80a9d’ user_id: b’e59c553504ca7a54f888eb47e61b773a221ae1311bd58ec4c0912d71c443d715’ nonce: b’83136a5fe6a76ab0’ file_size: 12 file_digest: b’7a30a5ef92e4f84287225e980c48ad3a7c29ea929a710d6b798a9bdcc41afc97’ body_size: 21 body: b’Owner is user_default’ BBc-1 — (4) — 2018-08-01 – p.17/43
(2) Witness: [0] user_id: b’e59c553504ca7a54f888eb47e61b773a221ae1311bd58ec4c0912d71c443d715’ sig_index: 0 Cross_Ref: None Signature[]:
1 [0] key_type: 1 signature: b’2a99a304311eacec015f99638584865faf5c7b5b609f0a04762ea40828baf11934df 6cc22289287362b9f9d6deb7f2c6f9528d0aab61b059292f50646942e553’ pubkey: b’04dc03d221c173fb2cf49bd4f2077fdd88babaa8234a96353b245cb3450ca665a12adb1 86695040188b366f12569b892c63f8410b9e471c4f1cf6f3ff96ddc48fc’ BBc-1 — (4) — 2018-08-01 – p.18/43
BBc-1 Core $ rm test.txt $ file_proof.py get test.txt BBc-1
— (4) — 2018-08-01 – p.19/43
BBc-1 Core $ file_proof.py verify test.txt 1 test.txt is valid
1 test.txt is invalid BBc-1 — (4) — 2018-08-01 – p.20/43
BBc-1 Core $ file_proof.py update test.txt BBc-1 Core verify $
file_proof.py verify test.txt BBc-1 — (4) — 2018-08-01 – p.21/43
(1) ——- Dump of the transaction data —— * transaction_id:
b’346cd3f414a3ed25b7180a80bde41b1b611c13a4de0018f9684356312fa3ddbf’ version: 0 timestamp: 1529297518 Event[]: 0 Reference[]: 0 Relation[]: 1 [0] asset_group_id: b’45b2a200ccdcdcc3fb80cc9d423e1069f3ca726157f6492b4a70a48e4a1713ab’ Pointers[]: 1 [0] transaction_id: b’de0af83d66170096dac81c4889bed3e1a20b6ab3eb3ae789adf8a580e25c100c’ asset_id: None Asset: asset_id: b’69e01aef0e2854aa45625036f824c8275ecfacf48090b07b21bed216f5a67b34’ user_id: b’e59c553504ca7a54f888eb47e61b773a221ae1311bd58ec4c0912d71c443d715’ nonce: b’1f0e962766009a52’ BBc-1 — (4) — 2018-08-01 – p.22/43
(2) file_size: 11 file_digest: b’d866539f224896613df91023f0a9e226085451d6adf1dc5282cbba129d553713’ body_size: 21 body: b’Owner is
user_default’ Witness: [0] user_id: b’e59c553504ca7a54f888eb47e61b773a221ae1311bd58ec4c0912d71c443d715’ sig_index: 0 Cross_Ref: None Signature[]: 1 [0] key_type: 1 signature: b’5eeb9ca0ce527c90e62a6d087e13ccc009b621974420a5f6201ad65443d0b600c4c2c0 ac6f4ba22beee8a1e265853d13fc3e147ad38c2bebc9b06869559925ff’ pubkey: b’04dc03d221c173fb2cf49bd4f2077fdd88babaa8234a96353b245cb3450ca665a12adb186 695040188b366f12569b892c63f8410b9e471c4f1cf6f3ff96ddc48fc’ BBc-1 — (4) — 2018-08-01 – p.23/43
/ ( ) $ file_proof.py keypair $ file_proof.py setup $
file_proof.py wait -o someone ID $ file_proof.py send test.txt “someone” file_proof.py get BBc-1 — (4) — 2018-08-01 – p.24/43
(1) verify ——- Dump of the transaction data —— *
transaction_id: b’8775246772587c9b35329ae39a2d6826175c2cb7ba98da80f51e818db4a144d7’ version: 0 timestamp: 1529298154 Event[]: 0 Reference[]: 0 Relation[]: 1 [0] asset_group_id: b’45b2a200ccdcdcc3fb80cc9d423e1069f3ca726157f6492b4a70a48e4a1713ab’ Pointers[]: 1 [0] transaction_id: b’346cd3f414a3ed25b7180a80bde41b1b611c13a4de0018f9684356312fa3ddbf’ asset_id: None Asset: asset_id: b’97a5023af9fcdba1fb72e12f34c9bf05ee1b24636c02f8d88f5a7f9d269115b6’ user_id: b’2a59d59e3809f827ce709d3815e3950eef4a6a93af5557a93a7fdfba71460843’ nonce: b’18607aaf24de83ee’ BBc-1 — (4) — 2018-08-01 – p.25/43
(2) file_size: 11 file_digest: b’d866539f224896613df91023f0a9e226085451d6adf1dc5282cbba129d553713’ body_size: 52 body: b’Ownership is
transfered from user_default to someone’ Witness: [0] user_id: b’e59c553504ca7a54f888eb47e61b773a221ae1311bd58ec4c0912d71c443d715’ sig_index: 0 [1] user_id: b’2a59d59e3809f827ce709d3815e3950eef4a6a93af5557a93a7fdfba71460843’ sig_index: 1 Cross_Ref: None BBc-1 — (4) — 2018-08-01 – p.26/43
(3) Signature[]: 2 [0] key_type: 1 signature: b’149b0fd48137fec9a076b9214de857da285f2bcc7e634579ac519eada35386179b9c 78e6aa20910165648d8bef62e625d449445626d9c7bcdfaf63d1279331ee’ pubkey:
b’04dc03d221c173fb2cf49bd4f2077fdd88babaa8234a96353b245cb3450ca665a12adb1 86695040188b366f12569b892c63f8410b9e471c4f1cf6f3ff96ddc48fc’ [1] key_type: 1 signature: b’51f77ef2b66bd61db125facbc478c03df5a258af8fded20501c00665594c910604e7d e5c5b75d0259cf8716acd1e99a193fc79f20173b175e1b8bfe72c530df0’ pubkey: b’045833b8045305cb4da21f17cef4c44941de6152d0cfc0c77bc638071a8b86337a59f474 fc11e924a5afe7f3fc4e43491a55193c32f9403ca574ddc088cf8d5158’ BBc-1 — (4) — 2018-08-01 – p.27/43
file_proof BBc-1 Core BBc-1 — (4) — 2018-08-01 – p.28/43
4. Ethereum ( ) BBc-1 — (4) — 2018-08-01 –
p.29/43
Ethereum Go Ethereum Solidity BBc-1 — (4) — 2018-08-01 –
p.30/43
Go Etheruem macOS + Homebrew $ brew install geth Linux
(Ubuntu 16.04 LTS ) $ sudo apt install software-properties-common $ sudo add-apt-repository -y ppa:ethereum/ethereum $ sudo apt update $ sudo apt install ethereum Windows 10 Linux (Ubuntu 16.04 LTS ) BBc-1 — (4) — 2018-08-01 – p.31/43
Solidity macOS + Homebrew $ brew install solidity Linux (Ubuntu
16.04 LTS ), Windows 10 $ sudo apt install solc BBc-1 — (4) — 2018-08-01 – p.32/43
BBc-1 Core BBc-1 — (4) — 2018-08-01 – p.33/43
git clone $ git clone https://github.com/beyond-blockchain/ledger_subsystem.git $ cd ledger_subsystem tar
pip $ python setup.py sdist $ pip install dist/ledger_subsystem-0.11.0.tar.gz BBc-1 — (4) — 2018-08-01 – p.34/43
Ethereum populus (Python Ethereum ) Genesis Ethereum BBcAnchor BBc-1 —
(4) — 2018-08-01 – p.35/43
(1) “bbc_core.py” BBc-1 Core bbc_core.py populus $ eth_subsystem_tool.py -w ∼/.bbc1
populus Genesis $ eth_subsystem_tool.py -w ∼/.bbc1 genesis Ethereum $ eth_subsystem_tool.py -w ∼/.bbc1 new_account BBc-1 — (4) — 2018-08-01 – p.36/43
(2) geth $ eth_subsystem_tool.py -w ∼/.bbc1 run_geth $ tail -f
geth.log BBcAnchor ( ) $ eth_subsystem_tool.py -w ∼/.bbc1 deploy geth $ eth_subsystem_tool.py -w ∼/.bbc1 stop_geth “run_geth” BBc-1 — (4) — 2018-08-01 – p.37/43
BBcAnchor.sol ( ) contract BBcAnchor { mapping (uint256 => uint)
public _digests; constructor () public { } function getStored(uint256 digest) public returns (uint block_no) { return (_digests[digest]); } function isStored(uint256 digest) public returns (bool isStored) { return (_digests[digest] > 0); } function store(uint256 digest) public returns (bool isAlreadyStored) { bool isRes = _digests[digest] > 0; if (!isRes) { _digests[digest] = block.number; } return (isRes); } } BBc-1 — (4) — 2018-08-01 – p.38/43
BBc-1 — (4) — 2018-08-01 – p.39/43
(“bbc_core.py” ) $ eth_subsystem_tool.py -w ∼/.bbc1 config_demo 100 30 domain_id
( ) “bbc_core.py” $ eth_subsystem_tool.py -w ∼/.bbc1 -d enable BBc-1 — (4) — 2018-08-01 – p.40/43
3 $ eth_subsystem_tool.py -w ∼/.bbc1 -d register_demo 3 transaction_id (
) $ eth_subsystem_tool.py -w ∼/.bbc1 -d verify 30 verify BBc-1 — (4) — 2018-08-01 – p.41/43
Ethereum verify “eth_subsystem_tool.py” “subsystem_tool_lib.py” BBc-1 — (4) — 2018-08-01 –
p.42/43
BBc-1 — (4) — 2018-08-01 – p.43/43