Testing with Truffle
A step-by-step guide for creating a Truffle project and deploying it to your private StealthTest environment.
Last updated
Was this helpful?
A step-by-step guide for creating a Truffle project and deploying it to your private StealthTest environment.
Last updated
Was this helpful?
Before you begin, please make sure to 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:
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 contracts
migrations/
: Directory for scriptable deployment files
test/
: Directory for test files for testing your application and contracts
truffle-config.js
: Truffle configuration file
Output 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 ID
Use any private key provided by StealthTest and remove the 0x prefix.
Example truffle-config.js
below
Deploy your contracts
truffle migrate
Contract addresses will be output in the console.
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 but please never share your private key with us or anyone you don't know.