-
-
Notifications
You must be signed in to change notification settings - Fork 18
Setting up local development environment
This is a quick guide on how to setup a local development environment for working with the parsec codebase.
To begin with, create a directory called something like leapdao somewhere on your file system:
mkdir leapdao
cd leapdao
First we will deploy the required smart contracts in our local truffle network. Start by cloning leap-contracts and building it:
git clone -b migrations https://github.com/leapdao/leap-contracts.git
cd leap-contracts/
yarn
Now run:
truffle develop
You should see something like this:
This starts a local ethereum network on localhost:9545. Also note the mnemonic on the bottom, you can use it to import the generated accounts into metamask. Now in the truffle console run:
migrate --reset
You should see something like this:
The above command will also generate a node_config.json configuration file which we will use later for running the parsec node.
Leave the truffle console running, open a new terminal tab and cd into ParsecLabsRepos. Now run:
git clone https://github.com/leapdao/leap-node.git
cd leap-node/
yarn
Now start the node with:
DEBUG=tendermint,leap-node* node index.js --config=../leap-contracts/node_config.json
Should look something like this:
TODO: add instruction how to set up PoA validator
First install remixd, which will allow remix to access your local files. Then run this in your leap-contracts folder:
remixd -s .
Now go to remix. In the upper left corner you will see a button like this:
Click this to connect remix to your contracts folder. Then in the left-most column, navigate to /localhost/contracts/Bridge.sol. Now remix should compile your contract. Then in the upper right, click run and under environment select Web3 Provider. In the popup enter http://localhost:9545. Now you can load the Bridge at address given by the truffle console when we ran migrations and can call functions on the contract.
For supporting functions, the easiest way to interact with your contract is with the bridge-ui. In the leapdao folder, clone the web-ui repo:
git clone https://github.com/leapdao/bridge-ui.git
cd bridge-ui/
yarn
yarn start
You should now be able to visit the web-ui at http://localhost:1234. Now in metamask, select Custum RPC for the network provider and connect to http://localhost:9545. Then restore accounts from the seed given by the truffle console earlier. You should see some ether on this account.
Then submit the transaction and you should be a validator now. Now go back to the node and restart it, the validator warning should be gone now.
Also, don't forget to send some ether to the node validator address, so it can pay for the gas fees when submitting transactions.
We now have a basic setup, but it would be nice to have some transactions in our blockchain. This is what we will do next.