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
イーサリアム実習 II / Practicing Ethereum II
Search
Kenji Saito
PRO
November 08, 2017
Technology
0
130
イーサリアム実習 II / Practicing Ethereum II
2017年11月8日(水)、ブロックチェーンアカデミー「スマートコントラクトプログラミング講座(4)」にて使用のスライドです。
Kenji Saito
PRO
November 08, 2017
Tweet
Share
More Decks by Kenji Saito
See All by Kenji Saito
身体を持つ生成AI と製品トレーサビリティー / Bodily Generative AI and Product Traceability
ks91
PRO
0
7
ブロックチェーン概論 / Introduction to Blockchain
ks91
PRO
0
13
FinTech Lecture 1-2 : Overview of FinTech
ks91
PRO
0
90
ブロックチェーンと分散ファイナンス概論 / Introduction to Blockchain and Decentralized Finance
ks91
PRO
0
29
アカデミーキャンプ 2024秋「都の西北で、もう一度AI(アイ)を叫ぶ」DAY 3 / Academy Camp 2024 Fall - Screaming AI at the North-West of the Capital - DAY 3
ks91
PRO
0
50
アカデミーキャンプ 2024秋「都の西北で、もう一度AI(アイ)を叫ぶ」DAY 2 / Academy Camp 2024 Fall - Screaming AI at the North-West of the Capital - DAY 2
ks91
PRO
0
37
アカデミーキャンプ 2024秋「都の西北で、もう一度AI(アイ)を叫ぶ」DAY 1 / Academy Camp 2024 Fall - Screaming AI at the North-West of the Capital - DAY 1
ks91
PRO
0
73
デジタル製品パスポート | 身体を持つ生成AI / Digital Product Passports | Generative AI with a Body
ks91
PRO
0
37
ゼミ紹介 : 公共の利益のためのデジタルトランスフォーメーション / Zemi Introduction : Digital Transformation for Public Good
ks91
PRO
0
35
Other Decks in Technology
See All in Technology
第45回 MLOps 勉強会 - ML Test Score を用いた機械学習システムの定量的なアセスメント
masatakashiwagi
3
300
トークナイザー入門
payanotty
2
920
見えづらい活動の成果の伝え方は日頃からめちゃくちゃ悩んでるけど、実際こんな取り組みをしな がら温度感を合わせにいってるよ / Conveying Hard-to-See Results
kakehashi
2
320
VS CodeでF1〜12キーつかってますか? / Do you use the F1-12 keys in VS Code?
74th
2
290
Assisted reorganization of data structures
ennael
PRO
0
250
XPを始める新人に伝えたい近道の鍵
nakasho
1
310
ドメインと向き合う - 旅行予約編
hidenorigoto
4
560
令和最新版 Perlコーディングガイド
anatofuz
4
3.5k
過去のインプットとアウトプットを振り返る
diggymo
0
110
【shownet.conf_】多様化するネットワーク環境を柔軟に統合するルーティングテクノロジー
shownet
PRO
0
360
【shownet.conf_】持続可能な次世代Wi-Fi運用に向けて
shownet
PRO
0
330
OPENLOGI Company Profile
hr01
0
54k
Featured
See All Featured
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
45
2k
Six Lessons from altMBA
skipperchong
26
3.4k
Building an army of robots
kneath
302
42k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Large-scale JavaScript Application Architecture
addyosmani
509
110k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
25
660
A better future with KSS
kneath
237
17k
WebSockets: Embracing the real-time Web
robhawkes
59
7.3k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
663
120k
From Idea to $5000 a Month in 5 Months
shpigford
380
46k
Done Done
chrislema
181
16k
Transcript
II (4) CSO / SFC
[email protected]
II – (4) –
2017-05-31 – p.1/54
1. : 2. ∼ ∼ II – (4) – 2017-05-31
– p.2/54
1. : 2. : 3. / II – (4) –
2017-05-31 – p.3/54
1. II – (4) – 2017-05-31 – p.4/54
(m2 ) 1 1 II – (4) – 2017-05-31 –
p.5/54
IndivisibleAsset string public _name; string public _symbol; uint256 public _quantity;
address public _owner; _name ( ) _symbol _quantity (m2 ) _owner _ Solidity . . . II – (4) – 2017-05-31 – p.6/54
IndivisibleAsset event Transfer(address indexed from, address indexed to); from to
II – (4) – 2017-05-31 – p.7/54
IndivisibleAsset function IndivisibleAsset(string name, string symbol, uint256 quantity) { _name
= name; _symbol = symbol; _quantity = quantity; _owner = msg.sender; } II – (4) – 2017-05-31 – p.8/54
IndivisibleAsset getOwner() function getOwner() returns (address owner) { return (_owner);
} II – (4) – 2017-05-31 – p.9/54
IndivisibleAsset transfer() function transfer(address to) { if (_owner != msg.sender)
{ throw; } _owner = to; Transfer(msg.sender, to); } ( / ) $ populus compile II – (4) – 2017-05-31 – p.10/54
(1) import pytest @pytest.fixture() def asset_contract(chain): AssetFactory = chain.provider.get_contract_factory(’IndivisibleAsset’) deploy_txid
= AssetFactory.deploy(args=[ "5322 Endo, Fujisawa", "mˆ2", 300, ]) contract_address = chain.wait.for_contract_address(deploy_txid) return AssetFactory(address=contract_address) SFC (300m2 ) II – (4) – 2017-05-31 – p.11/54
(2) def test_indivisible_assset(asset_contract, chain): account0 = chain.web3.eth.accounts[0] account1 = chain.web3.eth.accounts[1]
assert asset_contract.call().getOwner() == account0 txid = asset_contract.transact().transfer(account1) chain.wait.for_receipt(txid) assert asset_contract.call().getOwner() == account1 account0 account1 II – (4) – 2017-05-31 – p.12/54
$ py.test -k test_indivisible_asset.py II – (4) – 2017-05-31 –
p.13/54
2. II – (4) – 2017-05-31 – p.14/54
transfer settle, retrieve asset, retrieve token 3 II – (4)
– 2017-05-31 – p.15/54
1. ( ) 2. ( ) 3. ( ) II
– (4) – 2017-05-31 – p.16/54
OneTimeEscrow settle() function settle() { address addr = this; /*
this */ if (_token.getBalanceOf(this) < _price || _asset.getOwner() != addr) { throw; } _token.transfer(_seller , _price); _asset.transfer(_buyer); Settled(); /* */ } settle() transfer ( / ) $ populus compile II – (4) – 2017-05-31 – p.17/54
(1) import pytest @pytest.fixture() def token_contract(chain): . . . @pytest.fixture()
def asset_contract(chain): . . . II – (4) – 2017-05-31 – p.18/54
(2) def test_one_time_escrow(token_contract, asset_contract, chain): account0 = chain.web3.eth.accounts[0] account1 =
chain.web3.eth.accounts[1] txid = chain.web3.eth.sendTransaction({ ’from’: account0, ’to’: account1, ’value’: chain.web3.toWei(1, "ether") }) chain.wait.for_receipt(txid) txid = token_contract.transact().transfer(account1, 300) chain.wait.for_receipt(txid) account0 account1 1Ether 300BcH 300BcH TX II – (4) – 2017-05-31 – p.19/54
(3) EscrowFactory = chain.provider.get_contract_factory(’OneTimeEscrow’) txid = EscrowFactory.deploy(args=[ token_contract.address, account1, asset_contract.address,
account0, 300, ]) contract_address = chain.wait.for_contract_address(txid) EscrowFactory.address = contract_address; account1 account0 300BcH II – (4) – 2017-05-31 – p.20/54
(4) txid = token_contract.transact({ ’from’: account1 }).transfer(contract_address, 300) chain.wait.for_receipt(txid) txid
= asset_contract.transact().transfer(contract_address) chain.wait.for_receipt(txid) assert token_contract.call().getBalanceOf(account0) == 999700 assert token_contract.call().getBalanceOf(account1) == 0 assert token_contract.call().getBalanceOf(contract_address) == 300 assert asset_contract.call().getOwner() == contract_address account1 300BcH account0 II – (4) – 2017-05-31 – p.21/54
(5) txid = EscrowFactory.transact().settle(); chain.wait.for_receipt(txid) assert token_contract.call().getBalanceOf(account0) == 1000000 assert
token_contract.call().getBalanceOf(account1) == 0 assert token_contract.call().getBalanceOf(contract_address) == 0 assert asset_contract.call().getOwner() == account1 settle() II – (4) – 2017-05-31 – p.22/54
$ py.test -k test_one_time_escrow.py : settle() II – (4) –
2017-05-31 – p.23/54
3. / Hyperledger (Fabric, Sawtooth, Iroha, Burrow, Indy) R3 Corda
Enterprise Ethereum Alliance Tangle (IOTA) BBc-1 II – (4) – 2017-05-31 – p.24/54
( ) ( ) ( ) IoT / / (
) II – (4) – 2017-05-31 – p.25/54
( = ) ( ) ( ) ↑ II –
(4) – 2017-05-31 – p.26/54
(Linux Foundation) https://www.hyperledger.org Apache License, Version 2.0 II – (4)
– 2017-05-31 – p.27/54
/ : Proposal → Incubation → Active → Deprecated →
End of Life II – (4) – 2017-05-31 – p.28/54
( https://www.hyperledger.org/about/members ) II – (4) – 2017-05-31 – p.29/54
Fabric (IBM) IBM Digital Asset Holdings http://hyperledger-fabric.readthedocs.io/en/latest/ State : Active
II – (4) – 2017-05-31 – p.30/54
( ) ( ) II – (4) – 2017-05-31 –
p.31/54
(Docker) (chaincode) PBFT (Practical BFT) RocksDB CA PKI v1.0 DB
CA BFT : Byzantine Fault Tolerance ( ) CA : Certificate Authority ( ) PKI : Public Key Infrastructure ( ) II – (4) – 2017-05-31 – p.32/54
Sawtooth (Intel) https://github.com/hyperledger/sawtooth-core State : Active II – (4) –
2017-05-31 – p.33/54
( ) (permissioned) (permissionless) Proof of Elapsed Time (PoET) Proof
of Work ( ) (Intel ) / Transaction Families II – (4) – 2017-05-31 – p.34/54
(transaction families) (PoET ) PoET ( ) (transaction families) II
– (4) – 2017-05-31 – p.35/54
Iroha ( ) https://github.com/hyperledger/iroha State : Active II – (4)
– 2017-05-31 – p.36/54
( ) DLT : C++ Sumeragi Whitepaper : https://github.com/hyperledger/iroha/blob/master/docs/iroha_whitepaper.md II
– (4) – 2017-05-31 – p.37/54
JVM (chaincode) Sumeragi (BFT) JVM : Java Virtual Machine (Java
) II – (4) – 2017-05-31 – p.38/54
Corda (R3) Tangle (IOTA) II – (4) – 2017-05-31 –
p.39/54
Corda (R3) R3 https://github.com/corda/corda II – (4) – 2017-05-31 –
p.40/54
R3 R3CEV 77 (2017 2 ) 3 SBI R3Net( )
Corda II – (4) – 2017-05-31 – p.41/54
Corda Corda : : II – (4) – 2017-05-31 –
p.42/54
( ) + CAP ( DLT ) II – (4)
– 2017-05-31 – p.43/54
JVM ( ) (Uniqueness Services) UTXO X.509 PKI ( )
UTXO : Unspent TX (transaction) Output ( ) X.509 : PKI II – (4) – 2017-05-31 – p.44/54
Tangle (IOTA) IoT IOTA https://iota.readme.io II – (4) – 2017-05-31
– p.45/54
IoT TX TX (DAG) ( ) TX Tangle II –
(4) – 2017-05-31 – p.46/54
IoT (IOTA) DAG ( ) DAG II – (4) –
2017-05-31 – p.47/54
BBc-1 (Beyond Blockchain One) https://github.com/beyond-blockchain/bbc1 II – (4) – 2017-05-31
– p.48/54
Proof of Work Bitcoin ( ) BBc Trust ( )
https://beyond-blockchain.org/public/bbc-trust.pdf ( ) https://beyond-blockchain.org/public/bbc-trust_ja.pdf ( ) Design Paper (white paper) https://beyond-blockchain.org/public/bbc1-design-paper.pdf II – (4) – 2017-05-31 – p.49/54
( Python) ( DAG) ( ) UTXO II – (4)
– 2017-05-31 – p.50/54
DLT DLT II – (4) – 2017-05-31 – p.51/54
( ) (by ) (since 1984) ( ) ( )
( ) . . . ( ) ⇒ . . . II – (4) – 2017-05-31 – p.52/54
( ) ( ) ( ) ( ) ( )
( ) (by ) ⇒ DLT II – (4) – 2017-05-31 – p.53/54
⇒ ⇒ II – (4) – 2017-05-31 – p.54/54