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
Plasma NFT Deposit Range
Search
Stake Technologies
July 29, 2019
Technology
85
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Plasma NFT Deposit Range
Stake Technologies
July 29, 2019
More Decks by Stake Technologies
See All by Stake Technologies
Substrate ink!
staketechnologies
0
41
Plasma on Substrate @Fukuoka
staketechnologies
0
82
Sub0 Recap Japanese
staketechnologies
0
72
Plasm Introduction
staketechnologies
1
130
0318Substrateプレゼン資料.pdf
staketechnologies
4
640
2019.01ブロックチェーントレンド
staketechnologies
0
47
Other Decks in Technology
See All in Technology
SoccerMaster: A Vision Foundation Model for Soccer Understanding
kzykmyzw
0
150
ファミコンでPHPを動かす / PHP on the Famicom
tomzoh
2
470
マルチアカウント環境でSecurity Hubの運用、その後どうなった? / SRE NEXT 2026 miniLT会
genda
0
110
生成AI×AWS CDK×AWS FISで"振り返れる"ミニGameDayをつくろう
yoshimi0227
1
430
実践!既存 Project への AI-Driven Development 適用〜 一ヶ月で Project 唯一のフロントエンドエンジニアを作り出せ〜
lycorptech_jp
PRO
0
240
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
110k
Data + AI Summit 2026 イベントレポート: 「AIがビジネスで意思決定するデータ基盤」へ
nek0128
0
280
関数型の考えを TypeScript に持ち込んで、テストしやすい純粋関数を増やす / Pure at the Core, Effects at the Edge: Bringing Functional Thinking into TypeScript
kaminashi
2
130
インフラと開発の垣根を超えていき!〜元AWSインフラエンジニアがAWS開発で奮闘している話〜
hatahata021
3
300
「守りたい体験」を渡すだけで E2E を生成させられるようになった話
hinac0
1
700
10年目を迎えた「ABEMA」がどのように AI 活用を推進して、AI 駆動開発にシフトしているのか / How ABEMA, entering its 10th year, is promoting the use of AI and shifting toward AI-driven development
miyukki
0
290
世界、断片、モデル。そして理解
ardbeg1958
1
130
Featured
See All Featured
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
2
340
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
KATA
mclloyd
PRO
35
15k
Into the Great Unknown - MozCon
thekraken
41
2.6k
The Invisible Side of Design
smashingmag
301
52k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Prompt Engineering for Job Search
mfonobong
0
380
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Being A Developer After 40
akosma
91
590k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
220
Transcript
DepositedRanges
概要 PlasmaCash 派生ではすべての資産を NFT として扱う。 子チェーンに資産を移すことを Deposit 子チェーンから親チェーンに資産を戻すことを Exit と呼ぶ。
親チェーンでは不正な Exit を防ぐために 子チェーンに存在する資産を把握している必要がある。 DepositedRanges は子チェーンに移した NFT を把握し 子チェーンに存在しない資産を不正に Exit できないようにするためのデータ構造。
データ構造 区間を表す構造体、 Range を定義する。 struct Range { start: u128, end:
u128 } Plasma 上の NFT は index が連番で割り振られており Range を使って どの NFT を指しているかを特定する。 DepositedRanges を定義する。 DepositedRanges: storage::HashMap<u128, Range>; DepositedRanges は現在 Deposit されている NFT の ID を管理する。
要件 DepositedRanges は以下のことがそれぞれ O(1) でできる。 • 区間の拡張。 ◦ Input ▪
amount : u128 ◦ 現在の Deposit されている総量から新たに amount だけ区間を拡張する。 • 区間の削除。 ◦ Input ▪ range: Range ▪ deposited_range_id: u128 ◦ 任意の区間を指定して削除する。 ◦ この際、削除する部分区間とする区間の左端の index が入力で与えられる。 (deposited_range_id)
Deposit アルゴリズム 初期状態 : total_deposit = 0; depositedRanges = {
} 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Deposit( amount = 4 ); total_deposit = 0; depositedRanges =
{ 4: Range { 0, 4 }, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Deposit( amount = 4 ); total_deposit = 4; depositedRanges =
{ 4: Range { 0, 4 }, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Deposit ( amount = 6 ); total_deposit = 4; depositedRanges
= { 4: Range { 0, 4 }, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Deposit ( amount = 6 ); total_deposit = 10; depositedRanges
= { 10: Range { 0, 10 }, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Deposit ( amount = 2 ); total_deposit = 10; depositedRanges
= { 10: Range { 0, 10 }, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Deposit ( amount = 2 ); total_deposit = 12; depositedRanges
= { 12: Range { 0,12}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Exit ( range = Range { 2, 8 } );
total_deposit = 12; depositedRanges = { 12: Range { 0,12}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Exit ( range = Range { 2, 8 } );
total_deposit = 12; depositedRanges = { 12: Range { 0,12}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 deposited_range_id = 12 ※ deposited_range_id は 作用したい区間を含むような 区間を depositedRanges から 取得するためのキー。 左端の index と等しい。
Exit ( range = Range { 2, 8 } );
total_deposit = 12; depositedRanges = { 2: Range { 0, 2 }, 12: Range { 8,12}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 deposited_range_id = 12 ※ deposited_range_id は 作用したい区間を含むような 区間を depositedRanges から 取得するためのキー。 左端の index と等しい。
Exit ( range = Range { 6, 10 } );
total_deposit = 12; depositedRanges = { 2: Range { 0, 2 }, 12: Range { 8,12}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 deposited_range_id = 12
Exit ( range = Range { 6, 10 } );
total_deposit = 12; depositedRanges = { 2: Range { 0, 2 }, 12: Range { 8,12}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 deposited_range_id = 12
Exit ( range = Range { 10, 12 } );
total_deposit = 12; depositedRanges = { 2: Range { 0, 2 }, 12: Range { 8,12}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 deposited_range_id = 12
Exit ( range = Range { 10, 12 } );
total_deposit = 12; depositedRanges = { 2: Range { 0, 2 }, 10: Range { 8,10}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 deposited_range_id = 12
Deposit ( acmount = 5 ); total_deposit = 12; depositedRanges
= { 2: Range { 0, 2 }, 10: Range { 8,10}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Deposit ( acmount = 5 ); total_deposit = 17; depositedRanges
= { 2: Range { 0, 2 }, 10: Range { 8,10}, 17: Range {12,17}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Exit ( Range { 12, 14 } ); total_deposit =
17; depositedRanges = { 2: Range { 0, 2 }, 10: Range { 8,10}, 17: Range {12,17}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Exit ( Range { 12, 14 } ); total_deposit =
17; depositedRanges = { 2: Range { 0, 2 }, 10: Range { 8,10}, 17: Range {14,17}, } 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
How do I know deposited_range_id? 方法①:ルートチェーンから発行されるイベントを 全て捜査してクライアント側で構築 方法②:DepositedRanges の Map
の実装を平衡二分探索木などを 用いて key をBinarySearch