-
Fork and clone the repository
-
Switch to Node version specified in .nvmrc
nvm install
- Terminal Tab 1 - Install Truffle
- Reference: http://truffleframework.com/
npm install -g truffle
- Terminal Tab 2 - Install Test Framework with Ethereum TestRPC
npm install -g ganache-cli
- Terminal Tab 2 - Start Ethereum Blockchain Protocol Node Simulation
ganache-cli \
--port="8500" \
--mnemonic "copy obey episode awake damp vacant protect hold wish primary travel shy" \
--verbose \
--networkId=3 \
--gasLimit=7984452 \
--gasPrice=2000000000;
-
Optionally Install Geth and run the Testnet using Geth in the project directory:
- Show installation directory of Geth and Go, and show Go path Reference
which geth
which go
echo $GOPATH
geth version
- Show where Geth Chain directories are stored:
find ~ -type d -name 'chaindata'
- Install or Upgrade existing version of Geth (if not installed using Homebrew)
brew tap ethereum/ethereum
brew install ethereum
brew upgrade ethereum
- Terminal Tab 1 - Compile and Deploy the FixedSupplyToken Contract
truffle migrate --network development
- Terminal Tab 1 - Run Sample Unit Tests on the Truffle Contract. Truffle Re-Deploys the Contracts
truffle test
- Debug the Solidity Smart Contract in Remix IDE
- Verify the Solidity Smart Contract compiles by pasting it in MIST using https://github.com/ltfschoen/geth-node
- Verify the Solidity Smart Contract compiles by deploying it to Ethereum TestRPC using Truffle
- - Incorporate Automated Market Maker (AMM) similar to that described in 0x Whitepaper
- Install Truffle
- Reference: http://truffleframework.com/
npm install -g truffle
- Setup Truffle to Manage Contracts (i.e. MetaCoin sample), Migrations and Unit Tests
truffle init
truffle migrate --network development
-
Initialise with Front-End
- Truffle Default
- Truffle Webpack
- Truffle React
-
Truffle Configuration File Examples
- http://truffleframework.com/docs/advanced/configuration
- Note: Use
from
to specify the From Address for Truffle Contract Deployment. - Use the Mnemonic to Restart TestRPC with the same Accounts.
- Note: Use
provider
to specify a Web3 Provider - Note: Truffle Build
truffle build
script for say Webpack is usually in package.json
-
Truffle with Test Framework using Ethereum TestRPC (avoid delays in mining transactions with Geth Testnet)
- Ethereum TestRPC - In-Memory Blockchain Simulation
npm install -g ganache-cli
- Start Ethereum Blockchain Protocol Node Simulation with 10x Accounts on http://localhost:8500
- Creates 10x Private Keys and provides a Mnemonic. Assigns to each associated Address 100 Ether.
- Note: Private Keys may be imported into Metamask Client
- Note: Mnemonic may be used subsequently with Ethereum TestRPC to re-create the Accounts with `
ganache-cli
- Restart TestRPC with Same Accounts (i.e.
ganache-cli --mnemonic "copy obey episode awake damp vacant protect hold wish primary travel shy"
)
ganache-cli --port 8500 --mnemonic <INSERT_MNEMONIC>
-
Add FixedSupplyToken to Truffle Contracts folder
-
Remove MetaCoin from Truffle Contracts folder
-
Update 2nd Migration file to deploy FixedSupplyToken
-
Compile and Deploy the FixedSupplyToken Contract
truffle migrate --network development
- Run Sample Unit Tests on the Truffle MetaCoin Contract. Truffle Re-Deploys the MetaCoin Contracts
truffle test
-
Try restarting Ganache TestRPC if you encounter error
sender doesn't have enough funds to send tx. The upfront cost is: x and the sender's account only has: y
-
Fix error
Error: Error: Exceeds block gas limit
that may occur when sending Gas Limit say of50000000
when truffle.js hasgas
property set asgas: 4712388,
, by changing to a smaller value:myExchangeInstance.buyToken("FIXED", web3.toWei(4, "finney"), 5, {from: accounts[0], gas: 4000000});
-
Fix
Error: VM Exception while processing transaction: out of gas
. In thebuyToken
function it always occurs after a certain line of code. Simply increase the Gas Limit to the Mainnet's limit (currently shown as7984452
at https://ethstats.net/) in both Ganache CLI Flags and in truffle.js