Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 04 20:16
    noctisatrae commented #1257
  • Jul 04 17:40
    draeder updated the wiki
  • Jul 04 17:37
    draeder updated the wiki
  • Jul 03 09:31
    pwFoo closed #1257
  • Jul 03 09:31
    pwFoo commented #1257
  • Jul 01 00:15
    alfonsocuccaro commented #259
  • Jun 30 23:49
    amark commented #259
  • Jun 30 14:34
    alfonsocuccaro commented #259
  • Jun 30 14:15
    draeder commented #259
  • Jun 30 08:41
    alfonsocuccaro commented #259
  • Jun 30 04:58
    amark commented #259
  • Jun 29 00:31
    fysoul17 commented #743
  • Jun 28 19:31
    noctisatrae commented #1258
  • Jun 28 19:31
    noctisatrae commented #1258
  • Jun 28 19:30
    noctisatrae commented #1258
  • Jun 28 19:30
    noctisatrae commented #1258
  • Jun 28 17:05
    bmatusiak commented #1258
  • Jun 28 17:00
    bmatusiak commented #1258
  • Jun 27 21:52
    noctisatrae commented #1258
  • Jun 27 21:06
    noctisatrae commented #1258
lain
@lain:iwakura.xyz
[m]
i found this which seems to be the same thing, doesnt look like a gun issue
Filipe Vieira
@fsvieira
Hi, I am new to gun, and I have a very basic question but its confusing me a lot. I am trying to make the friends example but I don't understand how to get/listen to alice friends. My code looks like this:
const GUN = require('gun/gun');

const gun = GUN({localStorage: false, radisk: false});

const alice = gun.get('alice').put({name: 'alice'});
const bob = gun.get('bob').put({name: 'bob'});

const users = gun.get('users');

users.map().on(user => console.log(user));

users.set(alice)
users.set(bob);

alice.get('friends').map().on(friend => console.log("Alice Friend", friend));

alice.get('friends').set(bob);
But alice.get('friends').map ... doesnt print anything.
Jasper Molgvits
@jaspermolgvits_gitlab

AFAIK you can just do:
gun.get('friends').get('name').put('alice')
gun.get('friends').get('name').put('bob')

Currently you're not putting anything into 'friends'.

Filipe Vieira
@fsvieira
I don't understand, I am making bob alice friend ?
on the last line
Jasper Molgvits
@jaspermolgvits_gitlab
Oh right
You're not making Bob Alice's friend. You're putting the Gun constructor in there
I think 'bob' should be a string
Filipe Vieira
@fsvieira

I copy from docs:

var gun = Gun();
var bob = gun.get('bob').put({name: "Bob"});
var dave = gun.get('dave').put({name: "Dave"});

dave.get('friends').set(bob);
bob.get('friends').set(dave);

But I don't know how to listen/get/use it

Filipe Vieira
@fsvieira
@jaspermolgvits_gitlab on your first example didn't you overwrite friends name = alice, and then overwrite with bob ?
lain
@lain:iwakura.xyz
[m]
so ive trying to understand how gun works but im a bit confused on some stuff. if i create a key value pair in my user graph that only i can update, how is this guaranteed? peers can reject the update if its not me that tried to update the value, but given the value can i prove that i was the only one that updated it?
Manwë
@Manwe-777
@lain:iwakura.xyz yes, because your public key is in the graph key, so you send that + a signature (SEA does this)
lain
@lain:iwakura.xyz
[m]
hmmmmm i think im, starting to get it. i keep thinking of it in terms of an immutable blockchain where you can view the whole history of a value, but if im understanding this right this is mutable in that you can only read the current value, not any past values
Manwë
@Manwe-777
Yeah this is definitely not like a blockchain :D
but the principles of authorization and ownership verification are the same
Filipe Vieira
@fsvieira

Found the problem,

const GUN = require('gun');

const gun = GUN(/*{localStorage: false, radisk: false}*/);

const alice = gun.get('alice').put({name: 'alice'});
const bob = gun.get('bob').put({name: 'bob'});

const users = gun.get('users');

users.map().on(user => console.log(user));

users.set(alice)
users.set(bob);

alice.get('friends').map().on((friend, k) => console.log("Alice Friend", friend, k));

alice.get('friends').set(bob);
alice.get('friends').set(alice);

So apparently I can't disable storage, so is there a way to run gun only in memory ?

Jasper Molgvits
@jaspermolgvits_gitlab
I think you need to run this before running GUN() to disable localstorage:
localStorage.clear();
rococtz
@rococtz:matrix.org
[m]
@fsvieira: Your example about friends it's only good to see how gun saves data, but it's not good for actually storing friends. You saved them using gun.get('users') which means they are in the public space which everyone edit/delete.
1 reply
If you want to store data that nobody can edit/delete, you have to save it in your own user sub-graph
gun.user().get('friends') (as opposed to gun.get('users')
Filipe Vieira
@fsvieira
@rococtz:matrix.org Hi, Thanks for the tip I didn't know that. But right now I am just experimenting with gun, and security or other users are not a concern right now. I am running this on node, and I would like to put this on unit tests of my project so having gun running only in memory it would be nice to have. So is there a way to run this only in memory, I was checking file adapter but it seems not to work with this example, it seems only to work with radisk.
rococtz
@rococtz:matrix.org
[m]
@fsvieira: I don't know how you can you do memory only, you probably have to build your own adapter. Maybe @amark can help you with some advice
tedd pasta
@resession
is app.element.io down for anyone?
rococtz
@rococtz:matrix.org
[m]
@resession: works for me
Connor Davis
@connor-davis
Keep in track of the LoneWolf Development - https://github.com/users/connor-davis/projects/1
petertjmills
@petertjmills
I want to use gun as a local graphdb solution (as there doesn't seem to be many out there) and gun looks great. All I really want it to do is stay in sync with a graphQL server. Presumably I will need to write an adapter, but I have 2 questions if any one if kind enough to answer. Is gun going to be overkill for just using as a local state management system, with all of the decentralization features, or will there be lots of overhead? And if not what is the easiest way to go about writing an adapter for a graphQL backend?
tedd pasta
@azdez:matrix.org
[m]
Is pagination and support for arrays planned for gundb?
Aspirational
@aspirational:matrix.org
[m]
Hey. Can we somehow check if subscription (.on) exists and if true do not subscribe on receiving this data again?
Norman 🔰
@nouman22194_twitter

Hi, I'm new to gun, just tried on local and now can store my first graph node

I'm wondering, will my stored data synchronized to other peers even though I'm not setting the peers at the start like the one mentioned in documentation here ?

Connor Davis
@connor-davis
Not unless you use gun.opt({ peers: ["peer url"] })
But, if you dont provide peers, and you have axe enabled I am pretty sure it will sync
Sam Mosna
@sammosna
I saw @resession fork about unset. I think I'm missing something because it still does not work.. Can you please provide a working example?
Barłomiej Bąk
@dweorh_twitter
hey guys, Does anyone knows how to off .map()?
I have something like gun.get('nodes').map().once(console.log) and I can't find a way to stop that map()
gunchatbridge
@gunchatbridge
[D]Dletta: ping
Mark Nadal
@amark
Everyone: @connor-davis @Dletta @Manuel-777 and I are doing a DHT + AXE call in 40min on meething (I'll paste link when I get back on laptop). I'll catch up with chats later today.
Connor Davis
@connor-davis
Sweet
Mark Nadal
@amark
  • @mmalmi of Iris and who is doing the Rust port
(that was suppose to be a + but it got turned into a bullet)
Mark Nadal
@amark
@Manuel-777 @connor-davis @mmalmi @Dletta link: https://us.meething.space/?room=marknadal&mesh=true
I can't see or hear either of you
Connor Davis
@connor-davis
You cant hear me?
Shoot
Mark Nadal
@amark
try refreshing?
Jachen Duschletta
@Dletta
try without mesh
might be a NAT issue
^^^^ new link,