Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
手を動かしながら スマートコントラクトについて学ぶ/how-smartcontract-works
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Yosuke
November 20, 2022
Technology
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
手を動かしながら スマートコントラクトについて学ぶ/how-smartcontract-works
Yosuke
November 20, 2022
More Decks by Yosuke
See All by Yosuke
第1回ロジックスユーザー会/20241213_logix
aramaki
0
55
第二回目合同研修/20240627
aramaki
0
530
2023年度決算発表会_経営企画/20240608
aramaki
0
36
Web3 Global Hackathon : How to use ZKP and usecases
aramaki
2
470
MEVTokyo : Overview of MEV-Boost and PBS
aramaki
0
240
スマートコントラクトとメタトランザクションについて/meta-transaction
aramaki
0
270
BUILD UP for Web3 engineer
aramaki
0
960
NFT事例集/nft_cases
aramaki
1
210
ブロックチェーン 活用事例集 トレーサビリティー/blockchain-traceability
aramaki
1
260
Other Decks in Technology
See All in Technology
外国人エンジニアがVueプロトタイプで仕様を合わせている話 / Vue Fes Japan 2026 LT
eluwing
0
290
cdk deployとcdkd deploy、実際にデプロイして5倍速近くの差を実測した
yama3133
1
110
kintoneで在庫管理システムを作るときの要件定義・設計ポイント
kai0707
0
140
「作れる」と「リリースできる」の間にあったもの── PdMを外して見えた、PdMがやるべき仕事/Buildable ≠ Shippable: What Removing the PM Taught Me About the PM’s Job
yappli_developers
0
370
AI時代の開発はウォーターフォールに回帰する? / development-with-ai-back-to-wf
okamototakuyasr2
0
140
AWSセキュリティで活用するAI機能
cmusudakeisuke
1
350
AWSDirectConnectの構築の進め方を整理してみた
masa_my
1
210
OneLakeをデータソースにした AI Search(Foundry IQ)の ライフサイクル管理
ryuseiiida
0
160
AIで選択肢が広がった組織設計の理想と現実
konifar
15
6.7k
国際カードブランドルール変更に伴うクレジットカード決済取引仕様変更について
k1style
0
250
仕様駆動開発の、その先へ。決める力と確かめる仕組み
inariku
0
110
AIエージェントに 権限と鍵をどこまで渡すか
nrinetcom
PRO
2
140
Featured
See All Featured
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
640
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
630
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
650
How GitHub (no longer) Works
holman
316
150k
ラッコキーワード サービス紹介資料
rakko
5
5.5M
Un-Boring Meetings
codingconduct
0
470
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
290
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
340
The Limits of Empathy - UXLibs8
cassininazir
2
740
Skip the Path - Find Your Career Trail
mkilby
1
260
Transcript
C R Y P T O B A S E
W E B 3 S T U D Y 2022 年 10 月 19 日 手を動かしながら スマートコントラクトについて学ぶ
コンテンツ ERC (EIP )とは トークン(ERC20 )をデプロイ NFT (ERC721 )をデプロイ etherscan
の解説 data の解説 トランザクションデータの解説 Metamask が何をしてるかの解説 【第一部】トークンとNFT をデプロイしてみよう 【第二部】トランザクションのデータについて理解しよう *おまけ solidity を読めるようになろう!
ERC とは Ethereum Request for Comments の略 スマートコントラクトの規格 https://github.com/ethereum/EIPs/tree/master/EIP S
代表例 ERC20 トークンの規格(USDC, JPYC... ) ERC721 NFT ERC1155 ERC20 とERC721 を合わせたようなもの
Openzeppelin Contract Wizard リンク:https://wizard.openzeppelin.com/
トークン(ERC20 )をデプロイ Name 、Symbol はお好みで Name はトークンの名前 Symbol はトークンのティッカー ex.
BTC mintable 【コントラクトの作成】
トークン(ERC20 )をデプロイ Remix を開く https://remix.ethereum.org 右上のファイルアイコンから、ファイルを作成。 コードをコピペする 右のタブからSOLIDITY COMPILER に移動
一番上の「COMPILER 」を、コードの「pragma solidity ^0.0.0; 」のバージョンと合わせる。 「Compile 」を押してコードをコンパイルする 「ENVIRONMENT 」を「Injected Provider 」に変 更 「Contract 」が、コードの「contract 」の名前と一 致してることを確認 「Deploy 」でトークンを作成 【コントラクトのデプロイ】
トークン(ERC20 )をデプロイ to : 送り先アドレス amount : 発行額(18 桁) 【トークンの発行】
トークン(ERC20 )を追加
トークン(ERC20 )を送信 トークンを選択 send を押す 送り先のアドレ スを記載 額を記入 confirm
balance (残高) mapping(address => uint256) private _balances; *key-value (ex. 社員番号)
function balanceOf( address account ) public view virtual override returns (uint256) { return _balances[account]; } トークン(ERC20 )のコード解説 transfer (送信) function _transfer( address from, address to, uint256 amount ) internal virtual { uint256 fromBalance = _balances[from]; unchecked { _balances[from] = fromBalance - amount; _balances[to] += amount; } } リンク:https://github.com/OpenZeppelin/openzeppelin- contracts/blob/master/contracts/token/ERC20/ERC20.sol
NFT (ERC721 )をデプロイ 右上の「+ 」から、ファイルを作成。 コードをコピペする https://github.com/0xywzx/event/blob/main/2 0221019_cryptobase_how_smartcontract_wor ks/NFT/ERC721.sol 右のタブからSOLIDITY
COMPILER に移動 「Compile 」を押してコードをコンパイルする 「Contract 」が、コードの「contract 」の名前と一 致してることを確認 「Deploy 」でNFT を作成 【コントラクトのデプロイ】
NFT (ERC721 )を発行 safeMint to name description image https://raw.githubusercontent.com/0xywz x/event/main/20221019_cryptobase_how_s
martcontract_works/image.png trait value
NFT (ERC721 )をOpensea で確認 Opensea を開く https://testnets.opensea.io/account wallet を接続 「Accept
and sign 」でログイン
第一部 まとめ 誰でも簡単にトークン、NFT は作成できる 作成したものは誰でもみることができる
input data の解説 activity transfer した activity view on block
exploler etherscan
input data の解説 Method Id transfer(address,uint) をKeccak-256 でハッシュ 化したもの https://emn178.github.io/online-
tools/keccak_256.html 引数2 つ 16 進数で表現 https://hogehoge.tk/tool/number.html 64bytes で管理 足りない分は0 で埋め合わせ https://tomari.org/main/java/mojicnt.html 【input data の中身】
input data の解説 直コン ≒提供されるUI を使わずにコントラクトの関数を叩くこと Metamask で、設定→ 高度な設定→16 進データを表示
送信ボタン→ 送信先=デプロイしたトークンのアドレス 16 進数データにinput date を入力 次へでtx を送信 【メタマスクで直コン!!】
Metamask の裏側で何をしているのか JSON データの作成 作成されたデータを秘密書で署名 署名されたデータをブロックチェーンに送信 参考 リンクのスクリプトを実行 https://github.com/0xywzx/event/blo b/main/20221019_cryptobase_how_s
martcontract_works/script/index.js data をコピー blockchain にbroadcast https://goerli.etherscan.io/pushTx balance (残高) let details = { nonce: "", gasPrice: "", gasLimit: "", to: "", from: "", value: "", data: "", type: "0" }
Solidity を読めるようになろう!! function (引数、修飾子) public, internal, external, view... 型と変数 address,
uint, bytes ... mapping require 他コントラクトの関数の呼び出しかた interface.methodName() グローバル変数 msg.sender, msg.value 参考 https://polygonscan.com/address/0xf4c64A797 1154f63f9Cc1C8D8f1Bcc4b7c644e77#code