Better HN
topnewbestaskshowjobs
Log inSign up

socketcluster

763 karma · joined Sep 20, 2023 (3y ago) · 321 submissions

Email: jon(at)socketcluster.io
Submissions

comment 7mo ago · link · parent

I built my quantum-resistant signature scheme from the simplest cryptographic primitives I could find precisely to mitigate risk.

This implementation simplicity came with tradeoffs; I chose a stateful signature scheme (Lamport OTS with Merkle Signature Tree) which I could fully understand and easily verify from first principles. It's actually one of the simpler aspects of my blockchain.

Originally, I wanted to use SPHINCS+ (stateless) but there were no good libraries for it at the time in the Node.js ecosystem and TBH, I didn't fully grasp some of the finer technical details at the time; it was clear it would have been a much more complex and error-prone solution.

That said, statefulness in the signature scheme creates complexity elsewhere and shifts the risk to the clients. There are risks that a poorly implemented client could lead to key-reuse. Also, there are concurrency scenarios which can't be supported securely (e.g. if the user tries to sign multiple transactions in parallel from two different clients from the same wallet/private key).

And yes, I did run several versions of Claude including Claude 4.6 sonnet against both:

https://www.npmjs.com/package/lite-merkle https://www.npmjs.com/package/lite-lamport

It said it found 2 non-critical issues with lite-lamport but neither was exploitable.

I had to add comments to the README so that anyone who tries to run an AI against the code knows that I'm aware of these concerns but they are not issues. I did fix a non-critical signature malleability issue but that was more to appease the AI since there was no exploit for it at the level of the blockchain; it basically ignored any extra trailing bits at the end of a valid signature which could in theory lead to replay scenarios with an extended signature with junk data at the end but not possible in practice since transaction IDs are unique and deterministic. There's no possibility of double-spend.

I look forward to running the new Claude Mythos on it when it comes out. In the meantime, if anyone can find an issue with it, please let me know.

comment 7mo ago · link · parent

There are different degrees of well-engineered software. It's almost impossible for humans to do a good job with a large codebase. Some software is just too complex for any human or machine to implement correctly.

Humans almost always underestimate the cost of features. I bet we could massively reduce the amount of code and complexity of the Linux Kernel if we abandoned the account system entirely and just made it one user with root access and just relied on containers to provide isolated sandboxes.

A lot of features just crept in over long periods of time and weren't re-evaluated as needs changed. I think the approach I'm suggesting would have been horrible 20 years ago but makes more sense now in the era of cloud virtualization. The account system and containerization aspects are basically different implementations which solve the same modern problem of environment isolation... Nobody really needs per-file access restrictions anymore... The cloud era is more like "here is Bob's environment, here is Alice's environment" and they can do whatever they want with their own container/sandbox. The account permission systems is more of an annoyance than a solution for most use cases.

Everyone just latched onto the existing abstractions and could not fully re-imagine them in the context of changing requirements. LLMs are even worse than people in that sense.

That said, I think supporting a wide range of possible hardware is a real challenge for the Kernel and that part will always require an amount of code proportional to the amount of hardware supported.

comment 7mo ago · link · parent

But the summary is likely to summarise out the details which makes the code vulnerable.

comment 7mo ago · link · parent

This is a great point. I'm really concerned about it. Most people seem to have poor taste and like what is most generic because generic is familiar.

comment 7mo ago · link · parent

100%, poorly architected software is really difficult to make secure. I think this will extend to AI as well. It will just dial up the complexity of the code until bugs and vulnerabilities start creeping in.

At some point, people will have to decide to stop the complexity creep and try to produce minimal software.

For any complex project with 100k+ lines of code, the probability that it has some vulnerabilities is very high. It doesn't fit into LLM context windows and there aren't enough attention heads to attend to every relevant part. On the other hand, for a codebase which is under 1000 lines, you can be much more confident that the LLM didn't miss anything.

Also, the approach of feeding the entire codebase to an LLM in parts isn't going to work reliably because vulnerabilities often involve interactions between different parts of the code. Both parts of the code may look fine if considered independently but together they create a vulnerability.

Good architecture is critical now because you really need to be able to have the entire relevant context inside the LLM context window... When considering the totality of all software, this can only be achieved through an architecture which adheres to high cohesion and loose coupling principles.

comment 7mo ago · link · parent

I suspect it will converge on minimal complexity software. Current software is way too bloated. Unnecessary complexity creates vulnerabilities and makes them harder to patch.

comment 7mo ago · link · parent

I'm skeptical of the whole thing, it almost seems like a marketing campaign to encourage developers to use more tokens.

My experience as a software engineer, including with Claude Code itself, is that the more code you have, the more bugs there are. It quickly turns into a game of Whac-a-Mole where you fix 1 bug and 2 new bugs appear.

Looking at the functionality of Claude code. There is no way it requires 500k lines of code as claimed. It would make it very difficult to debug... Though it seems they have a team of 10 people which is a lot for a CLI wrapper.

It's more likely that somebody ran the real code through an agent to intentionally obfuscate it into a more complicated form before they leaked it. This is trivial to do with LLMs. You can take any short function of a couple of lines and turn it into a function hundreds of lines long which does the exact same thing.

It's actually a great way to obfuscate code in the AI era because LLMs are good at creating complexity and not good at reducing it. I've done tests where I ask Claude to turn a simple 1 line function which adds two numbers together into a 100 line function and when I asked it to simplify it down, it couldn't reduce it back to its original simple form after multiple attempts. I had to explicitly tell it what the original form of the function was for it to clean up properly. This approach doesn't scale to a whole codebase. Imagine doing this to an entire codebase, it would take more time for you to read and understand each function to tell the LLM how to clean it up than just re-generating the entire app from scratch.

The problem with large amounts of code is not only that it's harder to maintain and extend, it's often less performant.

While LLMs can allow us to get more out of bad code, they will allow us to get even more value out of the equivalent good code when it comes to maintainability, reliability and efficiency.

comment 7mo ago · link · parent

Yep. Good quality, succinct code saves time and money. Always has and always will.

comment 7mo ago · link · parent

I had an epiphany about the software industry when I stayed at my parent's place and used a microwave that had the worse UX of any machine I had ever seen. Basically there was no start button, there was no way to increment the timer after you started, there was no '10 second or 1 minute preset' like every other brand and the only way I could figure out to make it 'work' would turn on a super loud fan which would keep running even after the Microwave had been stopped; I had to pull the plug on the thing to make it stop.

It was a popular brand and I suspect it probably sold well. The mind-boggling dysfunction may not have been obvious at a glance when the consumer made the purchasing decision. The UX was so bad, I still have nightmares about it.

As I was trying to use the damn thing as a user and kept running into one hurdle after another, it triggered a flashback of my experience of debugging complex software as a software engineer and I thought to myself "F***, I chose the wrong career. I'm cooked. The user doesn't care. The user doesn't care AT ALL." In that moment, I understood that getting replaced by AI was the least of my problems. Far bigger problems had been there since the beginning. I just didn't notice them.

I just thought about the software engineer who had to implement this retarded UX... I imagine they would put on their resume "Wrote the firmware for <popular electronics company>" and it would sound really good. The worst part is that it's probably not even their fault that their work sucks.

Anyway it just made me realize how unmeritocratic this industry is. We could do a great job or a horrible job and most of the time it has nothing to do with career progression and opportunities.

comment 7mo ago · link · parent

Why would experts care about my product? There's no big money behind it. The big money has to come in first, then the experts come later to tell the big money whatever they want to hear. Maybe they want to hear the truth maybe not... Either way the paymaster always hears what they want.

Besides, I am an expert. I studied cryptography at university as part of my degree. I have 15 years of experience as a software engineer including 2 years leading a major part of a $300 million dollar cryptocurrency project which never got hacked... I know why the experts were not interested in my project and after careful analysis, I believe it has nothing to do with flaws in my work.

If anything, it might be because my project doesn't have enough flaws...

At this stage, I hope you're right. I hope I will find the flaws in my projects that I've been looking for after 5 years.

comment 7mo ago · link · parent

It's a very simple signature algorithm. They're welcome to try and crack it. If there is an issue with it, it shouldn't be hard to identify within those few hundred lines. Nobody found any issues in the last 5 years though.

Isn't it a good thing that there exists at least one blockchain in the world which isn't based on the same crypto library used by every other project? What if those handful of libraries have a backdoor? What if the narrative that "you shouldn't roll out your own crypto" is a psyop to get every project to depend on the same library in order to backdoor them all at once at some future date?

Strange how finance people always talk about hedging but in tech, nobody is hedging tech.

comment 7mo ago · link · parent

Maybe it's a good time to start promoting my 5 year old, lightweight, hand-crafted, battle-tested, quantum-resistant blockchain: https://capitalisk.com/

It's about 5000 lines of custom code. Crypto signature library written from scratch.

comment 7mo ago · link · parent

The crypto dev community has a strange idea that working with binary is superior. For many algorithms, it's not. It just obfuscates what's happening and the performance advantage is negligible... Especially in the context of all the other logic in the system which uses far more resources.

I didn't know that Protobuf wasn't canonical but even without this knowledge, there are many other factors which make it an inferior format to JSON.

Also, on a related topic; it seems unwise that essentially all the cryptographic primitives that everyone is using are often distributed as compiled binaries. I cannot think of anything more antithetical to security than that.

I implemented my own stateful signature algorithm for my blockchain project from scratch using utf8 as the base format and HMAC-SHA256 for key derivation. It makes it so much easier to understand and implement correctly. It uses Lamport OTS with Merkel MSS. The whole thing including all dependencies is like 4000 lines of easy-to-read JavaScript code. About 300 lines of code for MSS and 300 lines for Lamport OTS... The rest are just generic utility functions. You don't need to trust anyone else to "do it right" when the logic is simple and you can read it and verify it yourself! Simplicity of implementation and verification of the code is a critical feature IMO.

If your perfect crypto library is so complex that only 10 people in the world can understand it, that's not very secure! There is massive centralization and supply chain risk. You're hoping that some of these 10 people will regularly review the code and dependencies... Will they? Can you even trust them?

Choosing to use a popular cryptographic library which distributes binaries is basically trading off the risk of implementation mistake for the risk of supply chain attack... Which seems like a greater risk.

Anyway it's kind of wild to now be reading this and seeing people finally coming round to this approach. I've been saying this for years. You can check out https://www.npmjs.com/package/lite-merkle feedback welcome.

comment 7mo ago · link · parent

I've been talking about 'complexity' for years but business people just didn't get it. Now software development has become almost entirely about complexity management so now I'm hoping that they will finally understand what software engineering actually is. I hope they will finally start valuing engineers who can reduce complexity.

I was always into software architecture and I was dreaming to be a software architect but after completing university, the position was on the way out.

comment 7mo ago · link · parent

Thanks for the feedback. The part about the voting aspect of the pricing model is a good point. I will remove this and try to use a bit more conventional language whilst maintaining a kind of exclusive licence model.

Also I'll try to explain like "Estimated to be X times faster to develop and requires 70% fewer tokens than alternative stacks and easier to configure security."

That's actually realistic based on some recent analysis I did. I didn't have this info before.

comment 7mo ago · link · parent

Can relate. It's like; if you're less rigorous than the CTO, they would think you're incompetent. If you're more rigorous than the CTO, they would think you're overly pedantic; not pragmatic enough.

comment 7mo ago · link · parent

I've been advocating to minimize the number of dependencies for some time now. Once you've maintained an open source project for several years, you start to understand the true cost of dependencies and you actually start to pay attention to the people behind the libraries. Popularity doesn't necessarily mean reliable or trustworthy or secure.

comment 8mo ago · link · parent

It's real-time by default. Done in a cheap (and efficient) way. The views update automatically when relevant data changes, no possibility of overriding conflicts when editing concurrently. Changes are only distributed to users/clients who are looking at the affected data.

It's not just for chat. Anytime people update data collaboratively, for any data-driven software, you run into issues of people overwriting each other's changes... Sadly users got really used to poor experiences like having to 'refresh the page', or 'locking down resources' during edits to avoid concurrent editing altogether.

It's been kind of disturbing for me to realize how few people care about data integrity in collaborative scenarios. It's a kind of hidden issue which can cause major problems but users tend to tolerate. I've had this experience first-hand with colleagues using various other platforms where someone else had the same resource open for a while in the browser, we updated different fields and my field was overwritten with its old value but we didn't realise for some time until it caused a bug with one of the workflows. Then it was like "I'm sure I updated that value."

SC's pub/sub channels are part of the secret sauce to make this work. SocketCluster makes some unique tradeoffs with its pub/sub mechanism; the channels are extremely cheap to create and are cleaned up automatically (and cheaply)... And at any scale with sharding. This was an intentional design decision which is different from message queues like Kafka and RabbitMQ which prioritise throughput and are typically used in the backend as opposed to being end-to-end.

comment 8mo ago · link · parent

I love the simplicity of Node.js that each process or child process can have its own CPU core with essentially no context switching (assuming you have enough CPU cores).

Most other ways are just hiding the context switching costs and complicating monitoring IMO.

comment 8mo ago · link · parent

I like Node.js' simple and fully isolated concurrency model. You shouldn't be blocking the main event loop for 30 seconds! The main event loop is not intended to be used for heavy processing.

You can just set up a separate child process for that. The main event loop which handles connections should just co-ordinate and delegate work to other programs and processes. It can await for them to complete asynchronously; that way the event loop is not blocked.

I recall people have been able to get up to around a million (idle) WebSocket connections handled by a single process.

I was able to comfortably get 20k concurrent sockets per process each churning out 1 outbound message every 3 to 5 seconds (randomized to spread out the load).

It is a good thing that Node.js forces developers to think about this because most other engines which try to hide this complexity tend to impose a significant hidden cost on the server in the form of context switching... With Node.js, there is no such cost, your process can basically have a whole CPU core for itself and it can orchestrate other processes in a maximally efficient way if you write your code correctly... Which Node.js makes very easy to do. Spawning child processes and communicating with them in Node.js is a breeze.

comment 8mo ago · link · parent

I built it up in parts and brought the parts together over time. SocketCluster has over 6k stars on GitHub. https://github.com/socketCluster/socketcluster

Saasufy itself isn't open source. I'm planning to sell licenses of the code (a limited number of them to make it scarce). SocketCluster is a core component of Saasufy. The goal did evolve slightly; originally, it was to make it easier to build full stack applications. Now it actually lets you build entire full stack apps without code. That bigger goal has been achieved. I have some videos linked from the Docs page showing how it works.

But yes, I'm a bit paranoid about my situation. I do feel like my work is suppressed by algorithms. Things feel very different for me now than they did before in terms of finding users. It's really hard to find people to try my work. Difficult even to convince them to watch a 10 minute video. Though I guess many people are in the same boat right?

comment 8mo ago · link · parent

My current project is the culmination 15 years of software development.

I started out building a full stack framework like Meteor framework (though I started before Meteor framework was created in 2012 and long before Next.js).

Then I ported it to to Node.js because I saw an advantage to having the same language on the frontend and backend.

Then I noticed that developers like to mix and match different libraries/modules and this was a necessity. The whole idea of a cohesive full stack framework didn't make sense for most software. So I extracted the most essential part of it that people liked and this became SocketCluster. It got a fair amount of traction in the early days.

At the time, some people might have thought SocketCluster was trying to be a more scalable copycat of Socket.io but actually I had been working on it for several years by that point. I just made the API similar when I extracted it for better compatibility with Socket.io but it had some additional features.

A few years ago, I ended up building a serverless low-code/no-code CRUD platform which removes the need for a custom backend and it can be used with LLMs directly (you can give them the API key to access the control panel). It can define the whole data schema for you. I've built some complex apps with it to fully prove the concept with advanced search functionality (including indexing with a million records).

I've made some technical decisions which will look insane to most developers but are crucial and based on 15 years of experience, carefully evaluating tradeoffs and actual testing with complex applications. For example my platform only has 3 data types. String, Number and Boolean. The string type supports some additional constraints to allow it to be used to store any kind of data like lists, binary files (as base64)... Having just 3 types greatly simplifies spam prevention and schema validation. Makes it much easier for the user (or LLM) to reason about and produce a working, stable, bug-free solution.

That said I've been struggling to sell it because there are some popular well funded solutions on the market which look superficially similar or better. Of course they can't handle all the scenarios, they're more complex, less secure, don't scale, require far more LLM tokens, lead to constant regressions when used with AI. It's just impossible to communicate those benefits to people because they will value a one-shotted pretty UI over all these other aspects.

You can check out https://saasufy.com/ if interested.

comment 8mo ago · link · parent

I find that skills work very well. The main SKILL file has an overview of all the capabilities of my platform at a high level and each section links to a more specific file which contains the full information with all possible parameters for that particular capability.

Then I have a troubleshooting file (also linked from the main SKILL file) which basically lists out all the 'gotchas' that are unique to my platform and thus the LLM may struggle with in complex scenarios.

After a lot of testing, I identified just 5 gotchas and wrote a short section for each one. The title of each section describes the issue and lists out possible causes with a brief explanation of the underlying mechanism and an example solution.

Adding the troubleshooting file was a game changer.

If it runs into a tricky issue, it checks that troubleshooting file. It's highly effective. It made the whole experience seamless and foolproof.

My platform was designed to reduce applications down to HTML tags which stream data to each other so the goal is low token count and no-debugging.

I basically replaced debugging with troubleshooting; the 5 cases I mentioned are literally all that was left. It seems to be able to quickly assemble any app without bugs now.

The 'gotchas' are not exactly bugs but more like "Why doesn't this value update in realtime?" kind of issues. They involve performance/scalability optimizations that the LLM needs to be aware of.

comment 8mo ago · link · parent

A no-code platform for building SaaS apps with AI (serverless): https://saasufy.com/

comment 8mo ago · link · parent

Google buried my popular open source project deep in its search results. It's a very niche technical field with niche keywords but it shows all the scams and paid services on the front page and my project is not even in the first 5 pages when I type exact keywords that are present in the page. It only shows my project when I type its exact name.

It feels like Google is actively discriminating against my project in its algorithms. At this point, I wouldn't be surprised if there is some code in the google algorithm which is something like if (untrustedDomain(domain)) score -= x and they probably have some highly paid 'engineer' maintaining this blacklist. It definitely feels like this.

comment 8mo ago · link · parent

The key is to stay hands-on. I go for the tech lead role.

Actually at my current company I'm co-lead of a team of 10 people. I've been CTO and also the sole team lead in the past but I was always hands-on coding.

I'm glad I have a co-lead at my current company; in fact, I'm the one who recommended to the big boss that he promote both of us. Normally, I'm the sole leader but in this company, we deal with corporate clients and so there is a fair amount of compliance work, team coordination and stakeholder management and also the project itself is very complex on the tech side. AI adds a lot of complexity. My co-lead is really good with coordination, planning, meetings, stakeholder management and alignment but at the same time he has less experience on the tech side so I have the last say on technical matters like architecture and choice of technologies and I'm in charge of general-purpose modules, configurations, migrations, data management...

I think staying hands-on is very important, especially now with LLMs. Managing complexity is itself a separate concern from managing people. There is a human/psychological component to managing complexity but it's different than pure time management and coordinating work based on priorities. On a project with 10+ people, with AI, the complexity can grow rapidly and so it needs to be managed.

comment 8mo ago · link · parent

Haha. I guess the BEAM people can nod down at me with contempt and I nod down at the Elixir folks.

comment 8mo ago · link · parent

The Node.js community had figured this out long before BEAM or even Elixir existed.

People tried to introduce threads to Node.js but there was push-back for the very reasons mentioned in this article and so we never got threads.

The JavaScript languages communities watch, nod, and go back to work.

comment 8mo ago · link · parent

Yeah well it's like money these days; having a $10 million net worth doesn't actually say much about a person; maybe it fell on their lap because they knew the right people or maybe they had to struggle to earn every cent. It's the same with GitHub stars.

Unfortunately, those who had it easy tend to get much more attention and are much more visible; attention is how they got there in the first place so of course there is not much merit behind their work. A lot of software tooling is a Potemkin village. It's over-hyped and developers/users are forced into it by their boss who happens to be an investor in the project founder's company.

It often seems like nobody from Millennial or Gen Z generations built any good popular software tool or library... It's like nothing innovative came out since the time of Linux, GNU and GIT... No competent software developers since John Carmack? It's not true of course, it's just that we are a heavily suppressed and manipulated generation. Firstly, we are demoralized, so there are less of us actually putting in the effort to build quality stuff, but even those who do, our work is often marginalized and covered up by algorithms. Often nipped in the bud.

We have to consider that Linus Torvalds didn't build Linux all by himself. Had the community not come together and made all these distros, today, nobody would even know what Linux is and Linus Torvalds would be a failed developer living in the shadow of Bill Gates and Steve Jobs.

1
456
11