This is a simple decentralized app (dApp) to help launch/manage an Initial Coin Offering (ICO) backed by Ether and the Ethereum blockchain. The dApp utilizes Truffle, Metamask and Ganache to deploy and test contracts:
This demo is hosted on Heroku and works if you have the Metamask extension for your browser installed. More details on installation below.
- Live Demo: https://ico-launcher.herokuapp.com/
This dAPP implements three solidity contracts deployed to the Ropsten Testnet -- Fundraiser.sol, Fund.sol, and FundCoin.sol (the pretend asset of the fundraiser).
To run the app in your own development environment, you need Node.js / NPM, Webpack, Truffle, and Optionally Ganache. To get these build essentials, do the following...
1. Install Homebrew:
In the terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew doctor
brew prune
brew -v
2. Install Node, NPM, Weback and Truffle
Now, install build essentials (if you don't have these already:
brew install node #installs both node and npm
npm install -g truffle
npm install -g webpack #for the cli
node -v
npm -v
truffle -v
webpack -v
3. Clone this repo
Then, clone a copy of this repo:
git clone https://github.com/codeamt/ethICO.git
4. Install/Setup Metamask
Metamask has a few extensions available, depending upon your preferred browser (Chrome, Firefox, or Opera), but also offers their own web3 browser Brave.
To get the right extension, download here.
Once you've completed the Metamask onboarding process, switch the network from the MainNet to Ropsten Testnet.
Steps:
- Go back to the Metamask extension, click on the drop down menu where it says MainNet and select the "Ropsten Test Network" option:
Metamask will automagically generate your first eth account on the Testnet for you.
5. Run the Project and Launch an ICO Campaign!
In the terminal:
cd ethICO && npm run dev
Now go to https://localhost:7545 in the browser, and the dApp should be running out of the box! You can launch the ICO and purchase FundCoin (FDC) to contribute! Since this app is only for demonstrative purposes, the Withdrawal functionality is intentially left out.
To iterate on this project, delete index.html and app.js in the build directory, make changes, save and run:
npm run build
The build folder should be populated with browser-friendly versions of your updated index.html and app.js.
6. Download/Install Truffle's Ganache (Optional)
Ganache sets up a local rpc server and blockchain for testing purposes. It also comes with 5 Ethereum test accounts, preloaded with ether.
Download here: Ganache Download for Mac OS
Once downloaded and launched, your dashboard should look like this:
Localhost will use Ganache now. To import Ganache addresses into Metamask:
Steps:
- In Ganache, copy the RPC server url up at the top (which should be https://127.0.0.1:7545)
- Go back to the Metamask extension, click on the drop down menu where it says MainNet and select the "Custom RPC" option:
- Then paste the Ganache RPC url where it says "New RPC url" and save:
Again, Metamask will automagically import your first eth address listed in Ganache. To import more than one Ganache account:
- In Ganache, under accounts, click on the key icon by one of the other accounts you'd like to sync with Metamask and copy its private key.
- Back in Metamask, click on the user profile icon and select "import address"
- Paste the private key you copied into the input: