Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 16:48
    u007 commented #1173
  • 16:47
    u007 commented #1173
  • 16:47
    u007 closed #1173
  • 16:44
    u007 commented #1173
  • 16:29
    u007 opened #1173
  • 12:39
    fsvieira opened #1172
  • Dec 01 23:00
    amark commented #1167
  • Dec 01 21:21
    Oxey405 opened #1171
  • Nov 30 15:07
    Emad-salah opened #1170
  • Nov 29 22:49
    fsvieira edited #1168
  • Nov 29 22:47
    fsvieira commented #1168
  • Nov 29 13:47
    capitalistdog commented #1156
  • Nov 29 06:11
    amark commented #1164
  • Nov 29 04:12
    amark updated the wiki
  • Nov 29 04:05

    amark on master

    ReactNative/Expo fix for SEA (#… (compare)

  • Nov 29 04:05
    amark closed #1169
  • Nov 29 04:05
    amark commented #1169
  • Nov 29 03:33
    amark commented #1156
  • Nov 28 22:33
    aethiop opened #1169
  • Nov 28 22:05
    i001962 commented #1168
pszabop
@pszabop
So the user is not offline first API?
Jachen Duschletta
@Dletta
[D]Dletta: It’s recommended to be online for creation and after that it can be offline, however upon login on a new device, it’s recommended to be online as well
pszabop
@pszabop
Interesting. Ethereum allows offline-first user creation (because a user is just a 256 random value and collisions are impossibly rare). If the primary key is the public key and not the alias that would be possible.
Jachen Duschletta
@Dletta
[D]jussir: <@178314946201780224> the voting system is veery simple. The app is used with live audiences so i doubt anyone has any interest in hacking it. So no authentication of any kind, just create a random user id (stored in localStorage) and set your vote with it: gun.get(namespace).get(userId).put(voteId). Before a new vote reset all votes to null's.
Jachen Duschletta
@Dletta
[D]xenister: hi what's the maximum storage capacity of gun ?
Jachen Duschletta
@Dletta
[D]danlugo92: Hello guys, are there any events that I can subscribe to, for listening on auth status? something like user.on('auth'), cannot find anything on it on docs.
[D]danlugo92: might help to make my app more declarative
[D]Dletta: I think auth is an event, but it would be via Gun.on(‘auth’)
[D]Dletta: <@178314946201780224> ^
[D]Dletta: Also <@178314946201780224> Gun just arrived at 11’000 stars on Github 👏
[D]Dyno: Welcome <@547550778257309697>!!! GUN (https://github.com/amark/gun) is a P2P protocol for syncing data used by 8M+ people monthly across Internet Archive, HackerNoon, DTube (decentralized youtube), Notabug (p2p reddit), & more. Please try the 5min tutorial (https://gun.eco/docs/Todo-Dapp) to get started!
[D]Yakulu:
Jachen Duschletta
@Dletta
[D]danlugo92: <@!612728945313316904> gun.on('auth') didn't work.
gun = Gun()
Gun {_: {…}}
user = gun.user() 
User {_: {…}}
gun.on('auth', console.log)
Gun {_: {…}}
user.auth('numericx', '12345678')
User {_: {…}}
gun.js:198 {gun: Gun, $: Gun, root: {…}, id: 4, back: {…}, …}
user.is.pub
"yYhLaCfPklnRCAsiLYmrkqC2vPIolENLDn2ZwsTwKWk.tQ-9Z39vktnFthfYV7D07Zzy4Z_Zb37ctXr9pTEkzw0"
[D]Dletta: gun._.on(‘auth’ is how you would register the hook, but I wasn’t 100% sure. Mark will let you know once he comes online if there is an event

[D]danlugo92: actually it did work. Sorry :/.

Line gun.js:198 {gun: Gun, $: Gun, root: {…}, id: 4, back: {…}, …}

[D]danlugo92: that's the console log.
[D]danlugo92: need another cup of coffee
[D]Dletta: Lol
[D]danlugo92: gun.on('leave') doesn't though. maybe it's another constant?
Jachen Duschletta
@Dletta
[D]Dletta: No clue on that one, could just be a naming thing, not sure where the names are kept (‘onto’ is the event system’
Jachen Duschletta
@Dletta
[D]jabis: leave doesn't emit afair
[D]jabis: and its code commented that Gun.on(auth should be moved to user to emit instead of root
Jachen Duschletta
@Dletta
[D]danlugo92: yeah I figured it should be user.on('auth')
Stefdv
@Stefdv
@KINKCreative Hey, i really would like to help you out with gun-tag. Can you provide me with a basic example of what you are doing ( or how you use gun-tag) ? I use gun-tag all the time and to me the documentation looks solid, but then again...maybe i'm overlooking something that isn't well documented at all :(
Jachen Duschletta
@Dletta
[D]RobChristian: <@!103660564651212800> probably hasn't been tested, but in theory, it's whatever maximum your backend supports. Gun is really just a frontend for a database engine like LMDB.
Jachen Duschletta
@Dletta
[D]danlugo92: how would I go about implementing a isPubKey(anyString) => boolean ?
pszabop
@pszabop
What is the correct syntax for specifying peers in the gun constructor? I cannot use options if I specify an array of strings, and I can't seem to get the peer if I use options.peers where that looks like { 'http://localhost:8080/gun': {} }
Stefdv
@Stefdv
@KINKCreative i posted a quick - working - example on github Stefdv/gun-tag#3
Stefdv
@Stefdv
@amark do you still use PANIC for testing ? If so, is there any documentation for it ?
Jachen Duschletta
@Dletta
[D]danlugo92: on('auth') only supports a single listener 🤦‍♂️
Jachen Duschletta
@Dletta
[D]jabis: @pszabop, the constructor will obj_map over the peers in Gun.chain.opt, try to pass them in opt.peers as ["srv1/gun","srv2/gun"]
Jabis Sevon
@jabis
image.png
pszabop
@pszabop
@Dletta okay, tried that, it worked. The documentation says options.peers is an object, where the URLs are properties, and the value is an empty object.
thanks!
Jabis Sevon
@jabis
@pszabop was actually me answering from discord ^^ and yes I think that method should check if the opt.peers is an object or an array there, might constitute an issue into github :)
in object format way it's iterated there, the signature then should be {""+url:{url:url}} not just empty object
now to sleep bbl ->
pszabop
@pszabop
ok will file issue. An array is fine
pszabop
@pszabop
Is it possible to change a user alias after creation? I have an idea on how to create the user pubkey identity first (i.e. offline first), and add an alias later when negotiating with a server, since an alias is a global namespace the alias has to be negotiated to eliminate collisions, check for sybil attacks, alias theft, etc
pszabop
@pszabop
@amark @jabis @Dletta thanks for all your help, I have promise-based tests using Tape and nodejs that can test multiple databases in one process. I can now start attacking my business logic. I basically made a thin wrapper around your API to encapsulate some idiosyncracies and confusing documentation. If you are interested I can put the result in a public repo. Meanwhile here's a gist that encapsulates some of the stuff I learned. https://gist.github.com/pszabop/61c3b7c36aa5fe866834fda4531d9219
@jabis there's already a catch-all documentation bug that discusses the peers syntax: amark/gun#70
Jachen Duschletta
@Dletta
[D]RavenHawkTech:
[D]Dyno: Welcome <@489487350108258308>!!! GUN (https://github.com/amark/gun) is a P2P protocol for syncing data used by 8M+ people monthly across Internet Archive, HackerNoon, DTube (decentralized youtube), Notabug (p2p reddit), & more. Please try the 5min tutorial (https://gun.eco/docs/Todo-Dapp) to get started!
Jachen Duschletta
@Dletta

[D]anoxy: @pszabop in fact it is possible to have aliases exactly as it works in Discord like anoxy#4831. <@280426612900757504> have implemented it in his platform https://www.peersocial.io/

So by doing it that way there won't be any name collisions

Jachen Duschletta
@Dletta
[D]anoxy: @Stefdv the GUN tagg plugin seems to be really cool, thanks for that ;)
Jachen Duschletta
@Dletta
[D]bmatusiak: yea i found to hash the public key to sha256 then converted into a number and then using using that number to id the alias, so far the most promising unique id
Klemen
@KINKCreative
@Stefdv I am tagging items and then when I get to a view of one item (say, post), I’d like to get the tags for this item only. I made a custom getter for it as written but you may have a better solution to get all tags on a node (not all tags that exist in the system). I use it also to favorite items (eg tag with ‘like/userid’) and will use it for user “playlists” of items.
Klemen
@KINKCreative


Anyone else - is there a way to mutate a value without referencing it (e.g. gun.get(‘someitem’).get(‘views’).inc() to increment? Maybe a custom chain method that will call a method on a node with itself as a parameter? That possibly is already written, I’m just thinking out loud here:

Gun.prototype.call( function( Function cb ) {
this.put(cb(this))
})

And then we could do:

Gun.prototype.inc( function() {
    this.call( function(x) { return x++ } )
})
Klemen
@KINKCreative
And maybe for a list, you map & call the callback on each item
Jabis Sevon
@jabis
@Klemen, maybe something along the lines:
Gun.chain.inc = function () {
  let self = this;
  this.get('.').once(function(data,key){
    console.log("data",data,"key",key);
    if(!data) data = 0;
    data = data+1;
    console.log("data",data,"key",key);
    return self.put({[key]:data});
  });
}
// usage: 
gun.get('something').get('views').inc();
// read count
gun.get('something').get('views').get('.').once(function(count){ // count should be now 1 });