diff --git a/docs/ACCESS_CONTROLLERS.md b/docs/ACCESS_CONTROLLERS.md index ba822d4..484da8d 100644 --- a/docs/ACCESS_CONTROLLERS.md +++ b/docs/ACCESS_CONTROLLERS.md @@ -10,11 +10,13 @@ Different access controllers can be assigned to the database using the `AccessCo import { createLibp2p } from 'libp2p' import { createHelia } from 'helia' import { createOrbitDB } from '@orbitdb/core' -import * as SomeAccessController from 'some-access-controller.js' +import { LevelBlockstore } from 'blockstore-level' import { Libp2pOptions } from './config/libp2p.js' +import * as SomeAccessController from 'some-access-controller.js' +const blockstore = new LevelBlockstore('./ipfs') const libp2p = await createLibp2p(Libp2pOptions) -const ipfs = await createHelia({ libp2p }) +const ipfs = await createHelia({ libp2p, blockstore }) const orbitdb = await createOrbitDB({ ipfs }) @@ -39,11 +41,13 @@ To change write access, pass the IPFSAccessController with the `write` parameter ```js import { createLibp2p } from 'libp2p' import { createHelia } from 'helia' +import { LevelBlockstore } from 'blockstore-level' import { createOrbitDB, Identities, IPFSAccessController } from '@orbitdb/core' import { Libp2pOptions } from './config/libp2p.js' +const blockstore = new LevelBlockstore('./ipfs') const libp2p = await createLibp2p(Libp2pOptions) -const ipfs = await createHelia({ libp2p }) +const ipfs = await createHelia({ libp2p, blockstore }) const identities = await Identities() const anotherIdentity = identities.createIdentity('userB') @@ -60,9 +64,11 @@ To allow anyone to write to the database, specify the wildcard '*': ```js import { createLibp2p } from 'libp2p' import { createHelia } from 'helia' +import { LevelBlockstore } from 'blockstore-level' import { createOrbitDB, Identities, IPFSAccessController } from '@orbitdb/core' import { Libp2pOptions } from './config/libp2p.js' +const blockstore = new LevelBlockstore('./ipfs') const libp2p = await createLibp2p(Libp2pOptions) const ipfs = await createHelia({ libp2p }) @@ -80,9 +86,11 @@ The OrbitDB access controller provides configurable write access using grant and ```js import { createLibp2p } from 'libp2p' import { createHelia } from 'helia' +import { LevelBlockstore } from 'blockstore-level' import { createOrbitDB, Identities, OrbitDBAccessController } from '@orbitdb/core' import { Libp2pOptions } from './config/libp2p.js' +const blockstore = new LevelBlockstore('./ipfs') const libp2p = await createLibp2p(Libp2pOptions) const ipfs = await createHelia({ libp2p }) @@ -184,11 +192,13 @@ Before passing the custom access controller to the `open` function, it must be a ```js import { createLibp2p } from 'libp2p' import { createHelia } from 'helia' +import { LevelBlockstore } from 'blockstore-level' import { createOrbitDB, useAccessController } from '@orbitdb/core' import { Libp2pOptions } from './config/libp2p.js' +const blockstore = new LevelBlockstore('./ipfs') const libp2p = await createLibp2p(Libp2pOptions) -const ipfs = await createHelia({ libp2p }) +const ipfs = await createHelia({ libp2p, blockstore }) useAccessController(CustomAccessController) const orbitdb = await createOrbitDB({ ipfs }) diff --git a/docs/GETTING_STARTED.md b/docs/GETTING_STARTED.md index 55de905..47a72d7 100644 --- a/docs/GETTING_STARTED.md +++ b/docs/GETTING_STARTED.md @@ -116,9 +116,8 @@ import { createOrbitDB } from '@orbitdb/core' import { LevelBlockstore } from 'blockstore-level' import { Libp2pOptions } from './config/libp2p.js' -const blockstore = new LevelBlockstore('./ipfs') - // Create an IPFS instance. +const blockstore = new LevelBlockstore('./ipfs') const libp2p = await createLibp2p(Libp2pOptions) const ipfs = await createHelia({ libp2p, blockstore }) diff --git a/docs/IDENTITIES.md b/docs/IDENTITIES.md index bba7b2d..95109af 100644 --- a/docs/IDENTITIES.md +++ b/docs/IDENTITIES.md @@ -90,6 +90,7 @@ The identity object is stored like any other [IPLD data structure](https://ipld. ```js import { createLibp2p } from 'libp2p' import { createHelia } from 'helia' +import { LevelBlockstore } from 'blockstore-level' import * as Block from 'multiformats/block' import { Identities } from '@orbitdb/core' import * as dagCbor from '@ipld/dag-cbor' @@ -98,8 +99,9 @@ import { base58btc } from 'multiformats/bases/base58' import { CID } from 'multiformats/cid' import { Libp2pOptions } from './config/libp2p.js' +const blockstore = new LevelBlockstore('./ipfs') const libp2p = await createLibp2p(Libp2pOptions) -const ipfs = await createHelia({ libp2p }) +const ipfs = await createHelia({ libp2p, blockstore }) const identities = await Identities({ ipfs }) const identity = await identities.createIdentity({ id: 'me' }) diff --git a/docs/REPLICATION.md b/docs/REPLICATION.md index 394d39e..1074fe7 100644 --- a/docs/REPLICATION.md +++ b/docs/REPLICATION.md @@ -5,14 +5,16 @@ Below is a simple replication example. Both peers run within the same Nodejs pro ```js import { createLibp2p } from 'libp2p' import { createHelia } from 'helia' +import { LevelBlockstore } from 'blockstore-level' import { createOrbitDB } from '@orbitdb/core' import { Libp2pOptions } from './config/libp2p.js' -// Our ipfs instances will be connecting over websockets. However, you could achieve the same here using tcp. You can find out more about peer connectivity at https://connectivity.libp2p.io/. +// Our ipfs instances will be connecting over tcp. You can find out more about peer connectivity at https://connectivity.libp2p.io/. const initIPFSInstance = () => { + const blockstore = new LevelBlockstore('./ipfs') const libp2p = await createLibp2p(Libp2pOptions) - return createHelia({ libp2p }) + return createHelia({ libp2p, blockstore }) } const ipfs1 = await initIPFSInstance()