# XenBlocks PoW

PoW mining accessible to everyone.

## What is XenBLOCKs?

XenBlocks serve as the Proof of Work (PoW) component of the X1 network, featuring a decentralized mining process like Bitcoin. Miners solve a cryptographic puzzle by finding hashes that contain "XEN11". Successful identification of such a hash rewards the miner with XNM.

Central to its design is the cryptographic hashing algorithm Argon2, known for being memory-hard and ensuring fair mining. As the network's overall hash power grows, the mechanism adjusts to reduce individual miners' hash power, decoupling mining intensity from energy consumption by shifting the computational burden to memory. This not only deters ASIC mining but also renders XenBlocks mining more accessible, allowing for the use of commonplace GPUs.

As the collective hash power of the network rises, XenBlocks' built-in difficulty adjustment mechanism reduces each miner's hash power, effectively decoupling the growth in mining activity from an increase in energy consumption. This shift offloads computational demands onto memory, thereby making ASIC mining futile and ensuring ASIC resistance due to the memory-hard nature of the algorithm.

XenBlocks, a Proof of Work (PoW) system, is designed with lower barriers to entry, making it accessible to a wider audience and serving as an effective onboarding tool for newcomers to cryptocurrency.

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FMqJ87BVI9HcnXmnOhMN0%2FPoW-2.png?alt=media&amp;token=7595f1a3-eb1a-4a40-83ca-e9d1b73b314b" alt=""><figcaption></figcaption></figure>

Typically, new users face a daunting journey through centralized exchanges that require extensive Know Your Customer (KYC) procedures. This not only compromises their privacy but also introduces them to crypto without the fundamental principle of self-custody, which is highly valued within the Xen community. Moreover, the process of depositing funds from traditional banks into these exchanges often takes days.

In contrast, mining XNM offers an almost instantaneous reward for successfully validating a XenBlock, directly providing users with self-custody of their digital assets. This method introduces users to the world of cryptocurrency within minutes, bypassing the privacy compromises and delays associated with traditional onboarding processes through centralized exchanges.

Join the XenBlocks community:

{% embed url="<https://t.me/+yDcqqTGMNC4yNjdj>" %}

{% embed url="<https://www.youtube.com/watch?v=RyxKnK5NiBY&t=1s>" %}


# X1 Fiat on-ramp

The most efficient way to enter crypto.

## **Traditional on-ramp**

Onboarding cryptocurrency via exchange platforms can be overly complicated, demanding significant compromises in terms of time and privacy. Typically, to start with cryptocurrency, users go through a Centralized Exchange (CEX). This process requires users to complete Know Your Customer (KYC) procedures, sacrificing their privacy. Bank transfers for funding the account might take several days. For users to achieve self-custody of their funds, they must convert fiat currency to cryptocurrency and then transfer it to a self-custodial wallet.

Users can also convert fiat to crypto through web3 wallets using service providers, though this often involves KYC verification as well. Similar on-ramping issues exist with other PoW systems like Bitcoin, but most don't utilize a memory-hard algorithm, leading to the dominance of ASIC miners. In contrast, X1's PoW approach is designed to be more democratic and accessible.

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FVPxr6vCbUSLrdPN3U3JZ%2FFiat%20onramp.png?alt=media&amp;token=3cb9cf1c-46b6-4163-9aa1-d2cca580a44e" alt=""><figcaption></figcaption></figure>

## X1 PoW on-ramp

The X1 PoW on-ramp offers a streamlined, more accessible method that could facilitate broader adoption by simplifying entry into the crypto ecosystem.

With the X1 Proof of Work (PoW) on-ramp, users have a simpler process:

1. Create an account on a GPU rental marketplace.
2. Fund the account with crypto or by credit card.
3. Deploy a simple one-line script via terminal or through a webpage.
4. Start earning XNM immediately, which can then be hodled or staked for XNT rewards.

There's no minimum investment required; GPUs can be rented for just a few cents per hour without transaction fees. Additionally, users have the option to purchase GPUs and remain completely anonymous.

{% content-ref url="/pages/qfd7jyUuTlKzbSUhv6N4" %}
[How to mine XenBlocks](https://docs.xenblocks.io/mining/how-to-mine-xenblocks)
{% endcontent-ref %}


# Mining XNM with XenBlocks

## Mining process

XNM serves as the incentive token awarded for participating in the Proof of Work (PoW) mining process.

Hashing operations demand hardware with significant computational capabilities, such as GPUs. Miners have the option to purchase GPUs, which are well-suited for the memory-intensive cryptographic hashing algorithm [Argon2](https://docs.xenblocks.io/technicals/argon2), allowing for efficient mining even with mid-range GPUs. Alternatively, individuals can opt to rent GPUs at affordable rates—often just a few cents per hour—through platforms like vast.ai that facilitate access to shared GPU resources.&#x20;

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FMqJ87BVI9HcnXmnOhMN0%2FPoW-2.png?alt=media&amp;token=7595f1a3-eb1a-4a40-83ca-e9d1b73b314b" alt=""><figcaption></figcaption></figure>

To [begin mining](https://docs.xenblocks.io/mining/how-to-mine-xenblocks), users simply need to deploy the mining script and monitor its efficiency over time. An important metric for assessing mining efficiency is h/s/usd, which measures the number of hashes generated per second relative to the cost incurred. Upon successfully solving a hash and discovering a block, the X1 network confirms its validity and rewards the miner with XNM for each block found.&#x20;

Various community made tools have been made to help optimize the mining of XenBlocks. Here tr4vler made performance bot which plugs into your GPUs and monitor their performance over time.

<figure><img src="https://content.gitbook.com/content/nx1OAq8QF9aR2RQz7ACd/blobs/ydXqMmUlZqMUr5vZolq5/image.png" alt=""><figcaption></figcaption></figure>


# How to mine XenBlocks

There are various methods to mine XenBlocks.  Below are some step-by-step tutorials created by the community. All of them work, so follow a procedure you're comfortable with.

***

### **Smit's Vast.ai Template (Easy)**&#x20;

This is a template to use on vast.ai which makes it easy to mine XenBlocks. No command line interface required.&#x20;

{% embed url="<https://www.youtube.com/watch?v=i5IqHsE3u8Q&ab_channel=TreeCityWes>" %}
Tutorial created by Treecitywes
{% endembed %}

***

### **Woody's One-liner Mining Script (Intermediate)**

Using vast.ai and your local command line interface, you can start mining XenBlocks in 60 seconds! \
<https://github.com/woodysoil/xenblocksminer/releases/tag/v1.1>

{% embed url="<https://youtu.be/hpmYS3eHe6Q>" %}
Video tutorial created by Jozef of xen.pub
{% endembed %}

Another effective one-line mining script was created by XenArtist:\
<https://github.com/xenartist/OneLineXNMMiningScript>

***

### **Tr4veler's Mining Toolbox (Advanced)**&#x20;

This is an alternative mining interface to use with vast.ai which makes it possible to sort available machines and run the XenBlocks miner automatically. \
<https://github.com/tr4vLer/xenvast>

{% embed url="<https://youtu.be/5U268cRPRno>" %}
Video tutorial created by Tr4veler
{% endembed %}

***

### **Mine using Hiveos**&#x20;

How to prepare HIVEOS to mine xenblocks (nvidia GPU only!)

{% embed url="<https://github.com/woodysoil/XenblocksMiner/blob/main/doc/HIVEOS.md>" %}

***

Join the XenBlocks community on Telegram and get help with mining:&#x20;

{% embed url="<https://t.me/+yDcqqTGMNC4yNjdj>" %}


# XNM

XNM is the reward token for mining XenBlocks. Miners receive XNM every time they find a XenBlock.

## Supply

XNM follows a yearly halving schedule. The multiplier is applied to every XenBlock found. In the first year, miners receive a reward of 10 XNM for each block they find. In the second year, the reward for discovering a block is reduced to 5 XNM, and so on. Est. total supply amounts to 620M XNM after year 15.&#x20;

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FYFLsk2gwRUfJvHIH320r%2Fxnieum.png?alt=media&amp;token=19598fdb-54a8-44f6-a979-7b106ec210ae" alt=""><figcaption></figcaption></figure>

| Year | Multiplier     | XENIUM (XNM) |
| ---- | -------------- | ------------ |
| 1    | 10             | 310M         |
| 2    | 5              | 155M         |
| 3    | 2.5            | 77.5M        |
| 4    | 1.25           | 38.75M       |
| 5    | 0.625          | 19.375M      |
| 6    | 0.3125         | 9.6875M      |
| 7    | 0.15625        | 4.83475M     |
| 8    | 0.078125       | 2.421875M    |
| 9    | 0.0390625      | 1.2109375M   |
| 10   | 0.01953125     | 605.46875K   |
| 11   | 0.009765625    | 302.734375K  |
| 12   | 0.0048828125   | 151.367188K  |
| 13   | 0.00244140625  | 75.683594K   |
| 14   | 0.001220703125 | 37.841797K   |
| 15   | 0.000610351563 | 18.920899K   |


# Add network

Add the XenBlocks network to your web3 wallet to view your mining rewards.

***

**Network name**\
XenBlocks

**Network RPC URL**\
*<https://xenblocks.io:5556/>*

**Chain ID** \
*100101*

**Currency smybol**\
*XNM*

***

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FGw0tzZVVTvl8ubeJNTJ9%2FFrame%204850.png?alt=media&amp;token=4f4bea2f-d14d-4814-acde-134a5e3ba560" alt=""><figcaption><p>Adding a new network in MetaMask</p></figcaption></figure>


# Address migration

EVM to SVM address mapping.

Since X1 is SVM miners have to map their EVM address used for mining XenBlocks to an SVM address. This process involves simply connecting to the address migration site with your EVM wallet and submitting your SVM address.

## 1. Go to address migration site

{% embed url="<https://xenblocks.io/address_migration>" %}

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FEHHr1aTSkijThSjBCDAY%2FScreenshot%202024-09-08%20at%2007.36.56.png?alt=media&amp;token=31303fee-dc24-4b8e-9da6-4274ee55b286" alt=""><figcaption></figcaption></figure>

## 2. Connect EVM wallet

Connect with the EVM wallet you mined XenBlocks with.&#x20;

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2F5v48nHJUkzZGmrfnADOl%2FScreenshot%202024-09-08%20at%2007.40.34.png?alt=media&amp;token=c388b5d9-0148-440e-8725-5e6f5b319ed5" alt=""><figcaption></figcaption></figure>

## 3. Submit SVM address

Enter your SVM address and hit submit. This action will not generate a transaction or ask you for fees. It will simply ask you to sign a message which will verify the ownership of your address.

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FdHeGbH7KWrrndFwCS4QN%2FScreenshot%202024-09-08%20at%2007.42.47.png?alt=media&amp;token=2a716e3d-af3b-44c0-871e-ae24c773ddd7" alt=""><figcaption></figcaption></figure>

## 4. Verify submission to ledger

Check that your EVM address matches your SVM address.&#x20;

{% embed url="<https://xenblocks.io/reg-ledger/>" %}

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FiehkTNVh11hiLnTMxcIN%2FScreenshot%202024-09-08%20at%2008.01.53.png?alt=media&amp;token=4224dace-ccf0-4133-875a-14ef750d2f1b" alt=""><figcaption></figcaption></figure>

On the [**leaderboard**](https://explorer.xenblocks.io/leaderboard) your addresses will also show as mapped.&#x20;

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2Fb7nWkrQzKA3D2sh2yxRA%2FScreenshot%202024-09-08%20at%2007.49.59.png?alt=media&amp;token=b24913b8-8ae9-4e3e-b808-68c5d401131a" alt=""><figcaption></figcaption></figure>

## Tutorial

{% embed url="<https://www.youtube.com/watch?v=z7y_u9FGHF8>" %}


# Mining statistics

## Leaderboard

After miners successfully discover their hashes, they need a platform to view their results. The leaderboard serves as this platform, functioning as a database that records and displays the number of blocks mined by each participant. On the leaderboard, several intriguing metrics are available, including the total number of blocks mined, the rate at which blocks are being mined, the current mining difficulty and the list of current miners. Miners are ranked based on the quantity of blocks they have successfully mined. Essentially, the leaderboard acts as a window into the blockchain's mempool and its current state. The mempool organizes transactions, including those that are unconfirmed, allowing them to be visualized and tracked.

{% embed url="<https://explorer.xenblocks.io/leaderboard>" %}

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FgHJT9k0bWXS81B4acbmC%2FScreenshot%202024-09-08%20at%2007.05.41.png?alt=media&amp;token=e48b8243-5d87-4cee-80e6-6a7168023e6a" alt=""><figcaption><p>XenBlocks leaderboard</p></figcaption></figure>

## XNM distributon

XenBlocks mining started from 0 supply in September 2023.&#x20;

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FEjDansKSZqp6XTsUeP6q%2Fxnm-distro.png?alt=media&amp;token=865831d1-22ff-41c2-a85f-072b32b35c5a" alt=""><figcaption></figcaption></figure>

## Stat pages

At xen.pub you can see overall mining statistics as well as personal mining statistics

<figure><img src="https://content.gitbook.com/content/nx1OAq8QF9aR2RQz7ACd/blobs/p9hPz31LXMs8p9WjhbgH/image.png" alt=""><figcaption><p>...</p></figcaption></figure>

{% embed url="<https://xen.pub/index-xenblocks.php>" %}
...
{% endembed %}

<figure><img src="https://content.gitbook.com/content/nx1OAq8QF9aR2RQz7ACd/blobs/pCATpo0w0Bjk9PZXkuoD/image.png" alt=""><figcaption><p>...</p></figcaption></figure>

{% embed url="<https://xen.pub/xblocks.php>" %}


# Hashing

## **XEN11**

Hashing involves your computer making numerous attempts at discovering a specific hash. The server employs an algorithm to look for a hash that contains "...XEN11...". When your mining device identifies a sequence of 65 characters that contain 'XEN11' within the hashes, a XenBlock is recognized as found.&#x20;

```
{'hash_to_verify': '$argon2id$v=19$m=1827,t=1,p=1$WEVOMTAwODIwMjJYRU4$Z5K2z48kj4Rwp2SXEN11JRaqRGjr+bbdolMmiXnZnpXMpcNPpfIeO1fqOCHlwozBzUEdArHUGmra+29xJwJnug', 'key': '8352e490f6927d1cff31392d8be7b909a68fb567118b8d8e38aaa9ef8ade4c548734cdc01a109afb5ffc5d4b32ae97be5d07f10e0998a1bf42f5b4e8407b49b5', 'account': '0x34...', 'attempts': 12465538, 'hashes_per_second': 1212.7330427037584}
HTTP Status Code: 200
Proof of Work successful: {'message': 'POW Record stored successfully!'}
Block ID: 12603, Merkle Root: cbd22b24776e5b3f8b036aac2924baf005d183f7ddfccfa4e64b967778f7d560
Server Response: {'message': 'Hash verified successfully and block saved.'}
```

Above is a successful found hash with XEN11 in it. It took 12.5M hashes ("guesses") to find it.

* argon2id - cryptographic hashing algorithm used
* v - version of argon2
* m - difficulty. adjusts based on how many miners there are and hashes produced.&#x20;
* t - time. set to minimum.&#x20;
* p - parallelism - set to 1. inside algorithm can run multiple versions itself w/o increasing the algorithm.

## **Key**

The key is essential for cryptographic hashing. Because if the goal is to find a hash looking like this:

Hash:

```
$WEVOMTAwODIwMjJYRU4$Z5K2z48kj4Rwp2SXEN11JRaqRGjr+bbdolMmiXnZnpXMpcNPpfIeO1fqOCHlwozBzUEdArHUGmra+29xJwJnug
```

Someone could simply come up with random numbers and fake the hash - push it out to nodes and hope they will accept it. No, this is not possible and its because you must also present a corresponding key to the found hash.&#x20;

Key:

```
8352e490f6927d1cff31392d8be7b909a68fb567118b8d8e38aaa9ef8ade4c548734cdc01a109afb5ffc5d4b32ae97be5d07f10e0998a1bf42f5b4e8407b49b5
```

The key is produced by your hashing algorithm to prove that you really did the work to find the hash. \
Because even though you can fake the XEN11 hash - you cant fake it together with a corresponding key.&#x20;

<figure><img src="https://content.gitbook.com/content/nx1OAq8QF9aR2RQz7ACd/blobs/I7iikGuvZqoIYN7gpUmS/image.png" alt=""><figcaption></figcaption></figure>

This is a key that's produced and its matching my hash that I mined. \
Dashboard runs verification and it will only insert my result if the key matches the hash I mined.&#x20;

{% hint style="info" %}
Try out the Argon2 Hash Generator & Verifier:    <https://argon2.online/>
{% endhint %}


# Merged mining

Merged mining allows for the simultaneous mining of multiple cryptocurrencies without compromising the efficiency of the mining process. As the Argon2 hashing algorithm searches for the XEN11 hash, it also concurrently searches for additional hashes like X.BLK and XUNI.

### Superblocks (X.BLK)

Superblocks operate on a principle similar to XEN11, with the key difference being that your hash string must contain 65 or more uppercase letters within a total of 136 characters. To find a Superblock, at least 65 characters need to be in capital letters. The difficulty of discovering Superblocks is approximately 1 in 1000 compared to the frequency of finding XenBlocks.

```
$argon2id$v=19$m=80,t=1,p=1$WEVOMTAwODIwMjJYRU4$CXEN11PVHUNlvcvCNgST0wwIEDP/YAIKGjeOlzBfIU0sIMKoLzgcaCjPpO4jaFLWSMUOi/dYtJR5zNlJ7FKAEg
```

### XUNI

The miner constantly searches for XUNI, but they can only be discovered during a specific time window at the top of every hour, from x:55 to x:05.

```
$argon2id$v=19$m=1927,t=1,p=1$WEVOMTAwODIwMjJYRU4$HoSpKRO7GzdKSJGxSqJ35Irw3wU6DHCsx5mMuh2iBrlwxLmPB9GJERZv1qjuyVujr9fdvEq7VXUNI64UJM0V3w
```


# Self-custodial hashing

Own your hash.

In most Proof of Work (PoW) systems, there are primarily two critical elements: the key and the hash. A vulnerability in such systems is the potential for someone to intercept mined blocks before they are verified and accepted by the blockchain. This interception could allow an attacker to reroute blocks without the ability to change the owner's address, simplifying the process of executing attacks on the chain by reordering blocks and claiming ownership.

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FGUSv3Gm3FpBzgx3c86Vi%2FStamped%20hash.png?alt=media&amp;token=45ca9e85-04d9-4891-a6a8-a6149d750344" alt=""><figcaption></figcaption></figure>

However, such a scenario is not feasible with XenBlocks. In XenBlocks, all mined blocks are cryptographically signed with the miner's Ethereum address, ensuring that block theft is impossible. The only way for someone to take ownership of a block is if the original owner divulges their private key, providing a significant layer of security against block interception and unauthorized ownership changes.

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FvnWrI6yAHRJCtojyT1GO%2Fimage.png?alt=media&amp;token=11c9c910-99c6-490f-b19b-d29fd8e6c16d" alt=""><figcaption><p>Miner ETH address is used as SALT input when mining</p></figcaption></figure>

The Ethereum address is efficiently compacted into 27 bytes, which is quite minimal. Subsequently, the discovery of a hashed block is attributed to the address, signified by the Salt. Thus, when mining, your Ethereum address is utilized as the Salt. Unlike Bitcoin, which does not incorporate Salt in its SHA-256 algorithm, Argon2 does implement this feature, allowing for this added layer of association between mined blocks and the miner's address.


# Fixed total hashrate

Scaling with constant energy expenditure and maintained security.

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FphzCszkqxRhvYYvIDDzN%2FXenium%20vs.%20Bitcoin.png?alt=media&amp;token=c0860687-1758-48b8-9c96-5af3bbf3e781" alt=""><figcaption></figcaption></figure>

A key distinction between XenBlocks and Bitcoin revolves around the approach to managing the total hashrate within their respective networks. While most Proof of Work (PoW) systems, including Bitcoin, experience an increase in total hashrate as more miners join, thus continuously growing in computational power, XenBlocks employs a different strategy:

XenBlocks maintains a constant global hashrate of around 10 million hashes per second (10M h/s or 10,000 K h/s). As the network's difficulty level rises, the system automatically adjusts by reducing the hashrate allocated to each individual miner. This means that as more miners participate, the amount of power used by each decreases.

Instead of allowing the total hashrate to escalate indefinitely, XenBlocks opts to distribute a fixed total hashrate among all miners. This results in individual miners observing lower hash rates over time as the network grows. Each difficulty increase leads to a reduction in the personal hash rate achievable by miners.

This method contrasts with older algorithms used by networks like Bitcoin and Ethereum, where the hashrate can increase without bound and is not dynamically adjusted in this manner. On these networks, the difficulty adjusts, but the concept of a fixed global hashrate doesn't apply, allowing total network power to grow with the addition of miners.

This design implies that, assuming continued growth of the network, individual miners may end up generating fewer hashes per second over time, though they can still contribute significantly at present.


# Argon2

Argon2id is the cryptographic hashing algorithm used for mining XenBlocks.

## What is Argon2

Argon2id, hereinafter referred to as Argon2, is the cryptographic hashing algorithm employed for mining XenBlocks. It dynamically adjusts its difficulty in line with parameters that are universally applied to all miners. By design, Argon2 is resistant to both GPU and ASIC mining. While "resistant" does not mean mining with these devices is impossible, it does signify that it would be more challenging, costly, and demanding. The primary reason for this resistance lies in Argon2's significant demand for memory, specifically VRAM allocation. As the difficulty level increases, the rate at which hashes can be produced decreases due to this memory requirement. Therefore, Argon2 is characterized as a memory-hard algorithm, which means its performance is closely tied to the utilization of memory and RAM.

Argon2 is a [key derivation function](https://en.wikipedia.org/wiki/Key_derivation_function) that was selected as the winner of the 2015 [Password Hashing Competition](https://en.wikipedia.org/wiki/Password_Hashing_Competition).

* Argon2d maximizes resistance to GPU [cracking attacks](https://en.wikipedia.org/wiki/Password_cracking). It accesses the memory array in a password dependent order, which reduces the possibility of [time–memory trade-off](https://en.wikipedia.org/wiki/Time%E2%80%93memory_trade-off) (TMTO) attacks, but introduces possible [side-channel attacks](https://en.wikipedia.org/wiki/Side-channel_attack).
* Argon2i is optimized to resist side-channel attacks. It accesses the memory array in a password independent order.
* Argon2id is a hybrid version. It follows the Argon2i approach for the first half pass over memory and the Argon2d approach for subsequent passes. [RFC](https://en.wikipedia.org/wiki/RFC_\(identifier\)) [9106](https://datatracker.ietf.org/doc/html/rfc9106) recommends using Argon2id if you do not know the difference between the types or you consider side-channel attacks to be a viable threat.[\[4\]](https://en.wikipedia.org/wiki/Argon2#cite_note-:1-4)

All three modes allow specification by three parameters that control:

* execution time
* memory required
* degree of parallelism

{% embed url="<https://en.wikipedia.org/wiki/Argon2>" %}

###


# Argon2 relating to memory and difficulty

Mining capacity bounded by the VRAM's speed.

#### Resistance

Argon2 is the designated cryptographic hashing algorithm for mining XenBlocks. It features dynamic difficulty adjustment that applies uniformly across all miners. Naturally resistant to GPU and ASIC mining, "resistant" in this context doesn't mean impossible; rather, it implies a higher degree of difficulty and cost. The reason behind this resistance is Argon2's substantial demand for memory or VRAM allocation. As the mining difficulty escalates, the rate of hash generation decreases, highlighting the algorithm's memory-intensive nature. Therefore, Argon2 is categorized as a memory-hard algorithm, directly tying its operation and efficiency to the utilization of memory and RAM.

#### **What is memory (RAM)?**

Random Access Memory (RAM) is a crucial component of a computer that temporarily stores data needed while the computer is operating. This data can range from a document you're working on to the webpage you're currently viewing. When the computer requires this data, it retrieves it swiftly and effortlessly from the RAM, facilitating smooth and efficient operation.

#### **What is VRAM?**

VRAM, or Video RAM, is a specialized form of RAM designed expressly for handling graphics processing tasks. While general-purpose RAM serves as the primary memory for your computer, facilitating data storage for current computations by the processor across various applications, VRAM is allocated specifically for the graphics processor. This dedicated memory allows the graphics processor to store and manage data related to visual computations, enhancing the performance of rendering images, videos, and graphics-intensive applications. Essentially, VRAM is to the graphics processor what RAM is to the central processor, but with a focus on optimizing graphics performance.

#### VRAM access

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FRH5JlqNsQlgJflEaKSLM%2FARGON2.png?alt=media&amp;token=747fe2f4-d3e7-4cc9-9fe5-525f110565e8" alt=""><figcaption></figcaption></figure>

As a miner, the GPU, or Graphics Processing Unit, is crucial for generating hash power. Initially designed to boost computer graphics and image processing, GPUs have proven to be highly effective for mining XenBlocks (and other cryptocurrencies) due to their substantial hash power capabilities.

To mine a block, you must utilize VRAM, the video-specific RAM, indicating that your mining capacity is bounded by the VRAM's speed. The critical factor here is not merely how quickly you can discover blocks, but the time it takes to access VRAM—the bandwidth or data transfer rate significantly influences mining difficulty.

Therefore, VRAM speed emerges as the bottleneck in this process. For instance, with a difficulty level of 90K, which approximates to accessing 100MB of data, the time required to mine a block is determined by how fast you can access this 100MB. Should the difficulty increase to 200K, implying the need to access 200MB of data, the time required could potentially double. While this relationship isn't strictly linear, it serves to illustrate that your mining efficiency is governed by bandwidth rather than your computational prowess in solving hashes.

As the difficulty escalates, requiring more bandwidth to mine a block, the demand on memory access intensifies. This characteristic is why Argon2 is described as "memory hard"—it underscores the importance of memory access, a resource that is inherently finite, in the mining process.

#### VRAM speed

The efficiency of mining using Argon2 is primarily constrained by the speed of VRAM. Here's a breakdown of the speeds associated with a few VRAM types:

| Type of VRAM | Speed                   | Notes                                                         |
| ------------ | ----------------------- | ------------------------------------------------------------- |
| GDDR5        | 1 GB/s - 1.75 GB/s      | Common in older or budget graphics cards                      |
| GDDR5X       | 1.25 GB/s - 1.75 GB/s   | An improved version of GDDR5                                  |
| GDDR6        | 1.75 GB/s - 2 GB/s      | Found in many current mid-range to high-end graphics cards    |
| GDDR6X       | 2.375 GB/s - 2.625 GB/s | The latest and fastest GDDR technology, used in top-tier GPUs |

The actual mining performance and effectiveness for Argon2 would depend on the VRAM's speed and how the GPU architecture utilizes it.

NVIDIA RTX 4000 series and the NVIDIA A40 are examples of GPUs proven to be very efficient in output versus cost when it comes to XenBlocks minnig.&#x20;

1. **NVIDIA RTX 4000 Series (e.g., GeForce RTX 4090, part of the RTX 40 series)**: This series primarily uses GDDR6X VRAM, known for its high speed and efficiency. GDDR6X offers significant improvements over previous generations, like GDDR6, in terms of bandwidth and power efficiency, making it well-suited for gaming and high-performance computing tasks. For instance, the GeForce RTX 4090 uses GDDR6X memory.
2. **NVIDIA A40**: The NVIDIA A40 is designed for professional and data center applications, and it utilizes GDDR6 memory. The A40 is tailored for AI, deep learning, and high-performance computing (HPC) workloads, offering a balance between high memory capacity and speed to support complex computational tasks in professional environments.

GeForce RTX 40 series, such as the RTX 4090, utilizes GDDR6X VRAM, and for the RTX 4090 specifically, the memory speed can reach up to 21.2 Gbps per pin. Given its 384-bit memory interface, this translates to a bandwidth of about 1,008 GB/s.

Each type of VRAM serves the specific needs of its respective GPU's target application, with GDDR6X focusing on maximizing throughput for gaming and graphical tasks, while GDDR6 in professional GPUs like the A40 emphasizes a balance between speed and capacity for compute-intensive application.\
\
Imagine you have GDDR6X VRAM that operates at a speed of 2.65 GB/s. So, taking a scenario where the difficulty level corresponds to processing 100MB of data (equivalent to a 90K difficulty level):

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FVMePGKlEHqIbYlF46x3C%2F2PoW-1.png?alt=media&amp;token=3deba8ef-bbb0-4ed1-a279-26ffc8642950" alt=""><figcaption></figcaption></figure>

You can process 100MB of data 27.136 times per second. This means you can load 27.136 sets of 100MB into that memory each second.

If the difficulty increases to a level requiring the processing of 200MB of data (equivalent to a 200K difficulty level), you would be able to process those 200MB of data 13.568 times per second.

The frequency at which 100MB and 200MB data sets can be processed exhibits a 50% reduction when moving from the smaller to the larger data set. Specifically, the capacity to process 100MB of data 27.136 times per second drops to 13.568 times per second for 200MB. This demonstrates the direct effect of rising difficulty levels, which demand the management of increasingly large data sets, on the processing capability per second. It emphasizes the critical role of VRAM speed in determining the efficiency of mining operations.

Given a high-end GPU capable of achieving 5,000 hashes per second (h/s), the bottleneck isn't the hashing capability but rather the memory's capacity to handle the data required for those hashes. This constraint means that even with significant computational power, your effective hash rate is limited by how quickly the memory can supply data.

This limitation also illustrates why achieving terahash levels of performance is not feasible with current RAM speeds; the memory access speed becomes a critical bottleneck. Even with an abundance of computational power (hash power), the finite capacity and speed of memory restrict how quickly blocks can be produced. As the Argon2 algorithm is memory-hard, meaning it intensifies memory requirements as difficulty increases, memory access speed and capacity fundamentally limit mining efficiency.

Therefore, the challenges posed by memory constraints make ASIC mining—a technique relying on specialized hardware designed for maximum efficiency in specific computational tasks—less likely to be effective for mining algorithms like Argon2, where memory speed and capacity are the primary limiting factors.


# Why not ASIC mining?

The nature of memory being slow vs chips.

The question of why not to pursue ASIC mining hinges on the intrinsic relationship between mining calculations and memory requirements. Even with the most efficient mining algorithms, the need to interact with memory—which inherently takes time to build data structures—creates a bottleneck. This limitation is due to the fundamental disparity in speed between memory and processing chips.

While it's conceivable that memory technology could advance, becoming faster over time, ASICs are highly specialized devices engineered for rapid computation. For example, Bitcoin miners rely on ASICs for their operations, often needing to upgrade these devices annually to maintain a competitive edge. However, the demand for ASICs is limited to specific applications, making them niche products.

In contrast, memory is a universal requirement across various technologies and applications, preventing it from becoming overly specialized. The pace of memory speed improvements is steady but not exponential, and unlike other components in the semiconductor industry, memory pricing is difficult to optimize significantly. The market for RAM is well-established and commoditized, offering limited scope for drastic cost reductions through sourcing strategies.

Argon2, a memory-hard hashing algorithm, exemplifies these principles by making it impractical to leverage specialized hardware like ASICs for mining. This choice ensures a wider participation over time, as memory's universal necessity and gradual speed improvements keep the playing field more level.

Moreover, the economic calculus of mining, measured as hashes per second per dollar (h/s/usd), favors mid-range GPUs over high-end or specialized mining hardware. For instance, while high-end GPUs like the H100 or A100 offer formidable processing power, their cost does not proportionately translate to higher memory capabilities, making a $500 GPU nearly as effective for mining purposes. This affordability and efficiency make cloud mining, with its low entry barrier and accessible rental rates, an ideal strategy for mining XenBlocks.

In summary, the adoption of Argon2 as the hashing algorithm of choice reflects a deliberate strategy to democratize mining. By necessitating memory, which cannot be economically optimized for exclusive use like ASICs, Argon2 ensures broader participation and fairness in the mining process, embracing a philosophy that values inclusivity and equitable access to mining opportunities.

Argon2 is slow. \
But we want it to be slow because we want to have difficulty a consensus can form around decoupled from energy usage.&#x20;


# Argon2 and energy consumption

The memory-intensive nature of computing is what renders ASICs less effective for mining. The algorithm's difficulty level is adjusted in response to the competitive environment of the network, linking the challenge of mining more directly to memory allocation rather than sheer processing power. This adaptive difficulty mechanism allows for a separation from energy consumption.

The Argon2 algorithm, utilized in our system, decreases power usage as the difficulty level increases by leveraging memory for mining tasks. Memory components inherently consume fewer watts compared to traditional processing units. As the mining difficulty escalates, the algorithm demands more memory, causing the mining process to become constrained by the capacity for memory input and output. This slowdown in processing speed results in progressively lower power consumption, as slower operations require less energy.

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2F7ZpGu0edf01Eb7X5W5wo%2Fdifficulty%20relationship.png?alt=media&amp;token=bfdd1fb8-81c0-4df2-b87f-70405b6b3153" alt=""><figcaption></figcaption></figure>

As the mining difficulty increases, individual GPU utilisation decreases and in turn watt usage. Computations is being offloaded into memory instead. Watt goes up for memory but its using 1/300 of wattage as the GPU. GPU utilization remains constant (GPU %), but reduced hashing intensity leads to lower power consumption. Memory uses less energy than GPUs, and as mining difficulty increases, it reduces power consumption, preventing an increase in overall energy use. Consequently, the overall energy footprint of the mining process is substantially reduced, offering a more energy-efficient approach to mining.\
\
Currently, it's not feasible to increase the total energy consumption across the network because as the mining difficulty escalates, it inherently reduces energy usage. Energy efficiency is a crucial consideration in the context of Proof of Work (PoW) mining, and it's essential to recognise that not all PoW mining can be painted with the same brush in terms of energy expenditure. This distinction is particularly evident when comparing our approach to traditional methods.

The SHA-256 algorithm, which underpins Bitcoin mining, is an older algorithm not designed with energy efficiency in mind. As the difficulty of mining on the Bitcoin blockchain increases, the financial outlay required for energy consumption escalates, prompting miners to operate as many machines as possible to maximize economic returns and rewards. This scenario sets off a competitive rush to discover blocks and secure rewards.

However, this approach results in a continuous increase in energy consumption because the SHA-256 algorithm lacks mechanisms for self-optimization. Being a basic algorithm developed about 40 years ago by the U.S. government, it does not incorporate modern energy-saving technologies or methods, leading to inherently higher energy use with no capacity for reduction. In contrast, the methodology we're discussing aims to adjust energy consumption dynamically, making it fundamentally different and more energy-efficient.


# Difficulty

The difficulty adjustment mechanism is a crucial part of ensuring that the distribution of blocks remains consistent and fair across the mining network.

Before implementing the new difficulty setting, the network undergoes a verification phase to prevent attacks and errors. Once this phase concludes and consensus is achieved, the updated difficulty is applied across the network.

PoW mining is commonly assumed to be directly linked to computational heavy ASIC mining. This is not always the case which XenBlock mining is proof of. Every mining activity needs some sort of difficulty. But XenBlocks differs from Bitcoin in various areas. <br>

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td></td><td><h2>Difficulty adjustment mechanism</h2></td><td><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FCa3X21bC69cI45JOa0NS%2Fimage.png?alt=media&amp;token=107119db-7bd5-40ba-91b2-6965adb23129" alt="" data-size="original"></td><td><a href="https://docs.xenblocks.io/technicals/difficulty/difficulty-adjustment-mechanism">Difficulty adjustment mechanism</a></td></tr><tr><td></td><td></td><td><h2>Difficulty consensus<img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2Fd7XqZ4zwLAqLMhRWscn3%2Fimage.png?alt=media&amp;token=aa1adffc-5a0b-425a-a9a3-99c5ba799525" alt=""></h2></td><td><a href="https://docs.xenblocks.io/technicals/difficulty/difficulty-consensus">Difficulty consensus</a></td></tr><tr><td></td><td></td><td><h2> XenBlocks /Bitcoin difficulty comparison</h2></td><td><a href="https://docs.xenblocks.io/technicals/difficulty/xenblocks-bitcoin-difficulty-comparison">XenBlocks/Bitcoin difficulty comparison</a></td></tr></tbody></table>


# Difficulty adjustment mechanism

Self-regulating difficulty mechanism.

The difficulty adjustment mechanism is a crucial part of ensuring that the distribution of blocks remains consistent and fair across the mining network. This system, embedded within the mining algorithm, regulates the mining difficulty to maintain a target rate of approximately 60 blocks per minute, equating to 84,600 blocks per day. The objective is to limit the creation rate to no more than one block per second, introducing a form of scarcity to the block generation process.

As more miners join the network and overall computational power increases, the difficulty adjustment mechanism intervenes to keep the rate of block production in check. It does this by increasing the mining difficulty, which can affect the computational speed of miners' GPUs by requiring more memory usage. As a result, miners' hardware operates more slowly and uses less power when the difficulty is high. This contrasts with systems like Bitcoin, where difficulty adjustments are based solely on the complexity of the computational task, not on memory usage.

The difficulty manager aims to stabilize the total network hashrate at approximately 10 million hashes per second (10,000 K-hash/s). As the mining population grows, the mechanism increases difficulty to preserve this equilibrium, and conversely, it lowers difficulty if miners leave the network, facilitating a self-balancing system.

XenBlocks operates with a fixed global hashrate target, around 10 million hashes per second, which slightly fluctuates but generally revolves around this figure. This fixed rate contrasts with Bitcoin's ever-increasing hashrate over time. The network's performance, in terms of blocks mined over a given period, allows for an estimation of an individual miner's contribution relative to the total network output. By calculating the proportion of blocks their hashrate contributes, miners can gauge their share of the network's total mining power.

An intriguing aspect of this system is the integration of a difficulty adjustment mechanism directly into the mining software, raising questions about how to manage these adjustments within a decentralized peer-to-peer (P2P) network and achieve consensus on governance over time. Additionally, Proof of Stake (PoS) nodes play a role in rapidly adjusting difficulty, highlighting the innovative approaches used to ensure the system remains adaptive and fair.

This structure, underpinned by the Argon2 algorithm, exemplifies the potential for self-regulating, automated systems to function within a fully decentralized P2P network, showcasing the advanced capabilities and inherent flexibility of the mining process in maintaining network stability and fairness.

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FxDlTCbUNCjyGA0N4mq2I%2FDifficulty%20adjustment%20mechanism.png?alt=media&amp;token=036f2d2a-ecca-4eaf-9e4e-e5c11160b371" alt=""><figcaption></figcaption></figure>

The system is calibrated to maintain a production rate of 60 XenBlocks per minute. As more miners join, the collective hashrate rises, leading to an increase in block production. This continues until the block production rate reaches 72 blocks per minute, at which point the system's difficulty adjustment mechanism kicks in, increasing the difficulty by 100. This increase in difficulty leads to a reduction in both the hashrate for each miner and the overall XenBlock production rate, bringing the block production rate back down toward the target.

Conversely, should the collective hashrate decrease—due to fewer miners participating or a reduction in mining power—the block production rate may fall to as low as 48 blocks per minute. In response, the system will adjust the difficulty upwards by 100, resulting in an easier mining challenge that encourages an increase in the block production rate back toward the optimal level.

This self-regulating mechanism ensures that the block production rate oscillates around the 60 blocks per minute mark, irrespective of fluctuations in the network's mining power. It's a dynamic balance that keeps the production of XenBlocks consistent, maintaining the network's stability and fairness for all participants.


# Difficulty consensus

How difficulty adjusts in the network with consensus.

The difficulty adjustment in the XenBlocks is governed by a protocol managed by X1 validators. These validators ensure network synchronisation, receive and verify XenBlocks, and utilize block timestamps to monitor the block production rate. When deviations occur, nodes calculate a new difficulty level and propose adjustments. A consensus on the new difficulty is reached by averaging the proposals from all nodes, specifically using the median of these adjustments to ensure fairness and mitigate outliers.

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FrkuaaHRgda1CRaGC3XwF%2F10%20minute%20sliding%20window.png?alt=media&amp;token=28de46a9-1c55-43f2-b3cc-ad859368d9a3" alt=""><figcaption><p>Difficulty consensus</p></figcaption></figure>

Before implementing the new difficulty setting, the network undergoes a verification phase to prevent attacks and errors. Once this phase concludes and consensus is achieved, the updated difficulty is applied across the network. This streamlined process allows the XenBlocks network to adapt efficiently to mining activity changes, maintaining stability and security through collective decision-making.

<figure><img src="https://1026509867-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnx1OAq8QF9aR2RQz7ACd%2Fuploads%2FsGvYerwZhnhmSIewuopX%2F10%20minute%20sliding%20window.png?alt=media&amp;token=92afc9b3-9923-4acf-ae4f-d5fb6cb515a4" alt=""><figcaption></figcaption></figure>


# XenBlocks/Bitcoin difficulty comparison

How XenBlocks fundamentally differs from Bitcoin.

PoW mining is commonly assumed to be directly linked to computational heavy ASIC mining. This is not always the case which XenBlock mining is proof of. Every mining activity needs some sort of difficulty. For bitcoin the difficulties can be described as algorithmic, electricity and equipment.&#x20;

Here's how XenBlocks compares on those three areas.&#x20;

| Difficulty      | Bitcoin                                                                                                                                                            | XenBLOCKs                                                                                                                                                                                |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Algorithmic** | <p>Sha256<br>Rules to find hash that everyone needs to follow.</p>                                                                                                 | <p>Argon2  <br>Hashing algorithm used to find XEN11 hashes. </p>                                                                                                                         |
| **Electricity** | <p>Acquiring electricity, a limited resource.</p><p>Sha256 is an old algorithm that isn't optimized for energy efficiency. Growth is coupled with energy use. </p> | The adaptive difficulty adjusts based on network competition, with increased mining difficulty tied to memory allocation. This dependency enables us to decouple growth from energy use. |
| **Equipment**   | That can be used to execute algorithms and consume electricity. Competition leads to specialized hardware (ASIC) being utilized.                                   | Memory hard refers to tying difficulty to memory allocation, making it ASIC-resistant. GPUs are more accessible than ASICs and are not specialized hardware.                             |

\
In most Proof of Work (PoW) networks, the overall hashrate increases as more miners join the network. For instance, as Bitcoin's adoption expands, its total hashrate progressively climbs. However, XenBlocks operates differently, maintaining a constant global hashrate of approximately 10 million hashes per second (h/s). When the network's difficulty level rises, it automatically adjusts by decreasing the hashrate available to each individual miner.

This adjustment means that as the network becomes more crowded with miners and the difficulty escalates, each miner's equipment will consume less power. The rationale is that higher difficulty results in miners' GPUs operating more slowly and at lower temperatures.

This effect is achieved through the use of the Argon2 algorithm, which is designed to lower power consumption as the difficulty increases. Argon2 accomplishes this by relying on memory usage for mining operations. Since memory components require significantly less power to function, increasing difficulty leads to more extensive memory utilization, causing the mining process to become bound by memory input and output rates. As the process slows down due to these constraints, it becomes more power-efficient, consuming fewer watts.


