🍬Testing with Truffle
A step-by-step guide for creating a Truffle project and deploying it to your private StealthTest environment.
Before you begin, please make sure to create your StealthTest environment and have access to the RPC URL and chain ID.
This document is intended to act as a quick-start integration guide for new Truffle projects. If you already have an established Truffle project, skip to step 3.
For more information on Truffle, please access the documentation here: Truffle documentation
We will never ask you for your private key, nor will it ever be required at any step in the process of creating a StealthTest environment.
Install Truffle
npm install -g truffle
Create a new Truffle project
truffle unbox metacoin truffle-tutorial
This is an example project that creates a new token called
MetaCoin
Important directories include
contracts/
: Directory for Solidity contractsmigrations/
: Directory for scriptable deployment filestest/
: Directory for test files for testing your application and contractstruffle-config.js
: Truffle configuration fileOutput from creating your new Truffle project:
Ensure your contracts are working properly by running the test suite
truffle test
Output from successful tests
Compile your contracts
truffle compile
Configure your Truffle project
npm i @truffle/hdwallet-provider
Using your StealthTest URL, update
truffle-config.js
*
will match any network IDUse any private key provided by StealthTest and remove the 0x prefix.
Note: Each StealthTest environment comes with 5 pre-funded wallets, but please never use these on mainnet. You may also quickly fund your own wallet with our Faucet but please never share your private key with us or anyone you don't know.
Example
truffle-config.js
below
Deploy your contracts
truffle migrate
Contract addresses will be output in the console.
Last updated