You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.0 KiB

  1. // needed for instantiation of ipfs
  2. const initIPFS = async (IPFS, ORBITDB) => {
  3. // Create IPFS instance
  4. // const ipfsOptions = { repo: '/orbitdb/examples/browser/new/ipfs/0.33.1', }
  5. //const ipfs = await Ipfs.create(ipfsOptions)
  6. // Create OrbitDB instance
  7. //const orbitdb = await OrbitDB.createInstance(ipfs)
  8. }
  9. initIPFS()
  10. async function createDb(){
  11. // Create database instance
  12. // Create IPFS instance
  13. const ipfsOptions = { repo: '/orbitdb/examples/browser/new/ipfs/0.33.1', }
  14. const ipfs = await Ipfs.create(ipfsOptions)
  15. const orbitdb = await OrbitDB.createInstance(ipfs)
  16. const db = await orbitdb.keyvalue('route1')
  17. const address = db.address
  18. console.log(address)
  19. console.log(db.address.toString())
  20. await db.put('2022-07-01T10:49:07', '49.41185089/8.67646861')
  21. await db.put('2022-07-01T10:49:12', '49.41166303/8.67652893')
  22. const value = db.all
  23. console.log(value)
  24. }
  25. createDb()