Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Truffleの紹介_in_hicon2018.pdf

nakajo2011
November 10, 2018

 Truffleの紹介_in_hicon2018.pdf

nakajo2011

November 10, 2018
Tweet

More Decks by nakajo2011

Other Decks in Programming

Transcript

  1. Copyright ©2018 chaintope, Inc. all rights reserved. 自己紹介 • Yukishige

    Nakajo • 株式会社chaintope Chief Ethereum Researcher • 福岡県の飯塚市でEthereumの研究中 • 最近はBitcoinもやってます • truffle-hdwallet-providerのcontributerです! https://twitter.com/nakajo https://y-nakajo.hatenablog.com/
  2. Copyright ©2018 chaintope, Inc. all rights reserved. Truffleの紹介 1. Truffleの概要

    2. migation 3. ganache 4. mocha 5. その他の機能 今日話すこと
  3. Copyright ©2018 chaintope, Inc. all rights reserved. Truffleの紹介 1. Truffleの概要

    2. migation 3. ganache 4. mocha 5. その他の機能 今日話すこと
  4. Copyright ©2018 chaintope, Inc. all rights reserved. Truffleの紹介 1. Truffleの概要

    2. migation 3. ganache 4. mocha 5. その他の機能 今日話すこと
  5. Copyright ©2018 chaintope, Inc. all rights reserved. • Smart Contractのデプロイ方法を記述するもの

    • DB Migrationのようにバージョンを分けて記述可能 • DB Migrationと大きく違うのはrollbackできないこと • バージョンを指定して途中までdeployとかもできない。 2. Migration
  6. Copyright ©2018 chaintope, Inc. all rights reserved. • Library ContractとのLink

    https://truffleframework.com/docs/truffle/getting-started/running-migrations 2. Migration
  7. Copyright ©2018 chaintope, Inc. all rights reserved. Truffleの紹介 1. Truffleの概要

    2. migation 3. ganache 4. mocha 5. その他の機能 今日話すこと
  8. Copyright ©2018 chaintope, Inc. all rights reserved.  開発用のnode • 即時マイニング機能

    • 固定されたmnemonic • 便利なRPC • 任意のgas limitが指定可能(別起動時に指定可能) 3. ganache
  9. Copyright ©2018 chaintope, Inc. all rights reserved. • 即時マイニング •

    Transactionが発行されるたびにすぐにminingが行 われる。 • Transactionが行方不明にならない! • mining待ちも発生しない。 3. ganache
  10. Copyright ©2018 chaintope, Inc. all rights reserved. • 便利なRPC •

    evm_increaseTime: block timeを任意の時間に設 定(ただし未来のみ) • evm_mine: 即時mining • evm_snapshot: 現在の状態のsnapshotをとる • evm_revert: 状態を指定されたsnapshotに戻す 3. ganache
  11. Copyright ©2018 chaintope, Inc. all rights reserved. • 任意のgas limitが指定可能(別起動時に指定可能)

    https://github.com/trufflesuite/ganache-cli#using-ganache-cli $ ganace-cli -l 99999999 & truffle test 3. ganache
  12. Copyright ©2018 chaintope, Inc. all rights reserved. Truffleの紹介 1. Truffleの概要

    2. migation 3. ganache 4. mocha 5. その他の機能 今日話すこと
  13. Copyright ©2018 chaintope, Inc. all rights reserved. • Javascriptでは有名なunit test

    tool • basic (describe, it) • before, after, beforeEach, afterEach • skip, only 4. mocha
  14. Copyright ©2018 chaintope, Inc. all rights reserved. • basic (describe,

    it) https://mochajs.org/#asynchronous-code 4. mocha
  15. Copyright ©2018 chaintope, Inc. all rights reserved. • basic (describe,

    it) https://mochajs.org/#asynchronous-code 4. mocha
  16. Copyright ©2018 chaintope, Inc. all rights reserved. • before, after,

    beforeEach, afterEach https://mochajs.org/#hooks 4. mocha
  17. Copyright ©2018 chaintope, Inc. all rights reserved. • skip, only

    https://mochajs.org/#inclusive-tests 4. mocha
  18. Copyright ©2018 chaintope, Inc. all rights reserved. • skip, only

    https://mochajs.org/#inclusive-tests 4. mocha
  19. Copyright ©2018 chaintope, Inc. all rights reserved. • skip, only

    https://mochajs.org/#exclusive-tests 4. mocha
  20. Copyright ©2018 chaintope, Inc. all rights reserved. • skip, only

    https://mochajs.org/#exclusive-tests 4. mocha
  21. Copyright ©2018 chaintope, Inc. all rights reserved. Truffleの紹介 1. Truffleの概要

    2. migation 3. ganache 4. mocha 5. その他の機能 今日話すこと
  22. Copyright ©2018 chaintope, Inc. all rights reserved. • truffle-debugger •

    https://github.com/trufflesuite/truffle/tree/next/packages/truffle-debugger#truffle-debug ger • truffle-contract : 単体でも使える • truffle-artifactor 5. その他の機能