https://www.menlo.one/#/townhall
To develop and run the town hall locally, install the following prerequisites and dependencies before running the app.
We assume brew
for package management to install IPFS
and other dependencies:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
TownHall uses IPFS for storage of messages.
Menlo specific setup of IPFS can be installed and configured via:
yarn run menlo:setup
Metamask or Mist should be used for interacting with the town hall dapp.
Install Metamask extensions into your browser of choice, Chrome or Brave supported: http://metamask.io
Import this private key into MetaMask for use with truffle develop
and Ganache
:
388c684f0ba1ef5017716adb5d21a053ea8e90277d0868337519f97bede61418
- Install nvm and node:
brew install nvm && nvm install
- Clone the repo:
git clone git@github.com:MenloOne/townhall.git
- Install dependencies:
cd townhall && nvm use && yarn install
- Run a local dev blockchain in a separate window:
yarn run truffle develop
- Run IPFS daemon in a separate window:
ipfs daemon
- Now, deploy the contracts:
yarn run truffle deploy
- Run the app:
yarn start
A browser window should open after starting: http://localhost:3000/
Ensure you are logged into MetaMask and switch to your imported account.
Set the network in MetaMask to http://127.0.0.1:9545/
, add a Custom RPC if that network doesn't already exist:
For a light, easy to use private chain with a visual and cli interface, try Ganache.
You can deploy and test using network ganache:
yarn run truffle deploy --network ganache
Note: Ganache and truffle develop are transitory. Once you shut them down, you will have to redeploy the contracts and redo any needed transactions.
For a persistent local testing environment to test before deploying to testnet or mainnet, use a Dev chain with Parity or Geth.
You can set the following environment variables in your local .env
file to
run against a local dev chain if you already have Parity or Geth configured or set
with needed accounts:
- MENLO_TENET_1: Address for first tenet account.
- MENLO_TENET_2: Address for second tenet account.
- MENLO_TENET_3: Address for third tenet account.
- MENLO_POSTER: Address for the account used to interact with town hall.
To run a private dev chain with Parity, first run a dev chain, setup Menlo accounts, and then deploy contracts.
Installing Parity:
brew install parity
Assuming a default Parity setup, the initial dev account address is static:
0x00a329c0648769A73afAc7F9381E08FB43dBEA72
You need to unlock your dev account to be able to run Truffle migrations easily. The following script runs parity with an unlocked dev account, it will need to be modified if you've changed the default dev account:
./scripts/parity-unlocked-dev.sh
Create the needed Menlo accounts:
yarn run truffle menlo:create-integration-accounts
After running the account creation, a set of accounts will be displayed to
add to your .env
file.
Add MENLO_TENET_1
, MENLO_TENET_2
, MENLO_TENET_3
, and MENLO_POSTER
to you .env
.
Once you add the environment variables to your account, rerun parity with the helper script:
yarn run menlo:parity-dev-chain
Now deploy the contracts, use the integration
network defined in truffle.js
when using parity.
yarn run truffle deploy --network integration
Your contracts will live between parity dev runs, you can check the contracts addresses to watch with truffle network
.
Browse http://localhost:8180 to interact with the Parity wallet.
Parity has a lot of config and features: Read the effin manual
yarn run menlo:parity-dev-chain
For testing the TownHall dapp:
yarn test
For testing the town hall contracts:
dapp update
dapp test
Set the following environment variables:
1. MENLO_DEPLOYMENT_KEY:
2. MENLO_DEPLOYMENT_SERVER:
Deploy to server using shipit
:
yarn run menlo:deploy
MetaMask can be used with a Rinkeby account to test against.
The Mist browser can be used to test the Rinkeby testnet.
Mist uses Geth underneath:
brew install geth
Run Geth against Rinkeby with the Apis needed by Truffle:
geth --rinkeby --rpc --rpcapi db,eth,net,web3,personal --rpccorsdomain http://localhost:3000
Now, run Mist against your local instance of Geth:
/Applications/Mist.app/Contents/MacOS/Mist --rpc http://127.0.0.1:8545
Wait for the blocks to sync , (go for a walk and enjoy the sunshine).
After the blocks sycn, note your account hash in the Mist Wallet, you'll need it later.
Close Mist, Stop Geth.
Now, run Geth with the account you noted above unlocked:
geth --rinkeby --rpc --rpcapi db,eth,net,web3,personal --unlock="0x4B71d4020a69902E6cB1d9a387a03cF0a839d33b" --rpccorsdomain http://localhost:3000
Run Mist again:
/Applications/Mist.app/Contents/MacOS/Mist --rpc http://127.0.0.1:8545
Now you are ready to deploy contracts and test:
yarn run truffle deploy --network rinkeby
Go to the faucet to get some free Ether: Rinkeby Faucet
Give your Mist account some TK/MET tokens:
yarn run truffle console --network rinkeby
Run the Town Hall and browse in Mist to http://localhost:3000.
TBD
parity --chain kovan
...
This repo uses create-react-app environment variables.