Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Jan 19 18:24
    julesl23 opened #1192
  • Jan 16 08:22
    davay42 updated the wiki
  • Jan 16 08:20
    davay42 updated the wiki
  • Jan 16 06:22
    Orimay opened #1191
  • Jan 16 05:22

    amark on master

    Update README.md (#1181) (compare)

  • Jan 16 05:22
    amark closed #1181
  • Jan 16 05:22
    amark commented #1181
  • Jan 15 00:46
    mbround18 commented #404
  • Jan 15 00:39
    mbround18 commented #404
  • Jan 15 00:38
    mbround18 commented #404
  • Jan 15 00:38
    mbround18 commented #404
  • Jan 15 00:38
    mbround18 commented #404
  • Jan 15 00:29
    mbround18 commented #404
  • Jan 14 23:39
    Orimay synchronize #1189
  • Jan 14 23:36
    Orimay synchronize #1189
  • Jan 14 23:35
    Orimay synchronize #1189
  • Jan 14 14:13
    shemeshg edited #1190
  • Jan 14 12:55
    shemeshg opened #1190
  • Jan 14 12:54
    soulsam480 commented #1174
  • Jan 14 12:51
    shemeshg closed #1188

I'm using gun to update a react page with a lot of user-editable elements that are synced across devices, and I'm noticing that it can sometimes take a while (30 - 90 seconds) to get to the latest version (it seems like it runs through a lot of the history). I would think that gun would locally cache calls to .get()?

Also would using .set() instead alleviate some of these issues? There are a lot of entries in there that are nulled or marked as deleted and it has to download the non-nulled versions first before deleting them making for a poor UX

@aaronsantiago might benefit from using the option change: true when using once().
Hmm maybe not if the change is null
Seems like I'm hitting quota exceeded well before the 5mb localstorage limit as well--perhaps I'm misunderstanding some part of that. I can switch to RAD/indexedDB I believe since that works in the browser
Alexander Quine
is there a recommended way of visualizing the db?

I am trying to wrap my head around Lex, but the documentation does not describe what some of the characters used in the examples actually do, specifically #, +, and ..

Here are some Lex examples pulled from the SEA certify docs, could someone please describe what the #, +, and . characters do in this context?

{"*": "notifications", "+": "*"} // Path must start with "notifications", then Path or Key must contain Certificant's Pub (it's just (path||key).indexOf(pub)!=-1)

{"#": {"*": "inbox"}} // Path must start with "inbox". "get('inbox').get('Alice').get('secret').put('abc', null, cert)" and "get('inbox').get('Bob').get('sensitive').put('something', null, cert)" ARE ALL OK.

{"#": {"*": "project"}, ".": {"*": "Bob"}, {"+": "*"}} // Path must start with "project" and Key must start with "Bob", then Path or Key must contain Certificant's Pub.

"inbox/Bob" // Path must equal "inbox/Bob", it is a LEX exact match {"=":"inbox/Bob"}

["inbox", {"*":"projects", "+": "*"}, {"*":"employees"}] // an Array of rules. If any matches, continue.
Bradley Matusiak
lamo,, google failed because they didnt have gun, https://www.youtube.com/watch?v=v_UyVmITiYQ
@aaronsantiago: If you deleted something, it will still show as null. The solution to get rid of this is to use map(); if the value is null just manually returned undefined so the callback is not triggered anymore. About the local storage, the 5MB limit is annoying, but IndexedDB is much much slower
3 replies
@alxndr: there are plenty of ways https://gun.eco/docs/Awesome-GUN#plugins-helpers
1 reply
This one is the first that I clicked and it doesn't give 404. It even has a youtube video on the README page and the creator is active in chat @Dletta
1 reply
Lorenzo Mangani @qxip
@AlexZan: gun-graphin and gun-scape also should work fine (i mostly maintain them) what viasualizer projects are you referring to?
1 reply
Jachen Duschletta
[D]Aethiop: I've been trying to upload a file to gun by chunking the data and downloading the file is just reading those chunked data to a blob and creating object URL for it but it seems that it's not getting the full file something is wrong when reading the file because the size is not the same as the upload and also the file is corrupt. Can anyone help me out on this?
[D]Aethiop: ```let files = {};
let reader = {};
let loading = true;
var slice_size = 1024 1024 1;
const is_file = () => {
    if (files && files[0] && files[0].size > 0) {
        return true;
    return false;
let prev = user.get("file");

function upload() {
            if (files[0]) file = files[0];
    if (is_file()) {
        prev = prev.get(file.name).get("next");
        reader = new FileReader();

function upload_file(start) {
    var next_slice = start + slice_size + 1;
    var blob = file.slice(start, next_slice);
    reader.onloadend = function (e) {
        if (next_slice <= file.size) {
            prev.put({ data: e.target.result });
            prev = prev.get("next");
        } else {
            loading = false;
[D]Aethiop: This is how I'm Uploading the download is kinda the same just reading from the linked list
[D]Aethiop: ```
async function getChunks(k) {
var next = user.get("file").get(k);
var chunks = "";
while ((await next.get("next").get("data")) != null) {
next = next.get("next");
chunks += await next.get("data");
return chunks;
.once(async (d, k, n) => {
var fileChunk = await getChunks(k);
var data = new Blob([fileChunk], { type: "text/plain" });
            var url = window.URL.createObjectURL(data);
            if (fileChunk) {
                files = [
                        url: url,
                        name: k,
                        size: data.size,
[D]Aethiop: Console log shows the same thing when uploading and downloading its just the file gets corrupt i don't understand
Alexander Quine
what does the "0 length key!" console message indicate? all my uses of .get() are passing in non-empty strings...
Jabis Sevon
you seem to forget that gun.get is not promisified without using something that promisifies it (gun/lib/then or gun/lib/promise) gun.get only returns you the chain item, not the contents
Jabis Sevon
I'd probably go with it with something like
// <script> tags for then 
    return getChunks(file)
    await prev;
    return next.then();
where files would be the wanted keys I suspect, getChunks returns a promisified gun.get.then (ie a real value) and all boils down to a single then - well my example doesn't have return value described as it's from a generic job iterator, but you get the point
Natnael Teferi
So the upload is correct??
Hi all, I am having trouble connecting to GUNDB RPC from chrome extension
getting this error
gun.js:1672 WebSocket connection to
it work from node
was anyone able to get it working for chrome extensions? it seems like a logical use case
Mark Nadal
@ravecoin:matrix.org :fire: :) . :clap: @abow !
@cursedideology:matrix.org we don't control the site.
@connor-davis :clap: @lmangani:matrix.org yeah, trystero definitely nailing the head better than GUN - should use makeAction as a transport layer! Such a great demo.
@yokowasis :clap: @lmangani:matrix.org :clap: @connor-davis
@connor-davis did you make the logo yourself!? :)
@yokowasis oh no! :( don't spend hours on something when you know we can more quickly identify it as a bug or figure out what the issue was. I've not heard of a bug about callback not getting fired yet, but I know the LEX queries are some of the most complicated (they do have tests tho: gun/tests/rad/rad.js ) and had to squeeze it out in time for launch. (Thanks for the vid, your test data is all a:"b" hard for me to differentiate, sorry)
:clap: :clap: :clap: @jabis I think you just did more tests during that debugging than I have in mocha, oye - someone here willing to toss them into that file?
... tho fetching the whole node first defeats the point, @yokowasis is correct.
@Fredaroo_twitter <3 <3 :) :) . I'm gonna refactor the docs - any tips for me while I'm at it? Will check your SO... (remind me if I don't reply)
Docs all pull from the GitHub wiki, anyone can edit in-browser instantly: https://github.com/amark/gun/wiki
@abow :sweat_smile:
@gessicapps_twitter :clap: @yokowasis
@daviddahl which talk on AXE (?). WOW nice talk (slides) yourself! What is with the 2032 date? ... YOU IMPLEMENTED THE BROWSER CRYPTOGRAPHY APIS!!??? Holy cow, you're a legend. Ah, good ol'days when "crypto" meant "crypto"... cryptography, not scamtokens. What happened to ZK? Wow, so many questions now - what were your thoughts on our 1min Cartoon Cryptography explainers? What do you think of Party? How do you like the SEA api that wraps your work?
@aaronsantiago is the 90s delay between separate devices where 1 of them is Windows? This is often fixed by adding gun/nts.js which does clock sync (tho note: I don't think it works in latest). If not, the local benchmarks do about 5K ops/sec, however I noticed weird delays going on in AXE with the Fireship launch, so I'm hoping maybe you've figured out how to replicate it?
@alxndr :clap: @rococtz:matrix.org :clap: @lmangani:matrix.org ! There is also @mmalmi 's "explorer" in Iris, @yokowasis has a database viewer too.
@jakethejab interesting, those symbols aren't actually part of LEX officially, interesting, and I haven't used Certify yet ... can someone help? What do these other oens mean?
@aaronsantiago :clap: @rococtz:matrix.org
@bmatusiak which part of that talk? Tho in there defense... 2009 GUN didn't exist.
discord@Aethiop @aethiop way cool! :clap: @jabis ! Interesting, yo'ure saying the console.log of the upload === the download? Then we know its not corrupt at that point. Maybe we can also add this to our call coming up.
@ignas-g do you have /gun on it? My extensions don't peer actually, maybe Chrome not like outbound connections?
6 replies
Wasis Haryo Sasoko

@amark my video is not about the result {"a" : "b"}. It's about the amount of it get fired. The expected result is there should 7 x {"a" : "b"} fired.

The bug is : the same command run multiple times, yet it has different result.
1st run result : 7 x {"a" : "b"} fired.
2nd run result : 4 x {"a" : "b"} fired.
8th run result : 1 x {"a" : "b"} fired.

It's using gundb on local browser with no peer. So we can rule out the latency / slow peers.

Mark Nadal
and this happens with RAD on IndexedDB? eep. Or does it happen to default GUN / localStorage?
Wasis Haryo Sasoko
@amark RAD on IndexedDB
You can see my initialization below the video. It's 1 page index.html page.
Now that I think about it. I never tried local storage
Mark Nadal
@yokowasis please submit the index to a GitHub Issue, I don'tw ant to lose this
Wasis Haryo Sasoko
can anyone try gun.load ? it works yesterday
Jabis Sevon
if you upgraded gun version, then you'll need to include gun/lib/utils.js or something like that - most were removed from core to libs @yokowasis
@amark, > ... tho fetching the whole node first defeats the point
like I said, make a metadata .get('chat').get('meta') first - didn't need to be the root object, just somewhere in the path it seemed
but it's definitely a reincarnation of the "first get produces undefined", so possibly a regression
Barłomiej Bąk

a few words about my issue with certificates I had a few days ago

let gun1 = GUN({...})
let gun2 = GUN({...})

let pair1 = SEA.pair()
let pair2 = SEA.pair()

let cert = await SEA.certify( '*', {'*': 'messages'}, pair1)

gun2.get('~' + pair1.pub).get('messages').put({msg: 'my message'}, null, {opt: {cert: cert}}) // that will NOT work, anonymous user

await gun2.user().auth(pair2)
gun2.get('~' + pair1.pub).get('messages').put({msg: 'my message'}, null, {opt: {cert: cert}}) // that will work, 'pair2' user

What I mean by this, that in my case certificates used by anonymous users don't work. The user has to be authenticated to use someone's else certificates.
At least that's how it is on my side.

Wasis Haryo Sasoko
@dweorh_twitter you probably right. The easiest way to allow public write is, you log them using anonymous key pair.
So, when someone visit your website, you log them in anonymously. That way you can use certificate.
I have a very basic question. So how does one implement pagination using gun? I assume you load all the data, sort (may be based on timestamp), and you filter based on page number? But how efficient is this assuming the entries could be very long? (and you might have to make thousands of such queries)
Hello there i was coding my app all of a sudden pairs doesnt see each other
when i rejjoin a chat room someof the messages comes but thats it
it used to be working fine
Can anyone help me with this?
Lorenzo Mangani @qxip
Sounds like a network issue, but you're going to be way more detailed to get suggestions as the above description is too vague and lacks any technical details/logs
Can you reproduce this and share a working example on glitch/etc
I am on the same network as it works on before i even tested on ngrok
If you want i can share my screen?