I have a newbie question about IPFS node creation. The IPFS node can be created as follows:
const IPFS = require(‘ipfs’)
async function main () {
const node = await IPFS.create()
const version = await node.version()
console.log(‘Version:’, version.version)
// …
}
main()
The app should use the same PeerID of the node after initial node creation. That is whenever the app is up and running, a IPFS node with the same PeerID will be launched. Here is what the app should to do (in pseudo code):
const IPFS = require(‘ipfs’)
async function main () {
if (node haven’t been existing) {
const node = await IPFS.create()
else { // node created before
node = LaunchNodeWithExistingPeerID()
}
const version = await node.version() }
console.log(‘Version:’, version.version)
// …
}
main()