Skip to content

Instantly share code, notes, and snippets.

@hsinhoyeh
Last active August 15, 2017 06:38
Show Gist options
  • Save hsinhoyeh/a6065d0c6620ed420600cfbb095323ac to your computer and use it in GitHub Desktop.
Save hsinhoyeh/a6065d0c6620ed420600cfbb095323ac to your computer and use it in GitHub Desktop.
setup ethereum private network and delopy tokenmarket contracts

setup ethereum private network and delopy tokenmarket contracts

// my configuration
networkName=mynet
datadir=~/Library/Ethereum/mynet
ipcpath=~/Library/Ethereum/mynet/geth.ipc

1.create account address with password

geth --datadir=$datadir account new
>> 2b317defb1d07e737ef9dacd88bf1daeb5a54da3

2.prepare genesis.json and also allocate ether token to my created account

you can modify this genesis.json with the following principal as your dev network:

  • lower difficulty
  • raise up gasLimit
{
  "nonce": "0x0000000000000042",
  "difficulty": "0x4000",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x0000000000000000000000000000000000000000",
  "timestamp": "0x00",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "gasLimit": "0x12ffffffffff",
  "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
  "config": {
    "chainId": 987654321,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
  },
  "alloc": {
    "2b317defb1d07e737ef9dacd88bf1daeb5a54da3": {
      "balance": "1337000000000000000000"
    }
  }
}

3.init chaindata with genesis.json

geth --datadir $datadir init genesis.json

4.start a miner to start process future transactions. By lower gasprice, so our tx won't hit the gasLimit easily.

geth  -rpc --rpcapi "admin,eth,miner,net,personal,web3" --datadir $datadir --mine --gasprice 1000

5.use console mode to unlock my account. so we are good to go to transfer token and deploy contracts

geth attach $ipcpath console

Welcome to the Geth JavaScript console!

instance: Geth/v1.7.0-unstable/darwin-amd64/go1.8.1
coinbase: 0x2b317defb1d07e737ef9dacd88bf1daeb5a54da3
at block: 276 (Wed, 09 Aug 2017 19:39:38 CST)
 datadir: $datadir
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> personal.unlockAccount('0x2b317defb1d07e737ef9dacd88bf1daeb5a54da3', 'aaaaaaaa', 0)

6.deploy tokenmarket contracts

6. deploy tokenmarket contracts
python3.5 ./ico/cmd/deploycontracts.py --deployment-file=crowdsales/example.yml --deployment-name=testnet --address=0x2b317defb1d07e737ef9dacd88bf1daeb5a54da3

  1. participate cio
python3.5 ico/cmd/participate-crowdsale.py
  1. check investment history
python3.5 ./ico/cmd/investors.py --chain mynet --address 0x74d9b32727d962855b191015626268473729cf91 --csv-file investor.csv
  1. finalize ico
python3.5 ico/cmd/finalized-ico.py
  1. refund
python3.5 ./ico/cmd/refund.py --chain mynet --hot-wallet-address 0x2b317defb1d07e737ef9dacd88bf1daeb5a54da3 --csv-file refund.csv --address-column Address --amount-column 'InvestedETH' --id-column  Address 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment