diff --git a/index.js b/index.js index 2d81115..95b0088 100755 --- a/index.js +++ b/index.js @@ -4,55 +4,10 @@ async function main () { const { createHelia } = await import('helia') - const { createLibp2p } = await import('libp2p') - const { identifyService } = await import('libp2p/identify') - const { noise } = await import('@chainsafe/libp2p-noise') - const { yamux } = await import('@chainsafe/libp2p-yamux') - const { webSockets } = await import('@libp2p/websockets') - const { bootstrap } = await import('@libp2p/bootstrap') const { unixfs } = await import('@helia/unixfs') - const { MemoryBlockstore } = await import('blockstore-core') - const { MemoryDatastore } = await import('datastore-core') - - // the blockstore is where we store the blocks that make up files - const blockstore = new MemoryBlockstore() - - // application-specific data lives in the datastore - const datastore = new MemoryDatastore() - - // libp2p is the networking layer that underpins Helia - const libp2p = await createLibp2p({ - datastore, - transports: [ - webSockets() - ], - connectionEncryption: [ - noise() - ], - streamMuxers: [ - yamux() - ], - peerDiscovery: [ - bootstrap({ - list: [ - '/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN', - '/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa', - '/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb', - '/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt' - ] - }) - ], - services: { - identify: identifyService() - } - }) // create a Helia node - const helia = await createHelia({ - datastore, - blockstore, - libp2p - }) + const helia = await createHelia() // print out our node's PeerId console.log(helia.libp2p.peerId) diff --git a/package.json b/package.json index 438f6b4..79edbb7 100644 --- a/package.json +++ b/package.json @@ -12,15 +12,8 @@ "test": "test-node-example test/*" }, "dependencies": { - "@chainsafe/libp2p-noise": "^12.0.0", - "@chainsafe/libp2p-yamux": "^4.0.1", "@helia/unixfs": "^1.2.1", - "@libp2p/bootstrap": "^8.0.0", - "@libp2p/websockets": "^6.0.1", - "blockstore-core": "^4.1.0", - "datastore-core": "^9.1.1", - "helia": "^1.0.0", - "libp2p": "^0.45.0" + "helia": "^1.0.0" }, "devDependencies": { "test-ipfs-example": "^1.0.0"