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
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
270
推論基盤と Scale-Up Interconnect の現状と制約から俯瞰する技術動向
markunet
2
520
クラウドサインを止めずに Nuxt へ 次の10年のために先に決めたこと
bengo4com
1
170
Deep Data Security 機能解説
oracle4engineer
PRO
3
950
[re:Invent2026事前勉強会(有志開催)]続きは、ラスベガスの廊下で / continue-in-the-vegas-hallway
sh_fk2
0
340
PostgreSQL at Microsoft: Open Source, AI, & Cloud | Claire Giordano | PGConf.EU 2026
clairegiordano
0
110
Draft AIエージェントの トークン消費を最小化する 8つの原則
kinopeee
6
1.8k
DevelopersIO2026 -バックアップは“消されないこと”が9割-
yoshida0129
0
430
キヨさん、67歳。AIコーディングエージェントに挑む
happysamurai294
0
110
Agent × Maestro で始める モバイル E2E 端末準備からテスト実行・結果確認まで
sansantech
PRO
0
230
1週間、Opus封印でお願いします
kintotechdev
0
320
Patterns in AI Driven Software Development
akosma
PRO
0
270
Featured
See All Featured
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
590
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
580
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Building the Perfect Custom Keyboard
takai
2
920
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
Utilizing Notion as your number one productivity tool
mfonobong
4
630
Google's AI Overviews - The New Search
badams
0
1.6k
How to train your dragon (web standard)
notwaldorf
96
6.9k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
270
Odyssey Design
rkendrick25
PRO
2
890
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
530
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k
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