6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Truffleのtutorialを試してみる

Posted at

スマートコントラクトでdappを作るべく、
truffleのtutorialを実施してみた。
https://truffleframework.com/tutorials/pet-shop

$ truffle develop

をすると
Connected to existing Truffle Develop session at http://127.0.0.1:9545/
につながる。

chromeでmetamaskを立ち上げる。
http://127.0.0.1:9545/ に接続しておく

truffle(develop)> compile
truffle(develop)> migrate
truffle(develop)> test

migrateの時点でスマートコントラクトがデプロイされてgasが引かれている

別ターミナルで
npm run dev

petが出てくるので、adoptボタンを押すと
metamask windowが立ち上がる

この際に、大きめのethをgas priceで払わないとsuccessにならなかった。
(222gweiくらい)

*ganacheを立ち上げよと書いてあるが、特に必要なかった。(truffle developでテストサーバを立てずに実施する際には必要そう)

##参考:
・【Ethereum】truffleのチュートリアルで、ペットショップのアプリ(Dapp)を作ってみた
https://www.katonobo.com/entry/ethereum-truffle
・Solidity 言語における詰まりどころメモ
Attempting to run transaction which calls a contract function, but recipient address is not a contract address エラー
https://qiita.com/kyrieleison/items/7f37b5349fc6c7c220cd

6
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?