- Have node installed. If you run into trouble, this was created with
v8.9.4
- Install and run Ganache
- Install MetaMask
- Create and connect to a custom RPC network using the Ganache RPC server (currently
http://127.0.0.1:7545
) - Import a new account and use the private key provided by Ganache from account 1.
- Create and connect to a custom RPC network using the Ganache RPC server (currently
- Install the Truffle Framework
npm install -g truffle
- you may need to install a specific version of truffle if you run into issues with solidity compiler versions not matching what your contract needs
npm view truffle versions
will show you all the versions of trufflenpm install -g truffle@(specify version)
to get a certain versiontruffle version
will tell you what version of the solidity compiler this truffle version is using- try new truffle versions until you get the right solidity compiler
- Clone or download the repo
- Type
npm install
- If you get an error on install, don't panic. It should still work.
- Type
truffle compile
andtruffle migrate
- Type
npm run start
- Put on a pair of sunglasses and bask in your blockchain glory. 🍺
Here we go over everything in this repo.
- Start Ganache.
- Unlock MetaMask with local RPC network.
- Switch accounts to the one we imported.
truffle compile
truffle migrate
ortruffle migrate --reset
if you get errors such asError: Attempting to run transaction which calls a contract function, but recipient address (whatever the address is) is not a contract address
npm run start
Type truffle test
to test.
- Is Ganache running?
- Is your MetaMask account unlocked?
- Are you using the MetaMask account associated with your Ganache account (the one we created above)?
- Are you using your custom RPC network in MetaMask?
- If MetaMask can't find your RPC network, try switching to the Main Ethereum Network and back.
- Did you
truffle compile
andtruffle migrate
whenever starting your local network or making changes to your smart contract? - Transaction error? Try resetting the MetaMask account you created under settings.
- Is
truffle migrate
showing stale settings? Trytruffle migrate --reset