install ganache-cli
Ganache can create a personal blockchain for us that we can use it create accounts and do tests easier.+ To install it we use npm like that:
npm install -g ganache-cli
ganache-cli -h 0.0.0.0 -m \"fetch local valve black attend double eye excite planet primary install allow\" -a 100
With this command we use the seed to create 100 accounts with 100 ETH each.
install graph-cli
npm install -g @graphprotocol/graph-cli
If this did not work try this command:
yarn global add @graphprotocol/graph-cli
install truffle
To install Truffle globally, run one the following two commands from a terminal:
NPM
npm install -g truffle
Yarn
yarn global add truffle
install graph protocol
- clone repo https://github.com/graphprotocol/graph-node
- go to docker/docker-compose.yml and replace :
ethereum: "dev:http://host.docker.internal:8545"
with :
ethereum: "mainnet:http://host.docker.internal:8545"
NOTE: every time ganache-cli is restarted, the name of the network (mainnet in this reference) needs to be changed with a new name
NOTE 2: For Linux users, please refer to this: graphprotocol/graph-node#1149
- run
docker-compose up
create subgraph
- open new terminal window
- clone https://github.com/MolochVentures/moloch-monorepo
- go to moloch-monorepo/packages/subgraph
- run
npm install
- run
graph create moloch --node http://127.0.0.1:8020
run truffle tests to populate graph and update contract address
- go to moloch-monorepo/packages/contracts
- run
npm install
- run
truffle test test/single.js
- Copy
moloch.address
from the output of the test. You'll need it in the next step!
run subgraph
- go to moloch-monorepo/packages/subgraph
- run
yarn codegen
- go to moloch-monorepo/packages/subgraph/subgraph.yaml
- update dataSources.source.address with output from running test. You should see something like this
moloch.address 0x9463308d1C9032cC464E395e54E55EDA77495c00
. cut and paste the address,0x9463308d1C9032cC464E395e54E55EDA77495c00
in this example. - run
graph deploy moloch --debug --ipfs http://localhost:5001/ --node http://127.0.0.1:8020
run front-end
- open new terminal window
- go to moloch-monorepo/packages/frontend
- npm install
- npm start