我正在尝试使用轨道数据库和IPFS,我正在浏览OrbitDB的正式文档。ATM,我只是想创建一个db(特别是键值存储),现在我有了下面的代码
const IPFS = require('ipfs')
const OrbitDB = require('orbit-db')
createDb = async() => {
try {
const ipfsOptions = {
config: {
my-config-options
},
EXPERIMENTAL: {
pubsub: true
}
}
const ipfs = await IPFS.create(ipfsOptions)
const orbitdb = await OrbitDB.createInstance(ipfs)
const db = await orbitdb.create('test', 'keyvalue', {
overwrite: false,
replicate: true,
accessController: {
admin: ['*'],
write: ['*']
}
})
console.log(db)
await db.put('hello', { name: 'world' })
console.log(db.all)
} catch (error) {
console.trace(error)
}
}但不管我做什么,我都会犯同样的错误
Trace: Error: Could not append entry, key "..." is not allowed to write to the log
所以任何帮助都是非常感谢的。另外,如果缺少任何信息,请注意,我会根据要求添加它。
发布于 2020-06-24 08:17:00
我认为你的accessController有一个小问题。admin属性的存在表明您希望像这样使用orbitdb类型:
accessController: {
type: 'orbitdb',
admin: ['*'],
write: ['*']
}否则,如果希望使用默认的ipfs类型,请删除管理属性,如下所示:
accessController: {
type: 'ipfs',
write: ['*']
}https://stackoverflow.com/questions/62539349
复制相似问题