ConsenSys/panda-tokens

Name: panda-tokens

Owner: ConsenSys

Description: A demo of smart contracts with metamask

Forked from: krisrandall/panda-tokens

Created: 2018-02-21 08:58:52.0

Updated: 2018-02-21 08:58:54.0

Pushed: 2017-10-24 05:32:05.0

Homepage: null

Size: 2778

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Panda Tokens

A DAPP to demonstrate the simplicity of smart contracts and Metamask.


PLEASE NOTE THIS IS JUST A PROOF OF CONCEPT AND IS NOT PRODUCTION-READY CODE

It has the following functionality :

“Live” (Ropsten testnet) Instance
Panda Token demo URL : http://krisrandall.github.io/panda-tokens/

You can easily create a new account using Metamask (just remember to change to “Ropsten” first after installing it).

You will need some test Ether in order to donate, your can mine for it using Mist on testnet (see “Getting some test ether” below).

Development
Doing a “Ropsten” local dev deploy

First start geth connected to the “Ropsten” testnet :

 --fast --cache=1048 --testnet --rpc --rpcapi "eth,net,web3" --rpccorsdomain '*' --rpcaddr localhost --rpcport 8545 --unlock 0x4Fcb8b0a22461BB32A7B95Cd7D0dB64fd2767433

where the address at the end is one you have created (see 'Getting some Ropsten test ether' below)

Then :

uffle compile
uffle migrate --network ropsten
m run dev
Getting some “Ropsten” test ether
  1. download Mist
  2. run Mist > Develop > Network > Testnet
    .. it takes a little while to download, ~ 1 hour
  3. create a new wallet in Mist
  4. Develop > Start mining
    .. after this runs for a while (a few hours) you have some test Ether, this can then be transferred to your Metamask account from within Mist
Running locally with a local eth node

See these instructions for creating a local node.

Start up your node with something like :

th --datadir /projects/local_ethereum_blockchain/node1 --networkid 61 console --rpc --rpcport 8545 

Then : Create 3 addresses (personal.newAccount('password') x 3) and copy them into the recepients file (recepient_descriptions) in app/javascripts/config.js

Also : Do personal.unlockAccount( eth.accounts[0], 'password' ) so the account is unlocked for the next steps, and also start mining miner.start(1)

Manually deploy the contrats doing the following :
  1. Go to remix : https://remix.ethereum.org/

  2. Open the PandaToken.sol and PandaProject.sol files

  3. Start with the PandaToken, click “Compile” then “Details”, select the “WEB3DEPLOY” code and paste it into your geth terminal (started above)

  4. Note the contract address (copy it) - paste it into app/javascripts/config.js as contract_locations.panda_token (but also keep it copied for the next step)

  5. Now in remix open the PandaProject, click “Compile”, then “Details”, select the “WEB3DEPLOY” code, but before pasting it in to the geth terminal set the following :

  6. projectName = “whatever you like”

  7. recipientAddresses = [ array of 3 “addresses” from testrpc terminal ]

  8. recipientShares = [ 50, 30, 20 ]

  9. pandaTokenContractAddr = “address copied in step 4 above”

  10. After you paste this into geth grab the returned address and paste it into config.js as the panda_project contract location

Finally, run the dApp locally
m run dev

http://localhost:8080/

and change Metamask to “Localhost 8545”

Note that to donate you will need some ether in your Metamask account - you can transfer to it by copying that address from Metamask and sending the ether from the geth terminal : eth.sendTransaction({from: eth.accounts[0], to: "<Metamask account>", value: web3.toWei(1, "ether")})

Trouble shooting
Starting points for building DAAPs

This project was started by doing a
$ truffle init webpack
and then adjusting the sample app created.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.