blockchain:drizzleを使たdapps開発
差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
blockchain:drizzleを使たdapps開発 [2022/04/29 07:49] – dot | blockchain:drizzleを使たdapps開発 [2022/05/06 01:46] (現在) – dot | ||
---|---|---|---|
行 1: | 行 1: | ||
====== Drizzleを使ったDApps開発 ====== | ====== Drizzleを使ったDApps開発 ====== | ||
+ | 「truffle unbox drizzle」を実行すると、スマートコントラクトを開発するための truffle プロジェクト、フロントエンドを開発するための drizzle(+React) の雛形を生成することができます。雛形は既に動作しますので、そこに変更を加えることで、独自の DApps を開発していきます。(もちろん手動で各種ファイルを作成していく方法も可能です。) | ||
- | ===== インストール | + | ===== react-app の生成 |
- | + | ||
- | :!: Windows の場合、以下の npm パッケージが必要な場合があります。 | + | |
<code PowerShell> | <code PowerShell> | ||
- | > npm install --global | + | > npm install |
+ | > mkdir my_drizzle | ||
+ | > cd my_drizzle | ||
+ | > create-react-app . | ||
+ | > npm install | ||
</ | </ | ||
+ | ===== デモの実行 ===== | ||
+ | ==== ビルドに必要なパッケージをインストール ==== | ||
- | <code PowerShell> | + | :!: Windows の場合です。 |
- | my_project> | + | |
- | Need to install the following packages: | + | |
- | create-react-app | + | |
- | Ok to proceed? (y) y | + | |
- | npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap. | + | |
- | Creating a new React app in C:\Users\shinobu\NoNameSeminer\ethereum\my_project\client. | + | [[https:// |
- | Installing packages. This might take a couple of minutes. | + | ==== プロジェクトの生成 ==== |
- | Installing react, react-dom, and react-scripts with cra-template... | + | |
+ | <code PowerShell> | ||
+ | > mkdir drizzle_project | ||
+ | > cd drizzle_project | ||
+ | > truffle unbox drizzle | ||
+ | </ | ||
- | added 1379 packages in 7m | + | ==== 設定 ==== |
- | 176 packages are looking for funding | + | 生成された「truffle-config.js」は古い形式であるため、「develop: |
- | run `npm fund` for details | + | また、使用する ethereum ブロックチェーンによって host と port も変更します。 |
- | Initialized a git repository. | + | <code JavaScript> |
+ | const path = require(" | ||
- | Installing template dependencies using npm... | + | module.exports = { |
- | npm WARN deprecated source-map-resolve@0.6.0: | + | // |
+ | // to customize your Truffle configuration! | ||
+ | contracts_build_directory: | ||
+ | networks: { | ||
+ | development: | ||
+ | host: " | ||
+ | port: 8545, | ||
+ | network_id: " | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | </ | ||
- | added 39 packages in 42s | + | ==== npm パッケージのインストール ==== |
- | 176 packages are looking for funding | + | まずは drizzle_project ディレクトリの直下で |
- | run `npm fund` for details | + | |
- | Removing template package using npm... | + | |
+ | <code PowerShell> | ||
+ | drizzle_project> | ||
+ | </ | ||
- | removed 1 package, and audited 1418 packages in 17s | + | 続いて、drizzle_project/ |
- | 176 packages are looking for funding | + | <code PowerShell> |
- | run `npm fund` for details | + | drizzle_project/ |
+ | </ | ||
- | 6 moderate severity vulnerabilities | + | ==== スマートコントラクトのデプロイ ==== |
- | To address all issues (including breaking changes), run: | + | drizzle_project ディレクトリの直下で以下を実行します。 |
- | npm audit fix --force | + | |
- | Run `npm audit` for details. | + | <code PowerShell> |
+ | drizzle_project> | ||
+ | </ | ||
- | Created git commit. | + | ==== 実行 ==== |
- | Success! Created client at C: | + | drizzle_project/ |
- | Inside that directory, you can run several commands: | + | |
- | | + | <code PowerShell> |
- | | + | drizzle_project/ |
- | + | </ | |
- | npm run build | + | |
- | Bundles the app into static files for production. | + | |
- | npm test | + | ブラウザが起動してデモが動作しているはずです。 |
- | Starts the test runner. | + | |
- | npm run eject | + | ===== 独自機能の追加 ===== |
- | Removes this tool and copies build dependencies, | + | |
- | and scripts into the app directory. If you do this, you can’t go back! | + | |
- | + | ||
- | We suggest that you begin by typing: | + | |
- | + | ||
- | cd client | + | |
- | npm start | + | |
- | + | ||
- | Happy hacking! | + | |
- | PS C: | + | |
- | </ | + |
blockchain/drizzleを使たdapps開発.1651218587.txt.gz · 最終更新: 2022/04/29 07:49 by dot