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
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
34
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
260
BUILD UP for Web3 engineer
aramaki
0
960
NFT事例集/nft_cases
aramaki
1
200
ブロックチェーン 活用事例集 トレーサビリティー/blockchain-traceability
aramaki
1
260
Other Decks in Technology
See All in Technology
子育てエンジニアの可処分時間が減っても成長を諦めない戦い方
sudoakiy
1
1.1k
Incremental HTTP
kazuho
5
2.1k
[2026 Oracle Technical Deep Dive] エンタープライズAIエージェントを支えるOCIソリューション。ラインナップと特徴を理解しよう! (2026年9月17日開催)
oracle4engineer
PRO
0
550
おそらく日本で唯一のDevRelインターン生として
husengs7
0
170
20260930_Gemma4_Hands-on
tsho
0
230
Datadog の学び方 - あるいは、オブザーバビリティを学ぶとは何か
mananyuki
1
490
Snapshot Testing in Practice: Predictable and Reliable SwiftUI Views
fespinoza
0
130
実体験から学ぶ分析エージェントの開発と運⽤
recruitengineers
PRO
1
300
分析AIエージェントを育てる、動く環境を育てる
codatum
0
110
あなたの知らないAmazon VPC Route Server/Amazon VPC Route Server you don't know about
masakiokuda
2
220
AI時代に必要な脅威モデリング― 変化の速度に負けない理解とリスク判断
masakane55
4
1.1k
Claude起点の仕様駆動開発
tanakaseiya
0
400
Featured
See All Featured
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
3
4.3k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
540
Mind Mapping
helmedeiros
1
390
Code Review Best Practice
trishagee
74
20k
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
RailsConf 2023
tenderlove
30
1.6k
Chasing Engaging Ingredients in Design
codingconduct
0
340
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
390
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
The agentic SEO stack - context over prompts
schlessera
0
970
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