Schrodinger's Claude: A chat is placed inside a sandbox, and it is both:
1. Littering `typeof value === "object"` bullshit at every turn.
2. Crushing query latency with autistic `EXPLAIN ANALYZE` dark magick.
During my daily JavaScript audit (it's crazy out there), I had this realization: maybe the "browser wallet" convention with crypto apps was a bad choice.
It sticks a 3rd-party vendor in the middle of what matters the most.
But the bigger problem is the jungle of random software packages that invade your javascript. If one of them gets malicious, or had a hidden bug all along, it's not easy patch in time.
Sure it's a fun UX to have a "sign and send transaction" right there behind a bright green button. But it's a very bad UX when that transaction gets re-written to send tokens to North Korea.
How about we decouple crypto webapps and crypto transactions?
Crypto apps could simply be "read-only". They prepare a transaction, hand it to the user in cleartext, and stop there. Then the user can read it, sign it, and send it however they want.
To make this convenient, imagine frozen, open-source, diamond-hard websites that *only* do the critical sign-and-send. With a minimal, shrink-wrapped supply chain, this tactic drastically limits attack vectors.
Compartmentalize "read" from "write." It's an old system design principle (#CQRS). You can have 10,000 branded apps which all delegate "sign-and-send" to a select few audited websites that do their one job very well.
If this practice became normalized, I'd wager we'd see far fewer wallet-based hacks. What needs to happen is a new cultural norm: that apps just display cleartext transaction messages rather than hiding them in the background.
I'm experimenting with a flow for this idea here. Just might start using it soon.
https://t.co/Pl3rV7unDN
Dear MANTRA community,
As a direct result of the ongoing Web3Auth & Keplr wallet/private key exploit, we have received numerous complaints from the community about the hackers unbonding their staked MANTRA tokens without their consent. This comes after any liquid MANTRA tokens have already been stolen. As you have seen in Gov Prop 41, we have already frozen several of the hackers’ wallets as we support @Web3Auth & @keplrwallet in their recovery efforts.
In an attempt to support our community and anyone that may be under attack by these hackers, we are putting through an emergency pause on all unbonding transactions for 7 days, as we aim to avoid any further damage. We will review this unbonding pause in 7 days, and reserve the right to make further pauses. We don’t take this action lightly, however, we believe this is in the best interest of our community and is necessary to protect you from further damage due to this upstream exploit.
To be clear, this does NOT freeze unbondings which are already in progress. You will need to redelegate before the 8-day unbonding process completes to prevent the hackers from claiming them and sending them to an address you don’t control. Once you have relegated, the subsequent unbonding will be paused until we decide to discontinue the unbonding freeze.
We will continue to keep the community abreast of the ongoing situation.
txid:
8ce659501371072441ab336681e55794719ae0ad155b11e7269acbc527c139e8
For years I've been tinkering on how to do a tree-shaped incentive algorithm that suits a public blockchain where fake ID is free and spam cheap.
After many dead-ends, where simulations found ways to game it and break it, I think this model could hold up.
I wanted something that is at least as scalable & stable as Bitcoin mining. But whereas mining incentivizes monopolies, a good referral program must incentivize recruiting genuinely new participants who have no reason to collude.
Like most tough problems, it helps to turn it upside down.
The trick here is to give potential recruits bargaining power when they shop for referral links.
We've published an idea for a new kind of referral system. One that is tailored to operate on public blockchains.
It addresses two of the most persistent problems with referral codes:
1. Why would a recruit pick this code over that one?
2. Why not just recruit yourself and pocket the incentive?
Referral codes are typically fungible because they carry no differentiated incentive. What happens when referrals become a market in which participants compete to offer access to scarce positions? What if we turn the recruit into a discerning shopper?
Mayflower’s answer is to make it a market of nodes in a network. It is a finite-height tree, where referral credit flows upwards and the competitive lure to join flows downwards. The geometry of the tree ensures that all the referral credit sums to a normalized 100%, and splitting your stake among multiple accounts creates no additional credits.
Bootstrap
A good referral system needs to start with one basic problem: why join at all?
Oftentimes, you get offered something like “5% off your next purchase if you use the link PODCASTER_JOE at checkout.” The incentive to use someone’s link is paid by the company – essentially out of their marketing budget.
We can generalize this principle, and just say the referee receives some abstract “credits” for using a link (it does not matter what these “credits” mean for the surrounding system).
Mayflower’s Referral Network starts with that. In order to earn credits at all, you must be in the network. How many credits do you earn? We can generalize that, too. Let there be an arbitrary function of some other quantity. Call it “stake” or “skin in the game”.
Credits earned are proportional to stake.
Suppose Alice is alone in the network. She earns 100 credits from her stake.
Then Alice refers Bob, Charlie, and Derek. Bob, Charlie, and Derek wanted to join in order to start earning credits, and they each earned 10 credits.
Bob, Charlie, and Derek are “children” of Alice. What benefits Alice to refer them? Here is where the zero-sum geometry kicks in. Alice is entitled to 10% of the gross credits of her children. So Bob, Charlie, and Derek pocket 9 credits, and Alice receives the leftover. She earned 103. Well deserved, Alice.
Does this seem fair to Bob, Charlie, and Derek? Remember first that “credits” is an abstract quantity from the perspective of this algorithm. The important point is that the tree enforces a zero-sum distribution so that value does not “leak”. And anyway, Bob is now earning credits of his own.
To earn credits, you must be in the network. But that is not the only reason to join. There is another benefit: joining the network gives you the entitlement to recruit others.
Recursion & scale
Derek has connections.
Derek recruits Elon Musk.
Elon is quite wealthy, and has a very high stake. He earns 1000 credits gross. So, Derek gets rewarded for bringing in Elon, and receives a whopping 100 credit bonus (10% of 1000).
Here is the kicker: Derek would not be here were it not for Alice. Alice is in Elon’s lineage. And Alice gets a bonus from Elon, too. In fact, Alice benefits from everyone in her subtree. Anyone who has Alice as an ancestor adds up her credit earnings.
This recursive tree structure makes the referral network very interesting in its scale: if you refer people, and they refer people, you see real benefit. There is a reason to put yourself out there and attract people, just in case they might return the favor.
The competitive equilibrium is created not merely by scarcity, but by the fact that the prospective recruit has bargaining power. Maybe they know someone with deep pockets.
Game theory
Every game needs boundaries. There needs to be a limiting constraint. A powerful referral tree needs to gather everyone together into one tree, otherwise it would evaporate in a vacuum and not function like a connected tree.
So the tree has a finite height. At some point, you hit bottom, and the bottom layer cannot refer anyone else. This bottom layer would still earn credits from their stake, but that’s it.
With this constraint, we now have a market. Different “levels” in the tree have different value. The top of the tree has the most value, because it has the most depth to grow beneath it. A layer in the middle could still attract recruits-of-recruits, but with less room.
Consequently, not all referral codes are equal. A higher-level link is more desirable. There is competition along the vertical axis. So much so, that recruits would be willing to pay to join. Supply meets demand.
We have one last problem. What about “horizontal competition”? So far, the only differentiation between links is their vertical height, and thus all links at the same level are effectively fungible. The demand for them is indistinguishable.
This algorithm solves for horizontal competition with one last feature: mutualized earnings. A node can choose to share its credits among its children. If Alice chooses to share, the bonus she earns from Elon Musk (her “grand-child”) is made available to Bob & Charlie (Elon’s “uncle” nodes). Neither Bob nor Charlie recruited Elon – but now they are benefitting from having him in the family.
If Alice keeps sharing, she becomes a very attractive referral code to use. It looks like a form of “passive income” for her recruits. She is now competing with other nodes on her same level. And with that, the market dynamic is complete on both the vertical & horizontal axes of this finite tree.
Blockchain-native
In the blockchain environment, where the cost of spam and fake identity is near zero, we think this approach to referrals could achieve a rare quality of rationality. This algorithm could be interesting well beyond how Mayflower plans on using it to incentivize participation in its protocol. It is similar in spirit to how blockchains themselves incentivize “honesty” and "reliability" between databases. In Mayflower's case, the referral game incentivizes “stake” and “growth” between economic agents.
In an ordinary referral system, the referrer is rewarded for finding a recruit. In this system, the referrer must also compete to be chosen by the recruit. Markets require both directions.
For more details, check out the specification and implementation on GitHub. It's open-source, under development, and free to modify.
Code and examples:
https://t.co/f4rBw3KQge
There are teams that want the AVM on EVM, so they can use it to build their products (like how https://t.co/z4WDPDm5Sg uses the AVM on Solana).
There are two streams running in tandem:
1. Unify Nirvana + Samsara in a single experience called Mayflower.
2. Spread the Mayflower "Operating System" so other people can build their own products on these pure defi primitives.
Putting the AVM on EVM chains is so more separate teams can use the tech.
Been writing Solidity more and more.
It sure has its quirks, but . . .
I find myself actually enjoying it. For the first time in years. Hm.
I think the key to happiness is discipline.
As with JavaScript, just ignore 80% of the language, write pure libraries, and keep it simple.
"or else what the hell is the point?"
Consensus put crypto's weird identity crisis on full-frontal display.
Banks embracing blockchains, blockchains embracing banks. But they're uneasy bedfellows.
"DeFi" doesn't make much sense if it isn't pure.
Custodial finance doesn't want to let go of central control.
At 18 years of age, the blockchain industry is wondering out loud what it all means.
🗺️ @IOHK_Charles: "We're not here to go make the people who blew up the world economy in 2008 even bigger and even richer. We're here to change the world."
The Cardano founder reminds the room what crypto was for, on the @Anchorage Digital Mainstage at @consensus2026.
I left a little gift for you. Do not open til Christmas 40,000,027 AD.
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNjcnlwdCAxZkFiRzhPU24vU0pnQy8x
YWlBY1R3IDE4CnN6UFFTcVg0VTF4K0xDZTlpYVNZUnJQQmpQZWxySUNQMkdlYXhu
Z2MyNHcKLS0tIDBvTjQwbFE4bTgydTVwV1VZUWg5dG5OQXVNWTVHdFE4RzZrR2xT
eUt4aHcKLevHi4k80grNqdAU103UrMNX5h++THwl+ReCwzOfDHMwj4AuCW2R5qGz
xpNdWWX1eodU309FXoNCgw==
-----END AGE ENCRYPTED FILE-----
This is what "paper keys" should look like.
And this is how you can store them.
The zen of key management is: there is no "key" to steal or to lose.
Just encrypt, and exhale.
Otherwise:
If you try to lock down a plaintext key, you're in a double bind:
1. If the only copy of your key is in the fire-proof safe that got washed away in a flood, game over.
2. If the key gets stolen, game over.
What a constant-anxiety cocktail.
But if the key is encrypted? Well, it's pretty hard for me to lose it now that I put it on Twitter. And those would-be key thieves can have at it all they want.
Whenever I need to use this key, I'll just type in the password, and be back to slinging my stack of CryptoKitties NFTs. Oh - did I just give away the surprise?
But where is the "actual" key? No where. Not in a safe. Not in a password manager. Not etched in platinum.
There is nothing to leak, and nothing to misplace.
--
If you got yourself a Ledger "hardware wallet", you'll see they ship it with a little piece of paper that has the plaintext key written on it.
(Just typing that last sentence makes me want to pull my hair out)
Now, my brother, what do you do with this paper? Hide it? If the Ledger bricks (which I've seen happen) and the paper gets lost/stolen (which everyone has seen happen), you're done for.
The fragility of that method is nerve wracking to the extreme.
Here is how to reduce your key management anxiety dramatically:
1. Create an encryption key. This is your Master Key, and new best friend.
2. Encrypt that encryption key with a strong password.
3. Shred all remnants of the plaintext Master Key.
4. Now use your encrypted Master Key to encrypt all your "wallet private keys". It's easy: type in the password to decrypt the Master Key, and use that to encrypt all your "private keys."
5. Shred all remnants of your plaintext private keys.
6. Whenever you need to use your private key to sign something, reverse the process: decrypt the Master Key to decrypt the private key, and sign the thing.
Diversify and make redundant to taste. Store copies of your encrypted private keys. Store copies of your encrypted Master Key. However much or little you want. As long as you have a good password, it doesn't really matter if it leaks.
In one line:
The key to storing keys is encrypt them with an encrypted key.
Tip #1: pretend your program never heard of "Solana".
That's it. Make as much code as possible with no reference to Solana / Anchor / tokens / blockchain etc.
Ideally, the program is contained entirely in its own library crate. Nary a single "Clock::get()?" or "anchor_spl::" reference in sight.
This is the classic programmer's adage: "functional core, imperative shell."
The Solana stuff (reading from state, making CPI calls, writing to state) is a thin crust surrounding the bulk of the real program.
When all the imperative junk is distilled out, what remains behind is a pure function. The program is simply a calculator that takes in some data and returns some other data. It doesn't "do" anything. That means it decomposes into many more pure functions, which can all be bench-tested and proven is isolation. If each function is correct, then the program is correct.
The "functional core" defines its own input types, runs a computation on them, and defines its own output types. What should the output value look like? An either/or:
1. Custom error, or
2. Tuple of: return value, list of commands.
The "imperative shell" is what "handles" things. It takes the list of commands ("log this string", "invoke that 3rd-party program") and executes them. The commands are the "side-effects" that need to be done in this transaction. Here is where an actual Solana Virtual Machine finally makes its entrance. Side-effect handlers need the VM in order to be tested.
If done well, over 90% of your tests don't even mention "Solana." They mostly just test pure calculations. If testing feels easy, fast, and fun, that's a good sign the code is well organized.
Not only does this make your core easy to reason about. But you can also reason about the transaction's effects. "Commands" are just values. That means you can effortlessly prove the list of commands are exactly what they should be -- without ever running them!
The anatomy of a Solana program cashes out like this:
1. (Imperative Shell pt. 1) Read, sanitize, marshal data from accounts & inputs.
2. (Functional Core) Calculate an output value from an input value.
3. (Imperative Shell pt. 2) Do the side-effects.
When it comes to Solana, a "side-effect" is pretty much just 1 of 3 possible things:
1. Log some bytes
2. Mutate an account
3. Invoke a program
Keep these out of the core, and testing becomes a joy. In the unfortunate case where you must have control-flow based on the result of a CPI call, then that is just a joint in your overall program. Now you have 2 programs on either side of that call, and can just repeat the 1-2-3 steps of "read, calculate, do effects". Test & prove that new program on its own.
Staying diligent might feel hard at first, but it pays dividends in the long term.
Remember the wise words of Spoon Boy from the Matrix:
"Do not try and bend the spoon. That's impossible. Instead... only try to realize the truth... there is no spoon."
Write programs to make Spoon Boy proud.
"There is no Solana."
The nice thing about programs that are just math is that you can prove they're correct. Publishing that proof for the AVM is top of mind.
I've had my share of experience working with high-stakes financial code over the years. I still sometimes wake up at 3am to go triple check a fuzz test I wrote 5 months ago because in my dreams I can't exactly remember the invariants it covers. The invariant was there, of course it was there, ok . . . and then it's back to sack.
Paranoia is an occupational hazard in this line. But, I've learned there are ways to mitigate the symptoms with good habits.
I'm making a guide with practical tips on how to write correct programs for Solana. Sharing my favorite programming tip below: