GithubHelp home page GithubHelp logo

dex's Introduction

Setup

  • Fork and clone the repository

  • Install NVM

  • Switch to Node version specified in .nvmrc

nvm install
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'
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

Debugging

  • 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

TODO

  • - Incorporate Automated Market Maker (AMM) similar to that described in 0x Whitepaper

Initial Setup - Truffle, TestRPC, Unit Tests (FixedSupplyContract)

npm install -g truffle
  • Setup Truffle to Manage Contracts (i.e. MetaCoin sample), Migrations and Unit Tests
truffle init

truffle migrate --network development
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

Troubleshooting

  • 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 of 50000000 when truffle.js has gas property set as gas: 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 the buyToken function it always occurs after a certain line of code. Simply increase the Gas Limit to the Mainnet's limit (currently shown as 7984452 at https://ethstats.net/) in both Ganache CLI Flags and in truffle.js

dex's People

Contributors

ltfschoen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.