2022-07-18 15:18:07 +02:00
|
|
|
// needed for instantiation of ipfs
|
|
|
|
const initIPFS = async (IPFS, ORBITDB) => {
|
2022-07-13 13:16:24 +02:00
|
|
|
|
|
|
|
// Create IPFS instance
|
2022-07-18 15:18:07 +02:00
|
|
|
// const ipfsOptions = { repo: '/orbitdb/examples/browser/new/ipfs/0.33.1', }
|
|
|
|
//const ipfs = await Ipfs.create(ipfsOptions)
|
2022-07-13 13:16:24 +02:00
|
|
|
|
|
|
|
// Create OrbitDB instance
|
|
|
|
//const orbitdb = await OrbitDB.createInstance(ipfs)
|
2022-07-18 15:18:07 +02:00
|
|
|
|
2022-07-13 13:16:24 +02:00
|
|
|
}
|
2022-07-18 15:18:07 +02:00
|
|
|
initIPFS()
|
|
|
|
|
|
|
|
async function createDb(){
|
|
|
|
// Create database instance
|
2022-07-13 13:16:24 +02:00
|
|
|
|
2022-07-18 15:18:07 +02:00
|
|
|
// Create IPFS instance
|
|
|
|
const ipfsOptions = { repo: '/orbitdb/examples/browser/new/ipfs/0.33.1', }
|
|
|
|
const ipfs = await Ipfs.create(ipfsOptions)
|
|
|
|
const orbitdb = await OrbitDB.createInstance(ipfs)
|
|
|
|
const db = await orbitdb.keyvalue('route1')
|
|
|
|
const address = db.address
|
|
|
|
console.log(address)
|
|
|
|
console.log(db.address.toString())
|
|
|
|
await db.put('2022-07-01T10:49:07', '49.41185089/8.67646861')
|
|
|
|
await db.put('2022-07-01T10:49:12', '49.41166303/8.67652893')
|
|
|
|
const value = db.all
|
|
|
|
console.log(value)
|
|
|
|
}
|
|
|
|
createDb()
|
2022-07-13 13:16:24 +02:00
|
|
|
|