# Analysis on the UTXO data tobe uploaded

We exported data using three methods:&#x20;

* bitcoin-utxo-dump
* electrumX
* rusty-blockparser

The first two were primarily used for UTXO export and comparison at block 839,999, while the latter was used to calculate burned BTCs. The results are as follows:

| Method            | Total BTC           | UTXO Count  |
| ----------------- | ------------------- | ----------- |
| Theoretical       | 19,687,500.00000000 | -           |
| bitcoin-utxo-dump | 19,687,280.49271483 | 176,944,794 |
| electrumX         | 19,687,280.49271483 | 176,944,794 |

The discrepancy between the theoretical output and the tool-exported quantity is primarily due to:

1. The 50 BTC produced in the genesis block cannot be used. Tools ignore processing of block 0.
2. Bitcoin code bugs resulted in coinbase outputs less than the theoretical value, totaling 128.95502904 BTC.
3. OP\_RETURN burns, totaling 40.55225613 BTC.

These factors account for a total of 219.50728517 BTC.

<mark style="color:red;">Theoretical value</mark> = <mark style="color:red;">Genesis block</mark> + <mark style="color:red;">Code bug burns</mark> + <mark style="color:red;">OP\_RETURN burns</mark> + <mark style="color:red;">Exported data</mark>&#x20;

<mark style="color:red;">19,687,500</mark>             = <mark style="color:red;">50</mark> + <mark style="color:red;">128.95502904</mark> + <mark style="color:red;">40.55225613</mark> +<mark style="color:red;">19,687,280.49271483</mark>

**This confirms that our exported data is reasonable.**

Below, we detail the source of each data point.

### BTC Theoretical Output

* 1st Halving: 210,000 × 50 = 10,500,000 BTC
* 2nd Halving: 210,000 × 25 = 5,250,000 BTC
* 3rd Halving: 210,000 × 12.5 = 2,625,000 BTC
* 4th Halving: 210,000 × 6.25 = 1,312,500 BTC

Total BTC generated up to block 839,999: 10,500,000 + 5,250,000 + 2,625,000 + 1,312,500 = 19,687,500

### Unusable Genesis Block

Although the genesis block points to a URL written in its code, this link displayed an error message when activated. The system couldn't locate the first 50 BTC transaction in the database, and spending transactions were rejected. Consequently, the original Bitcoin client doesn't consider the genesis block transaction as a "real transaction." —>[Reference Links](https://www.investopedia.com/terms/g/genesis-block.asp)

### UTXO Dataset

We established a [bitcoind](https://github.com/bitcoin/bitcoin) full node, then indexed and processed its data using electrumX or bitcoin-utxo-dump tools.

* For electrumX usage, refer to[ https://github.com/exsat-network/electrumx](https://github.com/exsat-network/electrumx)
* For bitcoin-utxo-dump usage, refer to <https://github.com/exsat-network/bitcoin-utxo-dump>

### Bitcoin Code Bug Burns

Several [events](https://bitcoin.stackexchange.com/questions/38994/will-there-be-21-million-bitcoins-eventually/38998#38998) have led to coinbase outputs less than the theoretical value due to bugs:

1. Duplicate txid coinbase, fixed in BIP30: 100 BTC
2. Block 124724 intentionally claimed 0.00000001 BTC less, but accidentally didn't claim fees: 0.01000001 BTC
3. Blocks 162705 and 169899 bug: 9.66184623 BTC
4. Blocks 180324 and 249185 claimed less than allowed: 0.52584193 BTC
5. Block 501726: Approximately 12.5 BTC
6. Block 526591: Approximately 6.25 BTC

### Tools & Data

We modified electrumX slightly, mainly in data structure or API, without changing core UTXO calculation logic. Since  rusty-blockparser does not support Pay2MultiSig type addresses, it is not used to export the UTXO. We modified it to include coinbase output discrepancy records and OP\_RETURN burn calculations. Bitcoin-utxo-dump and electrumX were used for UTXO export and comparison at block 839,999, while rusty-blockparser was used to calculate burned BTCs.Because bitcoin-utxo-dump cannot specify an end block, Spider Pool also instructed to modify [bitcoind](https://github.com/exsat-network/bitcoin) to stop at block 839999. specifically to cooperate with bitcoin-utxo-dump to obtain data.

#### References of tools:

1. rusty-blockparser:[ ](https://github.com/seancheen/rusty-blockparser)<https://github.com/exsat-network/rusty-blockparser>
2. electrumx:[ https://github.com/exsat-network/electrumx](https://github.com/exsat-network/electrumx)
3. bitcoin-utxo-dump:[ ](https://github.com/in3rsha/bitcoin-utxo-dump)<https://github.com/exsat-network/bitcoin-utxo-dump>
4. Bitcoind(modified)  <https://github.com/exsat-network/bitcoin>

#### References of data：

1. [Code bug coinbase burn dataset](https://s3.amazonaws.com/exsat.initialize.data/coinbase_burned.csv.zip)
2. [OP\_RETURN burn dataset](https://s3.amazonaws.com/exsat.initialize.data/opreturn_burned_lt_840000.csv.zip)
