How to run a simple Ethereum Dapp on Windows in a local testnet in 15 minutes!

in #ethereum7 years ago

Here is a simple tutorial to running an Ethereum Decentralized App in 15 minutes! Solidity and Web3 can be daunting programming languages to learn, but let us see how to compile code and use the Truffle framework. In this tutorial we will use Truffle's existing package for testing purposes. It is a simple Dapp that creates a token on the testnet that does nothing, but can be sent between accounts.

Tutorial (7 Steps)

  1. Download Node Package Manager, npm. This will help you install Ethereumjs-testrpc and Truffle: https://nodejs.org/en/
  2. Open a command prompt window and use the following two commands:
    npm install -g ethereumjs-testrpc
    npm install -g truffle
  3. 3. Install the Metamask plugin for Chrome
    https://chrome.google.com/webstore/detail/metamask/
  4. Open 2 separate Windows Powershell windows (Using Command Prompt may result in some javascript errors)
  5. In the first window, run the command:
    testrpc
  6. In the second window, run the commands. These commands might take a while:
    mkdir MyDappFolder
    cd MyDappFolder

    truffle init webpack
    truffle migrate
    npm run dev
  7. Use the Chrome browser and go to the address http://localhost:8080/. Set the Metamask plugin from the Ropsten/Main Net to Localhost 8454. You should see something like this:

Congrats! You have deployed a Dapp to your local testnet! You can now use the Ethereum RPC to send some test Ether to yourself and play around with the MetaCoin tokens. Note that if you want to create a publicly usable Dapp, you will have to work on the Ropsten net, then the Ethereum main net.

(Disclaimer: All credits for the source code of the software goes to Truffle and Ethereum developers. I am simply publishing a tutorial on how to use them)