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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Stake Technologies
July 29, 2019
Technology
78
0
Share
Plasma NFT Deposit Range
Stake Technologies
July 29, 2019
More Decks by Stake Technologies
See All by Stake Technologies
Substrate ink!
staketechnologies
0
38
Plasma on Substrate @Fukuoka
staketechnologies
0
78
Sub0 Recap Japanese
staketechnologies
0
67
Plasm Introduction
staketechnologies
1
120
0318Substrateプレゼン資料.pdf
staketechnologies
4
630
2019.01ブロックチェーントレンド
staketechnologies
0
42
Other Decks in Technology
See All in Technology
プラットフォームエンジニア ワークショップ/ platform-workshop
databricksjapan
0
240
Strands Agents超入門
kintotechdev
1
160
ITエンジニアを取り巻く環境とキャリアパス / A career path for Japanese IT engineers
takatama
4
1.8k
コードレビューを制するチームがソフトウェアデリバリーのフローを制す / Beyond Code Review: Distributing Its Responsibilities Across the SDLC
mtx2s
3
950
Spring Boot における AOT Cache 活用テクニックと 起動時間改善事例
ntt_dsol_java
0
200
Unlocking the Apps
pimterry
0
190
APIテストとは?
nagix
0
180
AI フレンドリーなエラー監視を TypeScript で実現する
shinyaigeek
2
250
形式手法特論:公平性制約の位相的特徴づけ #kernelvm / Kernel VM Study Kansai 12th
ytaka23
1
710
Sony_KMP_Journey_KotlinConf2026
sony
2
210
Oracle AI Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
6
1.5k
チームで実践する AI-DLC 思考の軌跡を残すチェックポイント設計
belongadmin
0
2.2k
Featured
See All Featured
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
570
A Modern Web Designer's Workflow
chriscoyier
698
190k
New Earth Scene 8
popppiees
3
2.3k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
930
Six Lessons from altMBA
skipperchong
29
4.3k
Everyday Curiosity
cassininazir
0
220
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
190
We Are The Robots
honzajavorek
0
240
Utilizing Notion as your number one productivity tool
mfonobong
4
310
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
71
40k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
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