Skip to content

Instantly share code, notes, and snippets.

@nenadjaja
Last active November 8, 2018 17:58
Show Gist options
  • Save nenadjaja/09c558b32a389625c47db48f0e060275 to your computer and use it in GitHub Desktop.
Save nenadjaja/09c558b32a389625c47db48f0e060275 to your computer and use it in GitHub Desktop.
Open multiple terminal tabs, and run the following in each one:
1. `$ ganache-cli` (or if you want the new, not released ganache, follow the steps here: )
2. Pull this repo: https://github.com/graphprotocol/hackathon-scaffold and cd into the ethereum folder
3. Run `$ truffle compile` followed by `truffle migrate` --> it should give you the contract address under "Deploying Events"
4. Copy that address, and paste it into `subgraph.yaml` (subgraph manifest) inside of the hackathon-scaffold project
5. Start `ipfs daemon` in a separate terminal tab
6. Run `createdb scaffold` in another tab to create a database
7. Pull graph-node and run:
cargo run -p graph-node --release -- \  13  09:47:43 
--postgres-url postgresql://nevena@localhost:5432/scaffold \
--ethereum-rpc testnet:http://127.0.0.1:8545 \
--ipfs 127.0.0.1:5001 \
--debug
8. Inside of your hackathon-scaffold folder, cd into subgraph and run `yarn codegen` followed by `yarn deploy`
9. Open a separate tab to access Truffle console by running `truffle console --network development`
10. In the truffle console, run the following to get some accounts: `web3.eth.getAccounts().then(ethaccounts => accounts = ethaccounts)`
11. Then run the following: `web3.eth.sendTransaction({ from: accounts[0], to: accounts[1], value: web3.utils.toWei('10', "ether"),gas:50000})`
12. Go back to your graph-node terminal tab, and you should get hte following logs:
WARN Trying again after block polling failed: could not get latest block from Ethereum: Decoder error: Error("invalid type: null, expected a 0x-prefixed hex-encoded vector of bytes", line: 0, column: 0)
Nov 08 09:57:27.216 WARN Trying again after block polling failed: could not get latest block from Ethereum: Decoder error: Error("invalid type: null, expected a 0x-prefixed hex-encoded vector of bytes", line: 0, column: 0)
13. Run `curl -s http://127.0.0.1:8545 -d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":["0x7",true]}'`
and you should get:
{"id":1,"jsonrpc":"2.0","result":{"number":"0x7","hash":"0x45788b1fba273198a2ea776fa4f2a8f0bafd0b23a789da53aea6ad3090264528","parentHash":"0x3e7a7ad9f8121406f0bc7f629076e302eab63a210c4a4e6e161f8caaa2fcd493","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","stateRoot":"0x9f84b9fc0e04e9e31216ef81ed75f786155973aa874699dd1136e68446bcc6b2","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","miner":"0x0000000000000000000000000000000000000000","difficulty":"0x0","totalDifficulty":"0x0","extraData":"0x","size":"0x3e8","gasLimit":"0x6691b7","gasUsed":"0x6980","timestamp":"0x5be47744","transactions":[{"hash":"0x088337480bc3b97fcbcc70eb93bd90f7ac81528cda588a6df908d1f671961bb8","nonce":"0x6","blockHash":"0x45788b1fba273198a2ea776fa4f2a8f0bafd0b23a789da53aea6ad3090264528","blockNumber":"0x7","transactionIndex":"0x0","from":"0x32399e95414860ba7ae3e55b663e345ecf06d3ee","to":"0x5799bd515389384144d0ab11d121adac9facd43b","value":"0x0","gas":"0x6691b7","gasPrice":"0x4a817c800","input":"0xfdacd5760000000000000000000000000000000000000000000000000000000000000002"}],"uncles":[]}}%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment