Learn how to use the full Truffle Suite with Ethereum, Quorum, Hyperledger EVM, and other EVM-based chains
- -+ The Truffle Suite has everything you need to develop smart contracts for + Ethereum and other EVM-compatible chains: a CLI tool to build, test, and + deploy smart contracts; a Dashboard to inspect and debug transactions; and a + simulator to test your ideas quickly and work with forked networks. +
-ONE CLICK BLOCKCHAIN Fast, easy, local development blockchain in UI and CLI flavors. Introspection of contract data and events.
++ INSIGHTFUL DEVELOPMENT A platform for dapp + developers to get insights about smart contracts and their + transactions. +
+ We highly recommend adding an Etherscan API Key to speed up debugger initialization. The debugger will need to fetch and compile any contracts not included in your project, which requires a number of API calls. Supplying an Etherscan API key allows us to do this far faster thanks to higher rate limits. +
+ +## Adding an Etherscan API Key + +Navigate to the debugger screen using the sidebar link. You’ll be prompted to add an Etherscan API key if you haven’t already. We’ll store this key in your browser’s local storage. + +![Add your Etherscan key to Truffle Dashboard when prompted on the Debugger screen](/img/docs/truffle-dashboard/truffle-dashboard-debugger/add-etherscan-key.png) + +## Deleting and Changing an Etherscan API Key + +If you’ve already provided a key, you may have rotated it or wish to use a different one. To change the API key, first delete your existing key, then add the new one. + +![Remove your Etherscan key from Truffle Dashboard when prompted on the Debugger screen to add a new one](/img/docs/truffle-dashboard/truffle-dashboard-debugger/delete-etherscan-key.png) + +## Debugging from a Signature Confirmation + +When a transaction appears in Truffle Dashboard for signature confirmation, you’ll see a Simulate button to the right of the other options on the card. Clicking this button will launch the debugger for this transaction. + +![Debug a transaction from the Signature Confirmation screen by clicking the Debug button on a card](/img/docs/truffle-dashboard/truffle-dashboard-debugger/debug-button.png) + +## Debugging from a Transaction Hash + +You can paste any arbitrary transaction hash into the debugger rather than using the signature confirmation cards. Paste the desired transaction hash into the input at the upper-right of the debugger screen and click the debug button or press enter to start the debugger session. Note that the Debug button will be disabled until a valid transaction hash is provided. + +![Debug a transaction using its hash by pasting the hash into the text input on the Debugger screen](/img/docs/truffle-dashboard/truffle-dashboard-debugger/debug-hash.png) + +## The Debugger UI + +The debugger UI is composed of a top menu and 4 panels. + +![The Dashboard Debugger interface](/img/docs/truffle-dashboard/truffle-dashboard-debugger/debug-interface.png) + +The top menu contains 6 buttons in addition to the transaction hash input: + +- **Continue (Until Next Breakpoint)**: If a breakpoint is set, this continues execution until the next breakpoint is reached or the last line is executed. Note this will be inactive until you set a breakpoint. +- **Step Next**: Steps to the next logical statement or expression in the source code. For example, evaluating sub expressions will need to occur first before the virtual machine can evaluate the full expression. Use this command if you'd like to analyze each logical item the virtual machine evaluates. +- **Step Over**: Steps over the current line, relative to the position of the statement or expression currently being evaluated in the Solidity source file. Use this command if you don't want to step into a function call or contract creation on the current line, or if you'd like to quickly jump to a specific point in the source file. +- **Step Into**: Steps into the function call or contract creation currently being evaluated. Use this command to jump into the function and quickly start debugging the code that exists there. +- **Step Out**: Steps out of the currently running function. Use this command to quickly get back to the calling function, or end execution of the transaction if this was the entry point of the transaction. +- **Reset**: Reset the debugger to the beginning of the transaction. Note this will be inactive until you step in some way. + +There are 4 panels: + +- **Code**: Contains the smart contract code we’re stepping through. Each contract involved in this transaction is displayed in a tab. If we’re unable to get the source code of a contract, we can still debug the transaction, but that particular contract will be opaque and you’ll see an “Unknown Contract” tab noting this. +- **Variables**: Contains the current variables and their values. +- **Breakpoints**: Contains the breakpoints you’ve set. See [Managing Breakpoints](#managing-breakpoints) for more information. +- **Stack**: Contains the callstack at the current point of execution. + +## Managing Breakpoints + +### Setting a Breakpoint + +To set a breakpoint, click the space to the left of a line number. You’ll see a red dot appear in that space and an entry added to the Breakpoints panel. + +### Jumping to a Breakpoint + +To jump to the contract and line containing a particular breakpoint, click the text containing the contract name and line number in the breakpoints panel. + +### Removing a Breakpoint + +To remove a breakpoint, click the red dot for the breakpoint you’d like to remove. You can also click the red dot next to the breakpoint in the breakpoints panel. diff --git a/src/docs/truffle/.pages b/src/docs/truffle/.pages index 5f6c4d06b..5a8b76de1 100644 --- a/src/docs/truffle/.pages +++ b/src/docs/truffle/.pages @@ -4,5 +4,5 @@ nav: - How to: how-to - Concepts: concepts - Reference: reference - - Tutorials: /guides + - Tutorials: guides - Support: contact-the-developers.md diff --git a/src/docs/truffle/how-to/.pages b/src/docs/truffle/how-to/.pages index 8ef1e0e87..3e359cdf8 100644 --- a/src/docs/truffle/how-to/.pages +++ b/src/docs/truffle/how-to/.pages @@ -4,11 +4,10 @@ nav: - Compile a project: compile-contracts.md - Integrate with MetaMask: truffle-with-metamask.md - Work with contracts: contracts - - Use Truffle Dashboard: use-the-truffle-dashboard.md - Debug and test: debug-test - Use NPM package manager: package-management-via-npm.md - Use the build pipeline: use-the-build-pipeline.md - Preserve content: preserve-files-and-content-to-storage-platforms.md - Write external scripts: write-external-scripts.md - Configure a distributed ledger: distributed-ledger-support - - Create a Truffle Box: create-a-truffle-box.md \ No newline at end of file + - Create a Truffle Box: create-a-truffle-box.md diff --git a/src/docs/truffle/how-to/use-the-truffle-dashboard.md b/src/docs/truffle/how-to/use-the-truffle-dashboard.md deleted file mode 100644 index 6980ea358..000000000 --- a/src/docs/truffle/how-to/use-the-truffle-dashboard.md +++ /dev/null @@ -1,137 +0,0 @@ ---- -title: Use Truffle Dashboard -layout: docs.hbs ---- -# Use Truffle Dashboard - -When deploying your smart contracts you need to specify an Ethereum account that has enough funds to cover the transaction fees of the deployment. A popular method of doing this is copy-pasting your mnemonic phrase to a gitignored `.env` file so that it can be used for, e.g., the `@truffle/hdwallet-provider`. However, it is generally a bad practice to copy-paste your keys, especially since we have wallets like MetaMask that can send transactions for us. - -We developed the Truffle Dashboard to provide an easy way to use your existing MetaMask wallet for your deployments and for other transactions that you need to send from a command line context. Because the Truffle Dashboard connects directly to MetaMask it is also possible to use it in combination with hardware wallets like Ledger or Trezor. - -## Starting a dashboard - -To start a Truffle Dashboard, you need to run the `truffle dashboard` command in a separate terminal window. - -``` -> truffle dashboard [--port
- Information: The decode functionality is available
-in Truffle projects for the following methods: eth_sendTransaction
, personal_sign
, eth_signTypedData_v3
, and
-eth_signTypedData_v4
. We plan to support non-Truffle tooling such as Hardhat in the future.
-
- Information: Truffle Dashboard cannot decode requests -when using tools other than Truffle; we plan to add support for other tools in the future. -
- -When using the Truffle Dashboard with Hardhat, you need to create a network configuration inside your `hardhat.config.js` file that specifies the Truffle Dashboard's RPC URL. - -```js -module.exports = { - // ... rest of hardhat config - - networks: { - // ... rest of network config - - 'truffle-dashboard': { - url: "http://localhost:24012/rpc" - } - }, -}; -``` - -From there, it can be used with any Hardhat task or tools like hardhat-deploy. - -``` -hardhat deploy --network truffle-dashboard -``` diff --git a/src/img/docs/truffle-dashboard/index/truffle-dashboard-logo.svg b/src/img/docs/truffle-dashboard/index/truffle-dashboard-logo.svg new file mode 100644 index 000000000..ab0c91f6b --- /dev/null +++ b/src/img/docs/truffle-dashboard/index/truffle-dashboard-logo.svg @@ -0,0 +1,39 @@ + + \ No newline at end of file diff --git a/src/img/docs/truffle-dashboard/quickstart/confirm-network.png b/src/img/docs/truffle-dashboard/quickstart/confirm-network.png new file mode 100644 index 000000000..eda12fc6d Binary files /dev/null and b/src/img/docs/truffle-dashboard/quickstart/confirm-network.png differ diff --git a/src/img/docs/truffle-dashboard/quickstart/connect-wallet.png b/src/img/docs/truffle-dashboard/quickstart/connect-wallet.png new file mode 100644 index 000000000..33a2e40f1 Binary files /dev/null and b/src/img/docs/truffle-dashboard/quickstart/connect-wallet.png differ diff --git a/src/img/docs/truffle-dashboard/quickstart/signature-request.png b/src/img/docs/truffle-dashboard/quickstart/signature-request.png new file mode 100644 index 000000000..fc6047cff Binary files /dev/null and b/src/img/docs/truffle-dashboard/quickstart/signature-request.png differ diff --git a/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/add-etherscan-key.png b/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/add-etherscan-key.png new file mode 100644 index 000000000..ccd7ee424 Binary files /dev/null and b/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/add-etherscan-key.png differ diff --git a/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/debug-button.png b/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/debug-button.png new file mode 100644 index 000000000..806ce9533 Binary files /dev/null and b/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/debug-button.png differ diff --git a/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/debug-hash.png b/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/debug-hash.png new file mode 100644 index 000000000..0aa3baa0e Binary files /dev/null and b/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/debug-hash.png differ diff --git a/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/debug-interface.png b/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/debug-interface.png new file mode 100644 index 000000000..31e6861da Binary files /dev/null and b/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/debug-interface.png differ diff --git a/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/delete-etherscan-key.png b/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/delete-etherscan-key.png new file mode 100644 index 000000000..eaa445cdd Binary files /dev/null and b/src/img/docs/truffle-dashboard/truffle-dashboard-debugger/delete-etherscan-key.png differ