New Tech: How We Prevent UTXO Bloat

Before you’ll be able to understand why Divi’s solution to the UTXO bloat problem is so cool, I’ll first explain to you what UTXOs are.

What are UTXOs?

UTXO stands for Unspent Transaction Output.

Divi is based on PIVX, which is based on Dash, which is based on Bitcoin. UTXOs are part of Bitcoin since the very beginning, and an inherent component of blockchain itself. It’s important to understand that blockchains like Bitcoin don’t have balances on them, unlike a traditional ledger would have. This will sound crazy to most people who hear it for the first time, but instead, every single transaction that’s ever happened, back from the beginning of time, is stored on each node’s hard drive, and when it’s needed to know a wallet’s balance, it adds up all the relevant transactions to arrive at the amount. Thus, a single wallet address balance will often be pieced together from left-over remnants of many older transactions. These unspent transaction outputs are called UTXOs.

In order for nodes to operate quickly, every single UTXO for the entire blockchain is stored not just on the hard drive, but also kept in RAM! And for a big blockchain like Bitcoin has, that’s a huge number of UTXOs. You can see how many that is here:

The Problem of UTXO Bloat

As of this moment, it’s over 49 million UTXOs that take up more than 2.6 GB of RAM. And this amount is growing.

Wallet engineers are expected to try to find strategies to reduce this “UTXO bloat” with smart practices, such as described in this fabulous article by Jameson Lopp, the creator of The Challenges of Optimizing UTXOs


Yet despite all these efforts, Bitcoin (and most cryptocurrencies) continue to have growing UTXO sets. This happens not just from new users and more transactions, but also every UTXO since the beginning of time, if left unspent, will be stored in the RAM of thousands of nodes around the world. This huge UTXO set slows down every node in every cryptocurrency network, resulting in wasted resources. While cryptocurrencies are chasing faster transaction times and searching for scaling solutions, forces like UTXO bloat are working against them.

Divi’s Solution

It turns out that Divi’s 100% PoS (Proof of Stake) system presents us with an opportunity that’s unavailable to PoW blockchains such as Bitcoin. From what I understand, something similar was done by Peercoin, and we've created our own version. (And as far as I know, this wasn't picked up by either Dash or PIVX.)

So what does it do? It's fairly simple actually. When a particular UTXO wins a stake, it will create a new UTXO that combines with as many smaller UTXOs as it can, up to 50,000 DIVI. And, it will do this without a fee.

Example UTXO Combining

For example, suppose you have an address that has 6 UTXOs in it, with 3,000, 20,000, 25,000, 30,000, 35,000 and 40,000 DIVI. They're all staking and the 20,000 one wins a stake (block reward). What you will be left with in that address is:

Four UTXOs with values: 48,456, 30,000, 35,000 and 40,000 DIVI. This is because the winning UTXO of 20,000 will add on the stake reward (456) and the smallest UTXOs it can, up to 50,000, which would be:

456 + 3,000 + 20,000 + 25,000 = 48,456

The coin age will also be reset to zero when this happens of course.

Also, to be very clear, the system makes a sorted list of all the UTXOs in that address, and will absorb them from the lowest up to the biggest, but not past 50,000. Keep in mind that winning stakes over 100,000 DIVI also split in half, so both systems are building UTXOs that trend towards 50,000 and then work their way up from there.

Benefits and Tips

Doing this will mean that our nodes will keep far fewer UTXOs in RAM, freeing system resources for other tasks, and ultimately we hope will help us process more data to improve our TPS (Transactions Per Second.) A high TPS is important for mass adoption of cryptocurrencies. Reducing the use of RAM in Divi's nodes also may help us achieve the goal of being able to run cloud-based Divi nodes on 1GB droplets instead of 2GB, which are half the cost.

Note that what this also means is that you can save some fees by staking your masternode awards. When they combine, there's no fee. But, if you want to send a transaction to someone that has dozens or hundreds of masternode rewards combined into a single transaction, then it will be far more bytes than a standard transaction, pushing the fee up to 100 DIVI, which is the maximum. If you're staking, then every time you win you'll get them combined for free and your transaction fees will stay very low.