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
Vue.jsとSolidityでDapps
Search
TakeshiNishi
September 22, 2018
Technology
0
2.2k
Vue.jsとSolidityでDapps
Vue.js(Nuxt)とSolidity(Truffle、zeppelin-solidity)でDapps開発
TakeshiNishi
September 22, 2018
Tweet
Share
More Decks by TakeshiNishi
See All by TakeshiNishi
LT駆動開発 - 話題のChatGPTで何か作る
takec24
0
150
成長ステージ別のスタートアップ集結!「事業の魅力とチームの本音」
takec24
0
77
Developing FLAPTALK by Firebase
takec24
1
330
NuxtCompositionAPIとFirebaseの話
takec24
1
490
コロナ禍でもリモート案件を途切れさせない! 案件の獲得方法とリモート案件の進め方。
takec24
0
300
フロントエンドエンジニアのためのFirebaseサーバーレス開発徹底解説
takec24
0
1.1k
スタートアップで働くというエンジニアキャリア
takec24
1
1.1k
人生を変えた炎上ブロジェクト
takec24
0
1.3k
好きなことを選び続けたら代表取締役CTOになりました。
takec24
2
1.2k
Other Decks in Technology
See All in Technology
Shift-from-React-to-Vue
calm1205
3
1.3k
IaC運用を楽にするためにCDK Pipelinesを導入したけど、思い通りにいかなかった話
smt7174
1
110
なんで、私がAWS Heroに!? 〜社外の広い世界に一歩踏み出そう〜
minorun365
PRO
6
1.1k
サイバーエージェントにおける生成AIのリスキリング施策の取り組み / cyber-ai-reskilling
cyberagentdevelopers
PRO
2
200
小規模に始めるデータメッシュとデータガバナンスの実践
kimujun
3
590
物価高なラスベガスでの過ごし方
zakky
0
380
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
290k
いまならこう作りたい AWSコンテナ[本格]入門ハンズオン 〜2024年版 ハンズオンの構想〜
horsewin
9
2.1k
Commitment vs Harrisonism - Keynote for Scrum Niseko 2024
miholovesq
6
1.1k
新R25、乃木坂46 Mobileなどのファンビジネスを支えるマルチテナンシーなプラットフォームの全体像 / cam-multi-cloud
cyberagentdevelopers
PRO
1
130
生成AIと知識グラフの相互利用に基づく文書解析
koujikozaki
1
140
プロダクト成長に対応するプラットフォーム戦略:Authleteによる共通認証基盤の移行事例 / Building an authentication platform using Authlete and AWS
kakehashi
1
150
Featured
See All Featured
Scaling GitHub
holman
458
140k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Documentation Writing (for coders)
carmenintech
65
4.4k
How to Think Like a Performance Engineer
csswizardry
19
1.1k
How to Ace a Technical Interview
jacobian
275
23k
A better future with KSS
kneath
238
17k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
KATA
mclloyd
29
13k
Designing Experiences People Love
moore
138
23k
Transcript
diffeasy. inc 7VFKTͱ4PMJEJUZͰ%BQQT !@UBLFTIJ@
diffeasy. inc 2 /VYU 'JSFCBTF 7VF Թઘ ಡॻ (PMBOH 3VCZ
($1 ϒϩοΫνΣʔϯ إೱ͍ גࣜձࣾEJ⒎FBTZ σΟϑΟʔδʔ औక$50 ࢙ ʹ͚ͨ͠͠ !@UBLFTIJ@ EPDLFS
diffeasy. inc 3 ੈքதͷlΉ͔͍ͣ͠zΛ؆୯ʹ NBLFEJ⒏DVMUUIJOHTFBTZ
diffeasy. inc 4 ඪୡ Ϛϯμϥʔτ
diffeasy. inc 7VFKTͱ4PMJEJUZͰ%BQQT !@UBLFTIJ@
diffeasy. inc 6 lΉ͔͍ͣ͠zݴ༿Λ؆୯ʹઆ໌
diffeasy. inc 7 %BQQT ʹ%FDFOUSBMJ[FE"QQMJDBUJPOT ʹࢄܕΞϓϦέʔγϣϯ %BQQTͱʁ
diffeasy. inc 8 4PMJEJUZͱʁ &UIFSFVN্Ͱಈ͘ +BWB4DSJQUϥΠΫͳ εϚʔτίϯτϥΫτ։ൃݴޠ
diffeasy. inc 9 8FC ϒϩοΫνΣʔϯ Γ͍ͨߏ
diffeasy. inc 10 ϒϩοΫνΣʔϯ ࠓ͜͜ͷ
diffeasy. inc ͱΓ͋͑ͣσϞ 11
diffeasy. inc 12 Ծ௨՟Λൃߦ
diffeasy. inc w εϚʔτίϯτϥΫτͷ։ൃɺσϓϩΠɺ ςετɺϚΠάϨʔγϣϯ w &UIFSFVNͰτʔΫϯͷൃߦ 13 OpenZeppelin TruffleϑϨʔϜϫʔΫ
diffeasy. inc 14 truffleϑϨʔϜϫʔΫΛΠϯετʔϧ $ npm install -g truffle truffleϑϨʔϜϫʔΫॳظԽ
$ truffle init zeppelin-solidityΛΠϯετʔϧ $ npm install zeppelin-solidity --save Πϯετʔϧ
diffeasy. inc 15 &3$४ڌͷ τʔΫϯ ίϯτϥΫτ ΛσϓϩΠ͢Δ ϚΠάϨʔγϣϯ ϑΝΠϧ
diffeasy. inc 16 pragma solidity ^0.4.18; import "zeppelin-solidity/contracts/token/ERC20/ StandardToken.sol"; contract
DiffeasyCoin is StandardToken { string public constant name = "DiffeasyCoin"; string public constant symbol = "DEC"; uint8 public constant decimals = 18; constructor(uint256 _initialSupply) public { totalSupply_ = _initialSupply; balances[msg.sender] = _initialSupply; emit Transfer(0x0, msg.sender, _initialSupply); } } %J⒎FBTZ$PJOTPM
diffeasy. inc 17 const DiffeasyCoin = artifacts.require('./DiffeasyCoin.sol') module.exports = (deployer)
=> { const initialSupply = 50000e18 deployer.deploy(DiffeasyCoin, initialSupply) } @EFQMPZ@EJ⒎FBTZ@DPJOKT
diffeasy. inc 18 $ truffle develop Truffle Develop started at
http://127.0.0.1:9545/ Accounts: (0) 0x627306090abab3a6e1400e9345bc60c78a8bef57 (1) 0xf17f52151ebef6c7334fad080c5704d77216b732 (2) 0xc5fdf4076b8f3a5357c5e395ab970b5b54098fef (3) 0x821aea9a577a9b44299b9c15c88cf3087f3b5544 (4) 0x0d1d4e623d10f9fba5db95830f7d3839406c6af2 (5) ɾɾɾɾ Private Keys: (0) c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec (1) ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d (2) 0dbbe8e4ae425a6d2687f1a7e3ba17bc98c673636790f1b8ad911 (3) c88b703fb08cbea894b6aeff5a544fb92e78a18e19814cd85da83 (4) 388c684f0ba1ef5017716adb5d21a053ea8e90277d0868337519f (5) ɾɾɾɾ ։ൃ༻ͷ&UIFSFVNڥΛىಈ
diffeasy. inc 19 ϑϩϯτΤϯυͱ࿈ܞ
diffeasy. inc 20 NuxtΛΠϯετʔϧ $ vue init nuxt-community/starter- template front
Web3.jsΠϯετʔϧ $ npm install web3 @types/node truffle-contract --save Πϯετʔϧ
diffeasy. inc 21 &UIFSFVNͱଓ import Web3 from 'web3' const web3
= new Web3(new Web3.providers.HttpProvider ("http://127.0.0.1:9545/")) if (typeof web3.currentProvider.sendAsync !== "function") { web3.currentProvider.sendAsync = function() { return web3.currentProvider.send.apply( web3.currentProvider, arguments ); }; } export default web3 QMVHJOTXFCKT
diffeasy. inc 22 &UIFSFVN্ͷΞΧϯτϦετऔಘ web3.eth.getAccounts() ΞΧϯτͷԾ௨՟ߴऔಘ const dec = contract(DiffeasyCoin)
dec.setProvider(web3.currentProvider) const instance = await dec.deployed() const balances ɹɹɹ= awaitɹinstance.balanceOf(account) XFCΛͬͯ&UIFSFVNͱଓ
diffeasy. inc 23 "͔Β#ʹԾ௨՟औҾ const dec = contract(DiffeasyCoin) dec.setProvider(web3.currentProvider) const
instance = await dec.deployed() await instance.transfer ɹɹɹɹɹ(to, balance, { from: from }) XFCΛͬͯ&UIFSFVNͱଓ
diffeasy. inc 24 ϒϩοΫνΣʔϯ ར༻ͨ͠αʔϏε৭ʑ
diffeasy. inc 25 ετϨʔδ ࿀Ѫ Ξʔτ Իָ
diffeasy. inc ຊʹϒϩοΫνΣʔϯ ͕ඞཁ͔ʁ 26
diffeasy. inc w தԝूݖతͳཧऀ͕͍ͳ͍͜ͱ ͕ຊʹྑ͍͔ʁ w վ͟Μʢमਖ਼ʣ͕ࠔͳ͜ͱ͕ ຊʹྑ͍͔ʁ 27
diffeasy. inc w σʔλ͕ίϐʔͰ͖ͳ͍Θ͚Ͱ ͳ͍ w ӡӦऀͷ৴པੑ͕ॏཁͳϙΠϯτ ͔ʁ 28
diffeasy. inc 29 ੈքதͷ“Ή͔͍ͣ͠”Λ ؆୯ʹ