Kaspa researcher and developer. Supported by the Kaspa ecosystem foundation (KEF)

FreshAir08 retweeted
started to record a short 10-min live-coding argent episode: a basic multi-actor ticketing app. one hour later, episode 01 exists 😅 start here: github.com/argent-lang/argen… written code: github.com/argent-lang/argen…
49
312
877
44,679
Updating on a PR of mine merged to master: github.com/kaspanet/rusty-ka… TL;DR computing data relating to the pruning proof on the fly while building the proof rather than all the time results in substantial performance optimization on many fronts. A word or two for the unacquainted: theoretically speaking, all you need to know to follow a blockchain consensus are block headers and block bodies, if your node stores those locally, anything else you possibly want (to verify a new block, to know what can be pruned, to answer RPC calls) is implied by that. It is however preposterous to recompute stuff from scratch all the time, so in practice (in all computer science, not just blockchain), you more than often store a lot of “metadata” with the goal of making computations shorter at each step of the way. In Kaspa one prominent examples of such metadata are the various “per block” stores - databases containing certain types of info on every block (indexed by the block’s hash). Moving on: As you know in Kaspa there is a Dag structure and each block on it is assigned a blue score - a parameter somewhat equivalent to block number in btc. What is less famous is that there are actually multiple Dags in Kaspa - derived from the main one. Simplifying a bit, what you should imagine is that in these “higher level” Dags, blocks whose hash difficulty is not rare enough for that level are filtered out, and instead of the now hanging edges, new edges are accordingly shortcutted between great grandparents and great grandchildren. These are known as indirect parents, and they are written out in block headers for every level out of the possible 225 (It is worth noting though that most levels are regularly empty or contain very little parents). Additionally, each such Dag also implies a per level blue score for the blocks in it. Without diving into much detail, these high level POW representative but sparse secondary dags allow us to quickly compare the POW accumulated by two diverging DAGs without being forced to always store all blocks since genesis. For this comparison, what we require is the blue score of the blocks of the secondary Dags. In the far far past precrescendo, we computed the blue score for every block in the network on all possible levels, and stored it in such aforementioned “per block” store. In practice however, most of this data is of no real relevance - the levels in the pruning proof are by design themselves “pruned” to about 2000 headers, as it is the higher and sparser levels that form the significant part of the proof. Ergo a past PR by @coderofstuff_ improved performance by opting to compute the blue score of the higher levels only when generating/comparing a pruning proof. And yet, this on the fly computation of the blue score still left a remnant of per block X per level storage. It was a thing called relations_store. What the (level i) relations_store gives for every block is quick access to its “children” on that level. While the indirect parents of the level are directly derivable from the headers the same does not apply for indirect children. This store facilitated forward traversal of the DAGs, which was useful when calculating the blue score. The point is that children are ultimately still implied from the Dag structure and thus a satisfactory relations_store can be reconstructed on the spot by doing one backward traversal of the DAG on that level. Doing this only while building the pruning proof, and only for a small number of blocks, meant we no longer have to regularly maintain relations at every level. The effects did turn out to be dramatic - first, archival nodes reported a significant decrease in storage usage. Second, header processing became a lot more efficient without the need to write these new stores to the disk. The effect is that the Kaspa node is lighter on your PC - but of no less important is that the header stage of IBD became a lot faster. I am not sure if I should give figures, because every machine is different, but for me it was about an x3 difference. Finally, not storing these higher level relations also meant you don’t need to erase them during pruning. As it turned out - this was a big bottleneck during pruning, which my personal laptop had a hard time with, and is finally relieved from.
17
35
135
12,512
A thank or two to finish of: Obviously @michaelsuttonil who directed me at this and guided me alongside @coderofstuff_ , and also @elldeeone who helped me diagnose where the bottleneck in pruning really is at.
3
37
905
I want to share some explanation of a PR of mine freshly merged to master, regarding an optimization on the IBD process: First I’ll explain how stuff worked thus far and what the problem was: Initial block distribution (IBD) is a bombastic term to say syncing the node. If you run a node you know this well - you either connect for the first time, or just reconnect after a short/long while being offline and you start downloading a multitude of stuff before your node is back on track. There were currently two types of IBD, the first, “Sync”, was the simpler one - you reconnect after a short while, download and process the recent headers from a peer, then download and process the corresponding block data (transactions). Depending on your hardware this may be longer or shorter, but the process itself is simple. The second is called “ibd_with_headers_proof”, and can occur in two scenarios - (a) this is the first time you run the node and (b) you have been disconnected for so long that you no longer recognize your peer’s pruning point, and hence you cannot just “Sync” from him as a straightforward sync requires data they pruned. What happens in this type of ibd is more involved: (1) you open a new consensus instance with an empty database. (2) you download in it the MLS proof of your peer and verify it, you also compare it to your own old proof (if such exists) to see it does not contradict it. you proceed to Import pruning points and other storages accordingly. (3) You download some “trusted data” from the peer which serves as a base layer for the sync. No one likes the name “trusted data” but no one came up with something better. Still, it is emphasized that this data is only trusted through the duration of the IBD - by its termination, either this temporary trust will be justified by POW, or this “trusted data” will be thrown in the trash can where it belongs. This trusted data is mostly block data of the pruning point block and its anticone (=”parallel blocks”, kind of), but there are also some other headers there which are not relevant right now. (4)you download all headers from that pruning point to the tip of the syncer (5) you download from the syncer the utxoset corresponding to that pruning point, and verify it. In the far past this used to be rather short - but not anymore since dustman had its way with our utxos for a tumultuous 12 hours. (6) Finally you download and process the block bodies The first problem was that 1-5 was a take it or leave it process - if you had disconnected during any stage this attempt to resync is thrown away and you have to start from the beginning the next time. Given (4) and (5) can be quite long - this was not ideal. I skip the explanation here, but much for the same reason you know there must be valid block bodies in (6), you really know there must be a valid utxoset in (5). So first thing - PR made it so that if you stop during (5), you only need to repeat from (5), not from the very beginning. As a sidenote I already say that taking it to the next step is making (4), (5) themselves be gradual processes. (4) is absolutely on the map (see comment below), for (5) I’m not sure what the right approach is. The second issue is more subtle: There are cases that fall in between “Sync” and “ibd_with_headers_proof. Say you resync normally, but disconnect during the headers state before downloading block data. you come back a day later, and try to continue from where you were - but alas, your peer has pruned away the block data you require. Nevertheless you won’t go into ibd_with_headers_proof because you do know that pruning point’s header - so what will happen is that you will fail to resync, getting stuck in failed ibds until more pruning points surpass or you hard reset the node manually. If you run a weak node - you might have encountered this. Now of course the first measure would be recognizing this scenario, and saying you should go into ibd_with_headers_proof instead of getting stuck in failed IBDs for a while. But really this is a big waste - you already have the syncer’s pruning point header, and potentially many headers beyond it - you don’t need to redownload these headers, you don’t need to verify MLS proof again, you don’t need to break away from your current consensus data you have that it is a valid header from anew. What you really want to do is be convinced that it is a pruning point - which you can do if you will download sufficient headers on top of it - update that to be your new pruning point (and also update a dozen other storages), receive the “trusted data” as your base layer for future processing (that name is even more misleading here you know the data is real), and carry on syncing (including downloading a corresponding new utxoset). So that was what the PR was about, and at the time it sounded simple to me. Welp maybe it is, but it was certainly easier said than done since there was a lot of subtleties and a lot of need to prevent and handle “limbo states”, which the codebase was not designed with in mind. Was very instructive to me about ibd, mls, and the pruning process in general. Happy with the result and hope it eases up the ibd process for us weak noders. github.com/kaspanet/rusty-ka…
12
20
102
7,735
Michael corrects me that IBD stands for Initial Block Download, I pondered about confirming what the initials are but didn't bother. It also stands for inflammatory bowel disease, but that's probably not what Satoshi meant.
1
9
497
For the technical minded aspiring contributor, there are two continuations I have in mind to this PR: The first is basically some refactoring - there is a lot of code similarity between the classic ibd_with headers_proof flow and the newer "catchup" flow. It is non trivial as there are also differences, but code structure can definitely be made more refined. github.com/kaspanet/rusty-ka… The second is exactly about making (4) gradual during a fresh IBD. More details inside since I'm already tired from typing: github.com/kaspanet/rusty-ka… I will get to those eventually if no one else does, but for the time being I want/need to focus on some researchy stuff.
3
24
745
FreshAir08 retweeted
Just skimmed, out of curiosity, through the whole vProgs channel on Kaspa's R&D Telegram. It's really interesting to follow the research process, instead of simply reading a smooth and digested white paper. What's immediately clear is that this is not a thing that exists and is just waiting to be implemented, it's rather continuously explored and redifined. The principles are clear. They want programs to run on Kaspa, executed outside of it and cryptographically proved to the L1 nodes. But it's fun to observe the number of complexities that arise from this "simple" goal. How to resolve overlapping proofs without wasting work? How can vProg nodes keep a state that's robust to small reorgs? How to balance the desire not to commit to a single framework/language with the need for a standardized communication? Can a program prove stuff about itself, like that it crashes or runs out of gas, so that the system doesn't get stuck on those edge cases? And the queen of them all: how the hell do you call a vProg from another one, while building a combined proof of execution? What makes these things provable is that they get converted into "circuits", but these circuits are pretty rigid monsters that can't really talk to each other natively. Plus they're run with private inputs (the "zero knowledge" part), so how do you even combine them without somehow sharing those inputs? It's a rollercoaster, not a linear flow. At some point it just seems impossible, it's too complicated. But then someone pulls out a crypto trick, "hey let's tie program A and B through a commitment of private inputs, so they remain private but the link can't be faked". That seems to work, we're back on track, maybe this thing is really possible, let's go! Up to the next challenge... (Don't quote me on any of the above, I missed many details and I'm sleepy. I do suggest it as a night read though, it's fun) good night.
7
30
206
17,882
See you soon
🎙 Over the past year, KEF has proudly supported research grantees advancing #Kaspa's technical development. With the recent vProg Yellow Paper release sparking vibrant community discussions and countless questions, we knew it was time for something special. Introducing our new space series featuring KEF's brilliant grantees! 🌟 We're thrilled to kick off with @FreshAir08, co-author of the vProg Yellow Paper, joined by @kaspador_ as the host, for a deep dive into the revolutionary vision of vProg. 📅 Sunday, November 9th, 2PM (GMT+2) Mark your calendars — you won't want to miss this! 📌 🔗 nitter.net/i/spaces/1BRJjgVkZZoxw 🔍 What awaits you: • Understanding vProg in simple terms • Layer 1 limitations, rollup evolution and how it leads to vProg • Comparative advantages over existing solutions • Challenges and opportunities of a never-tried architecture • Exclusive behind-the-scenes stories from the R&D journey Got burning questions about vProgs? Drop them below — we might just feature yours! 👇
1
4
31
2,230
FreshAir08 retweeted
I created a small "good first issue" for anyone who's interested to make a small contribution for rusty-kaspa. Link in the reply
3
25
107
5,947
A few words on what I'm researching with @hashdag the last few days: A paper from 2017 by Lavi-Sattath-Zohar suggests an alternate fee mechanism for blockchains. The gist is initially unintuitive - miners charge from all transactions on their block the fee of the lowest paying transaction included on that block (even from the transactions that agreed to pay more). The idea is that this causes miners to optimize for number of transactions times lowest value transaction, and naturally exclude transactions paying considerably lower than others. It can be thought of (sortofish) like a smart and adaptive way to do "minimum fee". The desired effect of this mechanism as it pertains to incentivize users to pay higher fees to the miners in a manner independent of the blocksize (i.e. even when the mempool is smaller than the capacity of a single block). First, it's worth mentioning that this scheme was to my knowledge never implemented in the real world. Second, all of the above is true for blockchains. One of the challenges lie in adopting it to DAGS. Before continuing I want to clarify a common misconception I see about Kaspa: ---------------Intermission: inclusive blockchains------- Kaspa's high throughput is not primarily because of the transactions in parallel blocks - even if transactions not on the selected chain were discarded, Kaspa will still be more capacious than traditional blockchains by the mere fact that it can allow a higher blockrate for a given blocksize (...for a given security parameter and a given min hardware, etc.). But it is true that this simple effect diminishes as the number of parallel blocks increase - throughput is wasted if you throw away parallel blocks' transactions. This throughput can be salvaged by something called the inclusive protocol. Simply put - an order is assigned to parallel blocks, and all transaction in them which do not contradict a previous one are included in the ledger as usual. *In Theory*, we can now use every block to its fullest throughput. But why won't all parallel blocks just include the same transactions, wasting away our theoretical gains? well, if they all choose the same transactions, they will sometimes win big, but often get nothing. A miner then choosing transactions other had not is in average better off! Even if those transactions have lower fees. Long story short it turns out that the "correct" ("equilibrium", with some 5 asterisks or so.) thing for them to do is choose transactions in random, but weighted on the fees they pay. Simplifying a lot here fyi. It coincidentally also turns out this generally gives good throughput to the system. This is what happens in Kaspa today, but again, I cannot stress enough this is not the sole source of higher throughput in Kaspa. ---------------------Intermission End--------------------- So basically, while it theoretically was possible to just take a step back and give up "inclusive" (wavering some precious throughput), we wish to merge this new fee mechanism with the insights on inclusive protocols which Kaspa currently uses. With a new fee mechanism the equilibrium changes, and with miners having a different strategy, the original guarantees on user's behavior needs be reexamined as well - so once the miner equilibrium is set we need to ask of the users' equilibrium. Our hope is that after all the analysis we find out that either similar guarantees on the behavior of users as in the original paper can be maintained. Alternatively, we'll try to find a variant of the original scheme such that they will. If anyone with a proper background wants to take a look at this as well they are also invited btw. Long term research decentralization is a goal like everything else. Two final points: a) No fee mechanism change, as good as it may be, will replace the need for an increase in demand. This effort should be in parallel to building new utilities to Kaspa (e.g. vProgs). b) This is a mid term solution (but one long due serious research imo) and requires a HF. There were suggestion from within the community for modifications which could be instantaneous. These suggestions may not be long term theoretically sound but are often non detrimental - miner adjustable min fee for example. These types of solutions are usually prone to prisoner dilemma and as I said I don't think fee policy alone can currently change the big picture - but if someone were to just implement this I personally won't object as it is harmless. Sounds like a nice entry level project into rusty Kaspa dev imo.
9
43
163
9,812
And an extra word or two: the last week has been great in seeing people push for and suggest for solutions on their own. I alluded to this above, but I'll restress it - we cannot and shouldn't rely only on a small subset of people to provide solutions. No matter how smart they are, and they are, we as a community must take more responsibility on ourselves, to expand and eventually push out and outsmart the old generation. One of my criticisms over the "Terrah AI" project of Yonatan is that, it would never have made me smarter about crypto the way discourse with real people had. Yonatan said that very well, but Terrah is made not to make people smarter, only more informed. I want people to be smarter, not more informed. Me and Yonatan disagree here, and it is left for the reader to decide whether that's because he is smarter or because he is more informed. Anyway here is my poor attempt at pushing people to be the smartest version of themselves: my suggestion is that those of you who independently devised fee market solutions (and those who read those) to take it even one step further - be a researcher: don't rely on exteriors to criticize your idea and find its weaknesses, try and do so yourselves, see what others had to say on similar ideas, attack it from a thousand angles, find everything wrong with it - and then when you present them, present them alongside its weaknesses for discussion. I emphasize that a solution that has weaknesses is not necessarily a bad one, it can still be argued for and against, but it can give you a lot of insight on the problem, and in turn, help the community as a whole converge on optimal ideas.
1
1
41
1,474
Fee mechanism paper arxiv.org/pdf/1709.08881 Inclusive blockchains paper avivz.net/pubs/15/inclusive_…
1
17
1,118
Anybody brave enough to give this a try? I will gladly help with the technicals. The comparison may be unfair (because btc is simpler, because it has been around for longer at that point, and because 3b1b is the absolute top tier of math communicators and not a realistic standard to compare to) but I agree with the message - we need to be able to communicate our ideas to those not yet sold on Kaspa, on every level, in every format. Some videos I'd like to see: 1) Accurate but compelling and succinct explanation for why pruning is secure. 2) A video version of this canonical article by @OriNewman someone235.medium.com/how-in…
Replying to @BitcoinBltnBrd
For starters, explain how Kaspa/BlockDAG work at a level that's just as easy to understand and follow as @3blue1brown's explanation of Bitcoin. PowerPoint presentations by some guy with a thick Israeli accent ain't gonna cut it. piped.video/watch?v=bBC-nXj3…
2
2
7
1,791
Imagine people were like "we don't need optical fibers, the internet scales in layers" The OSI model consists of 7 layers, but it never exempted engineers from improving each layer individually. Coaxial cables were lossy and noisy, and their limitations restricted the system as a whole. The data link layer competently handles detection and correction of the errors originating at the physical layer, and continues to do so today even for the much more reliable optical fibers. Yet no one dreams of denying a simple truth - less errors at the source are preferable. A faster, more efficient base layer is preferable.
8
29
163
10,549
“We want a cryptocurrency to ping and be ponged” A small wish list of mine for community devs: 1) Bullet Chess, obviously. 2) Battleships: You can use commitments (hashing) to hide your ships from the other player. 3) Trivia: Kaspa operates in real time, players could compete on who answers correctly first, game show style. 4) The most ambitious of all: I believe a clunky version of pong could run on Kaspa, it will be difficult to pull off well and undoubtedly requires optimizing the infra. 5) Some application which is not a game, surprise me. I am excited to see more people having fun with Kaspa. I secretly hope eventually an application will rise that will make true use of decentralization, but it’s fine that many are gonna be for fun initially. I hope someone does push it further to allow for persistency (see Michael post in comments), and in due time even ZK support.
1/2 What if you could build high-frequency dapps on Kaspa in minutes? That’s the idea we (@freshair08, @elldeeone; inspired by @hashdag) have been exploring with Kdapp, a small “weekend effort” side project to highlight Kaspa’s blazing 10bps. It has been a true pleasure to see grass-roots efforts like Kasia (@kasiamessaging) going live while we were working on this. Our hope is that these movements are only amplified—our own effort was always meant to facilitate new ideas, and we have no intention of “standardizing” how apps on Kaspa are supposed to look. In the general case, dapps could rely on data lying beyond the pruning point, greatly increasing design complexity. To circumvent this, we chose to restrict the current effort to time-sensitive applications lacking “persistency”. Consider a blitz chess server: if you initiate a game and don't care about ratings, you only need to track that single game, not any past ones. As our “launch title”, we don’t have frantic bullet chess, but we do have the magnificent tic-tac-toe with a nice twist. We might add more, but frankly, it is best for community devs to take it from here. The current codebase is a foundation, but much is needed on the developer experience and UI fronts.
5
15
59
6,617
Another call for action:
A random thought TL;DR: A Kaspa pre-ZK-based rollup/dapp can store only transactions targeting it plus a small fraction of all other txs and still prove correct execution. Full story: Say you’re building a based dapp¹ on current² Kaspa. Due to the lack of ZK-verification capabilities on L1, you would, supposedly, need to store all transaction data since the launch of your dapp in order to prove correct execution up to the current state (using the new sequencing commitments). Observation: Naively, you would need to store all L1 DAG txs—including native ones and those targeting other dapps—because for each tx you must show whether it targeted your dapp or not (i.e., you need to prove non-membership as well). Idea: Define valid dapp txs as those whose ID ends with 10 zero bits. For wallets/clients generating txs for your dapp, the cost will be merely 2¹⁰ Blake2b hashes on average—cheap. The payload simply includes a nonce you increment until the tx ID satisfies the condition. Result: You can now keep only the IDs for txs without a 10-bit suffix (because that itself is proof of non-membership) and the full tx data for those with the suffix. That translates to storing O(dapp-activity) plus approximately 1/1,000 of all other activity. Of course, the suffix length can be adjusted. Refinement: Instead of a suffix, choose a predetermined set of 10 bit positions (out of the 256 bits of each tx ID) to avoid strategy collisions with other dapps. Why I find this interesting: Because I’m thinking about a minimum-viable platform for developing and running dapps on Kaspa in the short term, getting closer to the order of magnitude of dapp-activity storage costs is crucial. ¹ Based dapp: a dapp using Kaspa’s L1 sequencing and data availability that tracks transactions containing payloads following some format and executes them on a predefined VM ² Post-Crescendo, pre-ZK era
1
2
8
1,035
Just an excerpt on that Litecoin blogpost: taking pride in not having RBF so you could put your trust in the mempool's good will is a testament to having given up any pretense of being mathematically sound money.
5
3
27
12,376
I deleted a previous iteration of this post where I insinuated Btc disables RBF by default as well. @OriNewman corrected me that I was malinformed on the resolution of the RBF arguments and that it has been standard for a while now. My apologies to BTC on my mistake.
2
7
1,119
I'd also like to believe that the blogpost writer does not represent the wider Litecoin community in thinking that "not needing RBF" and relying on 0-conf "security" is a good thing.
6
851