“Re-Peg” is a more compact form of “The Terra Problem.” Terra’s native coins are pegged to the International Monetary Fund’s Special Drawing Rights, which you can find in the docs as
The IMF SDR contains 5 primary currencies: USD, EUR, GBP, JPY, and RMB. These represent the USA, Eurozone, the UK, Japan, and China respectively. The SDR isn’t a currency, it’s just a tool used by the IMF for units-of-account. The IMF is made up of 190 countries. Fun fact: the Interpol contains 194!
You can read more of what Terra’s actually pegged to here: IMF Special Drawing Rights
Like any normal discussion on the internet, none of what I’m writing is financial advice or a guarantee. Do your own research – I’m not liable for your decisions here.
0x. Some Notes
This document only mentions forking, merging, reverse splits, and wLUNA as-is relevant. There’s no proposal here asking for money – just something for you all to think about and focus on.
1. Summary of Proposal
There is no proposal, because this issue cannot be solved by one proposal – the only ways it can be solved in one proposal is if:
- everyone agrees to a fork (“the new coin way”), or
- everyone agrees to a merge (“the wLUNA/LUNA way”), or
- everyone votes to expropriate everyone else’s money (take it from them)
This, historically, has not passed voting, and for good reason. It is, in fact, possible to make all three work, with exceptional cost – which is why the Escrowed Buyback does not work here.
In order to re-peg USTC, you need a few things:
- a lot of money – which also needs to come in often and move around
- good security – namely, a good oracle network
- a good algorithm – including the ability to hold peg
Without money, security, and good algorithms, the user-base will use each other for exit liquidity – a hot potato, if you will.
So, this Agora post serves to highlight how we can support these, without giving one person all of the hot potatoes:
- money – fund things that make more money than we put in (it can even be off-chain)
- security – fund validators and security specialists, more robust finders, etc
- algorithms – fund quant engineers, research analysts, etc
You can do this on a contract basis. If you like their work, extend their contract. That is how Layer-1 works right now.
However, Layer-1 is a maintenance project. For those who are unaware, Terra suffers from an intentional, backwards-incompatible “issue.”
This purposeful design flaw allows the generation of QR codes on the blockchain, which need to be regenerated often. However, when mixed with a user base, this gets dangerous. Imagine if anytime someone scanned a QR code at WalMart, they took money out of your wallet – oops!
That is why some of these things, like security, don’t make money. They are necessary expenses, like Layer-1 maintenance. One example we could do is to partition all addresses containing a
q, b, i, o (as outlined in BIP0173) and transfer user funds over to a new address, if they wish.
Lastly, money comes from a variety of ways – work, primarily. One of the easiest ways we can drive money to LUNC is through Business Development Relations (BizDevRel), which can involve working with other crypto businesses (like DAOs) or real-world businesses (DAOs, but IRL). A few examples:
- list assets on other exchanges, like Kujira
- ask crypto exchanges, like Osmosis, to implement the burn tax, while allowing them to keep the
- subsidize DAOs, like Aave, to relist Ethereum-based assets with no burn tax, in exchange for a share of their native governance token
Most of these cost money.
2. The Important Stuff
- Notes About the Peg
There’s no peg on Terra Classic – well, depending on which wallet you use. If you use Station, Market Swap is disabled. I am unsure if Rebel Station allows market swaps. You may be able to manually incur a market swap.
However, even prior, market swaps were sent to a DEX – Terraswap or Astroport. These were routed through user-provided liquidity, not network-provided liquidity. In that sense, you are always paying fair price for LUNC or USTC at any given time.
- Notes About the Peg Price
If LFG has 2.857b of the supply out of 9.8b, they control 28.57% of the supply – and peg price.
The Terra Classic Community owns roughly 0.775b in the Oracle Pool and roughly 0.315b in the Community Pool. This is about 1.09b units, or 11.12% of the supply – and therefore, the peg price.
The peg price is determined by the the amount of supply controlled. So, if the community owns 100% of the supply, or 9.8b units, USTC’s value can equal $1.00. For a certain period of time, that is.
It’s a lot like trading coins to dollars. If I have 100 pennies, I can trade it for 1 dollar. (At least in the US.) Those coins are made from precious metals, or more accurately, alloys, which are a mixture of metals. (More on this later.)
In this sense, USTC can never be re-pegged permanently. The only ways around this are a merge with LUNA, fork to a new chain, expropriate assets…or, my favorite, to make so much money that it stays at or above a dollar.
- Contributing to the Network
It is more beneficial to keep the Network as lightweight as possible – no dApps, just money remittance. This is a sharp focus on the following three modules in Terra:
Focusing on the Market Module was the intention of the Ziggy ERM (which now stands for Exchange Rate Multiprocessor). This is an open-source contribution to a public good, and anyone can apply for a grant to work on it, though none have done so to-date.
The Oracle is much simpler – start running a validating agency, or just integrate with Chainlink. Band Protocol was used for Mirror Protocol, but as we know, that was exploited.
The Treasury was first filled through seigniorage, or minting. We can fill this now by “de-minting” – or more popularly, burning. The fancy word for this is demurrage, particularly in the context of melting coins back to bullion (precious metals), as the Bank of England did centuries ago. Here is a paper which describes how we can integrate one aspect into the Market Module.
The Treasury controls monetary policy levers. It would be prudent to automate these.
- Pegging to a Bitcoin Standard
Some have suggested to moving to a Bitcoin standard. This is a wise idea, especially considering what Taproot and the Lightning Network are trying to do – bring in mass adoption.
Lucky for you, we are already there.
Generic Peg Formula:
...047619repeats (derived from
0.0001 UST– this is derived from
LUNA / LUNC
There is a modicum of deviance from this generic formula. For example, LUNC’s price is currently
~0.000125, while LUNA’s price is
~1.40, in USD. Using the above formula, and translating it to the peg target of 1 satoshi:
1k = 0.04610971 BTC
10m = 0.04171288 BTC
This is roughly a
0.005 BTC difference between the two peg limits. However, both are underneath the peg target on the same scale –
0.047619 BTC. In general, we can think this to mean that both LUNC and LUNA are oversold (or for TA traders, the RSI is very, very low).
Keep in mind many stablecoins use 4 significant digits – USTC is a bit unique in that it’s developed on Cosmos, so it uses 6 significant digits. This means that, in order to get 1 USTC, you would divide the Ratio by 100 – resulting in
In this sense, all USTC is, is a representation of “coins” on the Terra network.
This is why a 100-to-1 opt-in reverse split works, at least for USTC – because you are trading 100 pennies for 1 dollar. However, the only hitch to this is that most people have different ideas about what the coins represent – debt? Fair value?
3. The Bittersweet Truth
These things take time. They also take money. I do most of my research for free, but my research relies on other developers acting on them to enact. I spend way too much time trying to explain to people the simple things that make up the network, and why they are important – but I am willing to do it, because we all start somewhere.
If you want this thing to go faster, then you need to fund more than just L1. Again, two options:
- Make so much money that your eyes bleed.
- Develop the L1 market module so that arbitrage is always happening.
Here’s another hard truth: the ship’s leaky. Introducing dApps will make it much more difficult to retain funds. No DEXs are needed – develop the market module. No Anchor is needed – contributing regional fiat to the Community Pool directly would be like charitable donations. Burning LUNC would be like manually withholding taxes.
The Bittersweet Truth is that there is no easy route. The community can ignore problems – they won’t go away. If we want to re-peg – or more accurately, recapture the lost value – then we have to focus efforts on the three modules. (Treasury, Oracle, Market.)
4. The Ziggy ERM
The Ziggy ERM is basically like a computer processor, except the only thing it’s computing is money. You need to pay people to work on this, or hope someone will do it for free.
Anything that isn’t involved in the basic relaying of money is a dud. No protocols. Buy out existing DEX assets and implement them natively as part of the Luna pool (ie, LUNC). Currently, I am working on Weighted Index Swaps – this will allow LUNC to act as a robust liquidity hub for the entire cryptomarket, as well as multiple global markets.
This is an incredible opportunity to enable LUNC as a DeFi bank, one that handles money across borders without bias and without the impediment of human corruption.
Out of these, the most important one to develop at this time is the Market module. We can enable temporary saving by contributing to the community pool as a donation (charity) mechanic. This is a popular way to reduce taxes in the modern US. (exemptions)
5. What Happens if No Progress is Made on These Fronts
You’ll keep bleeding money and be forced to merge over time – not necessarily to LUNA.
6. Next Steps
I still contribute to the algorithm’s development. I will continue looking for ways to bring on money to the network – even if it promptly flows out again despite multitudinous warnings.
It’s worth a shot.
As for the community, here’s a summary:
- Develop a robust Market Module.
- Allow interim saving by enabling charitable donations to the Community Pool.
- Integrate with honest Oracle services.
- Begin partitioning addresses that suffer from
7. The Terraport Problem
Terraport’s weakness likely lies in a number of addresses:
terra1pu4jxet2ndtftqmwsrgfsznczrcea3mt6ugcnr(also admin, marketing)
The issue with the previous segwit (“segregated witness”) addresses is that you can insert any number of
q letters before a
p letter, and the next six letters will still pass as a checksum. (A developer may correct me if I am wrong here.)
In this case, Terraport’s weakness is defined not in tracing the ending of the addresses, but wherever you see the first
p, as checksums:
admin, marketing, minter:
If this, for example, was a 3/5 multisig, then the two addresses not containing
p (but one containing
q) would be unable to veto a simple QR code generated by this error. Scan 3 times, and the money is gone.
Note the Terraport Router Contract:
Note here the string
terra1ay0rwsx30kjzqp. Its checksum
wdsg72 is not invalidated when modified with any amount of
q characters inserted immediately preceding the
This is fixed in BIP0350 by replacing
0x2bc830a3. That is, the router address would read:
Again, the reason this is important is because of things like QR code generation, which allow quick and easy payments or info-scanning (like your local restaurant’s menu).
8. The Final Problem (for now)
There’s an additional problem created by this, however, which is that some of you probably have an address with a
q) in it. For example, Onyx’s Bloc address is
terra14n2yan5f8t4zlh3jz3vr5sp4a6htvrwrqqnrzl. At one point, this address contained over 55k of various Terra currencies in it – it now only contains CW20 tokens, which I cannot send.
If someone can somehow inject code that re-routes money from my wallet to another, simply by adding a QR code (eg
terra14n2yan5f8t4zlh3jz3vr5sqqqqqqqqqqqqqqqqqqqqp4a6htvrwrqqnrzl), then I am susceptible to my money accidentally being taken. Imagine someone goes to their favorite restaurant, scans the menu, and when they do, you’ve just lost $55k. Woops!
There exists a potential way to resolve this issue via BIP0044, which deals with Pay-to-Public-Key-Hash (P2PKH) addresses.
Constant 0 is used for external chain and constant 1 for internal chain (also known as change addresses). External chain is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal chain is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change.
Public derivation is used at this level.
When the master seed is imported from an external source the software should start to discover the accounts in the following manner:
- derive the first account’s node (index = 0)
- derive the external chain node of this account
- scan addresses of the external chain; respect the gap limit described below
- if no transactions are found on the external chain, stop discovery
- if there are some transactions, increase the account index and go to step 1
This algorithm is successful because software should disallow creation of new accounts if previous one has no transaction history, as described in chapter “Account” above.
Please note that the algorithm works with the transaction history, not account balances, so you can have an account with 0 total coins and the algorithm will still continue with discovery.
I have not yet confirmed this, but it seems that addresses are separated into
Witness levels – generally speaking,
0 represents external chain and
1 represents “change addresses”. In short, you can probably think of it like this: making a wallet on index 0 is public. Making a wallet on any other index is private (because of change addresses).
So, it’s a little like this…putting money on index 0 is like providing liquidity for the entire market. Putting money on index 1 is like riding the vortex – if you don’t know how to commandeer your ship, you’ll lose your money to pirates.
Don’t forget Point #5. That’s all.