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
What is Ethereum about tech layer
Search
nakajo2011
January 29, 2020
Programming
0
360
What is Ethereum about tech layer
The slide that I talked in BPStudy #149.
https://bpstudy.connpass.com/event/152353/
nakajo2011
January 29, 2020
Tweet
Share
More Decks by nakajo2011
See All by nakajo2011
Plasma_Overview_gbec20180928.pdf
nakajo2011
0
65
The Ethereum design direction.
nakajo2011
0
67
Report of Devcon5 2019.10.17
nakajo2011
0
600
Compare of Libra and Ethereum
nakajo2011
1
440
What is Move language
nakajo2011
1
1.1k
blockchain-changing-and-issues
nakajo2011
4
560
Thinking Scalability from DEX
nakajo2011
0
98
Truffleの紹介_in_hicon2018.pdf
nakajo2011
3
290
Truffle Test Tips and other
nakajo2011
2
170
Other Decks in Programming
See All in Programming
SODA - FACT BOOK(JP)
sodainc
1
8.6k
Cursorハンズオン実践!
eltociear
2
1.2k
contribution to astral-sh/uv
shunsock
0
450
PHPに関数型の魂を宿す〜PHP 8.5 で実現する堅牢なコードとは〜 #phpcon_hiroshima / phpcon-hiroshima-2025
shogogg
1
320
pnpm に provenance のダウングレード を検出する PR を出してみた
ryo_manba
1
150
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
390
CSC305 Lecture 09
javiergs
PRO
0
300
Webサーバーサイド言語としてのRustについて
kouyuume
1
4k
20251016_Rails News ~Rails 8.1の足音を聴く~
morimorihoge
2
670
タスクの特性や不確実性に応じた最適な作業スタイルの選択(ペアプロ・モブプロ・ソロプロ)と実践 / Optimal Work Style Selection: Pair, Mob, or Solo Programming.
honyanya
3
190
Goで実践するドメイン駆動開発 AIと歩み始めた新規プロダクト開発の現在地
imkaoru
4
880
AIと人間の共創開発!OSSで試行錯誤した開発スタイル
mae616
2
780
Featured
See All Featured
Navigating Team Friction
lara
190
15k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
30
2.9k
Designing for humans not robots
tammielis
254
26k
Build your cross-platform service in a week with App Engine
jlugia
232
18k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
130k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Code Reviewing Like a Champion
maltzj
526
40k
Designing for Performance
lara
610
69k
Agile that works and the tools we love
rasmusluckow
331
21k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
190
55k
Thoughts on Productivity
jonyablonski
70
4.9k
How to Think Like a Performance Engineer
csswizardry
27
2.1k
Transcript
What_is_Ethereum_tech編 2020.01.28
Copyright © 2019 chaintope Inc. All rights reserved. 自己紹介 2
• Yukishige Nakajo • 株式会社chaintope Chief Ethereum Researcher • 福岡県の飯塚市でEthereumの研究中 • Rust, EVM, 主にEth1.0 • https://twitter.com/nakajo https://y-nakajo.hatenablog.com/ • マスタリング・イーサリアム技術監修
Copyright © 2019 chaintope Inc. All rights reserved. What_is_Ethereum_tech編 3
1. マスタリング・イーサリアムの紹介 2. ブロックチェーンとは 3. Ethereumとは 4. ブロックチェーンの利点
Copyright © 2019 chaintope Inc. All rights reserved. Ethereumを取り巻く環境 4
Platformとしての性質をも つブロックチェーンである ため、非常に多岐にわた る分野で使われている。
Copyright © 2019 chaintope Inc. All rights reserved. Ethereumを簡単に説明すると。。。 5
• 任意のプログラム実行環境であり • プログラムの状態を保存するDBでもある。 • 誰でもプログラムを登録でき、誰でも実行できる。(手数料さえ払えば)
Copyright © 2019 chaintope Inc. All rights reserved. Dappsとは? 6
スマートコントラクトでデータの正当 性を検証・登録 データを誰にも改ざんできない 安全なDB WebAppでリッチなUXを提供 Walletを介してアクセス
Copyright © 2019 chaintope Inc. All rights reserved. より詳しい話はマスタリング・イーサリアムで! 7
• 2章 イーサリアムの基礎 • 6章 トランザクション • 12章 非中央集権型アプリケーショ ン(DApp) etc….
Copyright © 2019 chaintope Inc. All rights reserved. What_is_Ethereum_tech編 8
1. マスタリング・イーサリアムの紹介 2. ブロックチェーンとは 3. Ethereumとは 4. ブロックチェーンの利点
Copyright © 2019 chaintope Inc. All rights reserved. ブロックチェーンとは? 9
p2p network • p2p network上に構築されたシステム。 • 誰でも参加可能で、全員が同じデータを保持する。 node: ブロックチェーンのデータを検証・転送 するプログラム。
Copyright © 2019 chaintope Inc. All rights reserved. BlockとTransaction 10
• Transactionはブロックチェーンの状態を新しい状態に変更するトリガー ex) Bitcoinではtxの支払い状態 ex) Ethereumではスマートコントラクト実行結果 • Blockは各node間でコンセンサスを取るため のデータの塊。 • Blockごとに、データを改変されないようにtx の集合に対するproof(Merkle Root Hash) が付与される。
Copyright © 2019 chaintope Inc. All rights reserved. Blockについてその2 11
• Blockはシーケンシャルな順番を持 つ。 • LinkedListなデータ構造(ただし、変 更はO(2^n) ) • Blockの繋がりは状態変化の歴史で もある。
Copyright © 2019 chaintope Inc. All rights reserved. Mining (Proof
of Work)とは 12 • Block Headerからある条件を満たすHash値を見つけるゲーム。 • Difficulty調整でブロック生成時間を調整。 • nonceの値を変えながらなんどもHash値を作成。
Copyright © 2019 chaintope Inc. All rights reserved. Fork choice
rule 13 • ブロックがいくつ積み上がったか?で正統な歴史が決まる。 • 一般的に6ブロック積み上がると状態が99%以上の確率で確定した (書き換え不可能)とみなされる。(確率的フィナリティー) • ある時のブロックの内容を書き換えるにはそのブロックの上に積み上 がっているブロックのhash値を計算し直す必要がある。
Copyright © 2019 chaintope Inc. All rights reserved. コンセンサスアルゴリズム 14
• Bitcoinなどで使われているのは正式にはサトシ・ナカモトコンセンサス と呼ばれる。 • Byzantine Fault Toleranceと混じって説明されるが、そもそも母数が 未定なネットワークではBFTは使えない(悪意のあるノードが1/3なのか がわからないので。。。) • PoWはあくまでブロック生成条件であり、コンセンサスではない。 • この2つの他に、txが2重支払いしていないか?などもコンセンサスの ルールとして含まれる。
Copyright © 2019 chaintope Inc. All rights reserved. What_is_Ethereum_tech編 15
1. マスタリング・イーサリアムの紹介 2. ブロックチェーンとは 3. Ethereumとは 4. ブロックチェーンの利点
Copyright © 2019 chaintope Inc. All rights reserved. Ethereumのとは? 16
• 最終的な各Accountの状態を共有するためのブロックチェーン。 • Accountは残高(ETH)やプログラムコードや、プログラムの実行結果など様々な 状態を持つ。
Copyright © 2019 chaintope Inc. All rights reserved. Ethereumのアカウント構造 17
• Code Hash: Contractの本体コードの Hash値。 • Storage Root Hash: Contractに保存さ れたデータのMerkle Root Hash値。 • Nonce: このアカウントが発行したTransaction数。 • Balance: このアカウントが保有しているETHの量。
Copyright © 2019 chaintope Inc. All rights reserved. Ethereumのアカウントの種類 18
• External Owned Account ◦ 秘密鍵を持つAccount。Transactionの発行は必ずEOAから行われる。 • Contract Account ◦ CodeとStorageも持つ。 ◦ Contractを作成した時に生成されるAccount。 ◦ NonceはこのAccountから新しいContractを生成した時にインクリメントされる。
Copyright © 2019 chaintope Inc. All rights reserved. Ethereumのトランザクション 19
• TransactionはState情報を書き換えるトリガー。 • Ethereumが保有しているAccount情報が書き換わる。 • EthereumのStateはAccount情報の集合。つまり、Transactionを発行すると Ethreumが新しいStateへと変化する。
Copyright © 2019 chaintope Inc. All rights reserved. 送金Transaction 20
• 送信元(from)のAccountと送信先(to)のアカウントのbalanceが変わ る。 • 送信元のAccount addressは署名から復元できる。 • 送信先(to)が初めてアクセスするaddressの場合そのタイミングで Account領域が確保される。
Copyright © 2019 chaintope Inc. All rights reserved. スマートコントラクト生成Transaction 21
• to: 0x00000...00 の全て0のaddress宛に送ると、新しいスマートコントラクト が生成される。 • transactionに生成するスマートコントラクトの本体コードを載せる。 • このコードが新しいAccountとして生成された領域に保存される。 • Account addressはHash(from address + nonce)となる。 • 同じコードでも違うAccountとして生成される。 ◦ つまり、一度生成されたスマートコントラクトはImmutable codeはコピーされ保存される
Copyright © 2019 chaintope Inc. All rights reserved. スマートコントラクト実行Transaction 22
実行結果を反映 • Toが呼び出したいスマートコントラクトのaddress • Data部に呼び出す関数の識別IDと関数に渡す引数を指定 • 実行結果はAccountのStorageに保存される。 • スマートコントラクトから他のスマートコントラクトを呼ぶことも可能。その場合 は複数のAccountの情報が書き換わる。
Copyright © 2019 chaintope Inc. All rights reserved. Ethereumのブロック構造 23
Merkle Patricia Trie • Account情報の集合がEthereumのStateである。 • EthereumはStateのcommitmentを持つ。 • そのため、Block検証には今まで保存された全ての State情報が必要となる。 • Block生成は約15秒間隔。
Copyright © 2019 chaintope Inc. All rights reserved. マークルパトリシアトライ(Merkle Patricia
Trie) 24 https://blog.ethereum.org/2019/12/30/eth1x-files-state-of-stateless-ethereum/ より • Stateデータの増加=パトリシアトライの成長= Key-Valueストアの増加。 • アカウント情報を取得する時はパトリシアトライの探索と、 Key-Valueストアに対する フェッチが発生。 => Stateの増加が処理速度低下につながる。 • Merkle Root Hashの算出が高速。O(log_16 n)
Copyright © 2019 chaintope Inc. All rights reserved. What_is_Ethereum_tech編 25
1. マスタリング・イーサリアムの紹介 2. ブロックチェーンとは 3. Ethereumとは 4. ブロックチェーンの利点
Copyright © 2019 chaintope Inc. All rights reserved. ブロックチェーンの特性 26
p2p network • 高可用性(書き換えは遅いけど、参照は無限のスケール) • データ変更の履歴が書き換え不可能な形で保存 • 署名検証によるデータ完全性の担保 ◦ 履歴を追える どこに問い合わせても 同じDataを返す。
Copyright © 2019 chaintope Inc. All rights reserved. ブロックチェーンを活用する利点 27
p2p network • Proofデータが広く残る。 • 透明な取引情報を記録可能 ◦ サービス管理者がデータ書き換えを行ったかどうかを検知可能。 • データの出どころを保証する場合に有効。 どこに問い合わせても 同じDataを返す。
株式会社chaintope 代表取締役社長 正田英樹 福岡県飯塚市幸袋560-8
[email protected]
28