Add IPFS pinning script #136

Merged
bumi merged 4 commits from feature/ipfs-pinner into master 2019-07-01 11:06:46 +00:00
bumi commented 2019-06-11 19:50:05 +00:00 (Migrated from github.com)

This script loads the IPFS hashes for contributors and contributions and pins them on the connected IPFS node.

First it loads the latest data and pins those and then it subscribes to relevant contract events and pins new hashes.

usage:

$ node script/ipfs-pinner.js

$ ETH_RPC_URL=http://localhost:7545 APM_DOMAIN=aragonpm.eth node scripts/ipfs-pinner.js
This script loads the IPFS hashes for contributors and contributions and pins them on the connected IPFS node. First it loads the latest data and pins those and then it subscribes to relevant contract events and pins new hashes. usage: $ node script/ipfs-pinner.js $ ETH_RPC_URL=http://localhost:7545 APM_DOMAIN=aragonpm.eth node scripts/ipfs-pinner.js
raucao commented 2019-06-13 16:16:42 +00:00 (Migrated from github.com)

I'm getting an unhandled promise rejection error when running this script against a local devchain with fresh seeds:

(feature/ipfs-pinner) ~/src/kosmos/kredits/kredits-contracts $ ETH_RPC_URL=http://localhost:7547 APM_DOMAIN=aragonpm.eth node scripts/ipfs-pinner.js 
Using IPFS: { host: 'localhost', port: '5001', protocol: 'http' }
(node:25517) UnhandledPromiseRejectionWarning: Error: invalid response - 0
    at exports.XMLHttpRequest.request.onreadystatechange (/home/basti/src/kosmos/kredits/kredits-contracts/node_modules/ethers/utils/web.js:84:29)
    at exports.XMLHttpRequest.dispatchEvent (/home/basti/src/kosmos/kredits/kredits-contracts/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
    at setState (/home/basti/src/kosmos/kredits/kredits-contracts/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
    at exports.XMLHttpRequest.handleError (/home/basti/src/kosmos/kredits/kredits-contracts/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:532:5)
    at ClientRequest.errorHandler (/home/basti/src/kosmos/kredits/kredits-contracts/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:459:14)
    at ClientRequest.emit (events.js:182:13)
    at Socket.socketErrorListener (_http_client.js:392:9)
    at Socket.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
I'm getting an unhandled promise rejection error when running this script against a local devchain with fresh seeds: ``` (feature/ipfs-pinner) ~/src/kosmos/kredits/kredits-contracts $ ETH_RPC_URL=http://localhost:7547 APM_DOMAIN=aragonpm.eth node scripts/ipfs-pinner.js Using IPFS: { host: 'localhost', port: '5001', protocol: 'http' } (node:25517) UnhandledPromiseRejectionWarning: Error: invalid response - 0 at exports.XMLHttpRequest.request.onreadystatechange (/home/basti/src/kosmos/kredits/kredits-contracts/node_modules/ethers/utils/web.js:84:29) at exports.XMLHttpRequest.dispatchEvent (/home/basti/src/kosmos/kredits/kredits-contracts/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25) at setState (/home/basti/src/kosmos/kredits/kredits-contracts/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14) at exports.XMLHttpRequest.handleError (/home/basti/src/kosmos/kredits/kredits-contracts/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:532:5) at ClientRequest.errorHandler (/home/basti/src/kosmos/kredits/kredits-contracts/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:459:14) at ClientRequest.emit (events.js:182:13) at Socket.socketErrorListener (_http_client.js:392:9) at Socket.emit (events.js:182:13) at emitErrorNT (internal/streams/destroy.js:82:8) at emitErrorAndCloseNT (internal/streams/destroy.js:50:3) ```
raucao commented 2019-06-13 16:18:54 +00:00 (Migrated from github.com)

Adding some error handling...

Adding some error handling...
raucao commented 2019-06-13 16:31:31 +00:00 (Migrated from github.com)

I think the example script was just using a wrong port. However it doesn't say how to define the contract address and I don't see it in the code. With the correct port (and ipfs-pinner filename), as well as error handling, I now get:

Error: Address or ABI not found for Kernel
I think the example script was just using a wrong port. However it doesn't say how to define the contract address and I don't see it in the code. With the correct port (and ipfs-pinner filename), as well as error handling, I now get: ``` Error: Address or ABI not found for Kernel ```
bumi commented 2019-06-15 13:44:55 +00:00 (Migrated from github.com)

I can not reproduce that error. Also tried it with the local network.
does your lib/addresses/dao.json include the correct address for the current network? Do you have the correct APM domain set?

I can not reproduce that error. Also tried it with the local network. does your `lib/addresses/dao.json` include the correct address for the current network? Do you have the correct APM domain set?
raucao commented 2019-06-16 06:07:35 +00:00 (Migrated from github.com)

does your lib/addresses/dao.json include the correct address for the current network?

Yes.

Do you have the correct APM domain set?

I don't know. I used it from your example, and you can see it in the copied command that I posted. But I was pretty sure that this is the one for development.

> does your `lib/addresses/dao.json` include the correct address for the current network? Yes. > Do you have the correct APM domain set? I don't know. I used it from your example, and you can see it in the copied command that I posted. But I was pretty sure that this is the one for development.
bumi commented 2019-06-17 07:32:04 +00:00 (Migrated from github.com)

it looks like an error indicating a local miss-configuration. I can not reproduce it.
maybe you can try again, and also try rinkeby?

it looks like an error indicating a local miss-configuration. I can not reproduce it. maybe you can try again, and also try rinkeby?
bumi commented 2019-06-18 06:52:19 +00:00 (Migrated from github.com)

I tried to make an npx script out of this, but it seems it only supports commands that are equal to the package name.

I tried to make an `npx` script out of this, but it seems it only supports commands that are equal to the package name.
raucao commented 2019-07-01 11:05:17 +00:00 (Migrated from github.com)

Hooray, tested successfully on my machine now! 🎉

Hooray, tested successfully on my machine now! :tada:
Sign in to join this conversation.
No description provided.