# Quantum Bitcoin Mining

^{1}

^{2}

^{3}

^{*}

## Abstract

**:**

## 1. Introduction

- The number of qubits is low.
- The gates and transformations implemented is restricted to the number of inputs and outputs.
- The circuit size is limited in depth and breadth.

## 2. Previous Work

## 3. Bitcoin and Quantum Concepts

#### 3.1. Bitcoin Data Structures

#### The Nonce

#### 3.2. Notation

## 4. Quantum Algorithm for Bitcoin Mining

**Step 1: Compute the permanent part of the Merkle tree classically**

**Step 2: Prepare the leaf nonce in a quantum superposition and compute the first Hash.**

**Step 3: Compute all the hashes on the leftmost leg of the Merkle tree.**

**Step 4: Computation of the final hash, given the nonces in the block header.**

**Step 5: Unstructured Search—Grover’s algorithm.**

**Step 6: Measurement and interpretation.**

#### A Small Example

**Step 1: Compute the permanent part of the Merkle tree classically.**

**Step 2: Prepare the leaf nonce in a quantum superposition and compute the first hash.**

**Step 3: Compute all the hashes on the leftmost leg of the Merkle tree.**

**Step 4: Computation of the final hash, given the nonce in the block header.**

- The quantum hash of the Merkle tree, ${S}_{2}$
- The primary nonce, in superposition of all possible values. This is similar to the initial superposition of the leaf nonce.$$header\_nonce=\frac{1}{\sqrt{2}}\left(\right|0\rangle +|1\rangle )$$
- Some additional classical information: the target value and some identification information for the block. For simplicity, we denote this information with $header\_info$, and though classical, it needs to be fed into the circuit as quantum values, $|header\_info\rangle $.

**Step 5: Unstructured Search—Grover’s algorithm.**

**Step 6: Measurement and interpretation.**

## 5. Size and Cost of the Quantum Solution

- 1.
- Step 1. This step is a classical computation on the Merkle tree. Each node is traversed a constant number of times. The nodes on the leftmost leg of the tree are processed in the next steps. The number of leaves is n. Thus, the computation of this step is a classical $\Theta \left(n\right)$.
- 2.
- Step 2. This step works on one single leaf node (transaction node) with a quantum superposition. It takes constant time, $O\left(1\right)$.
- 3.
- Step 3. This step computes the superposition of the hash values along the leftmost path of the tree. The tree has $logn$ levels, and each level takes constant time. The overall execution time for this step is $\Theta (logn)$.
- 4.
- Step 4. This step computes the superposition of the hash values in the header. The overall execution time for this step is constant, $O\left(1\right)$.
- 5.
- Step 5. This step is an application of Grover’s algorithm on the superposition of all hashes of the block. As the hash is of length 256 and there are t solutions, this steps takes $\Theta \left(\sqrt{{2}^{256}/t}\right)$.
- 6.
- Step 6. This step performs a constant time measurement. Additionally, but not necessarily, the step may check the Hash with a classical algorithm. The execution time is a constant, $O\left(1\right)$.

#### Quantum Supremacy

- 1.
- The hash values for the right children of the left leg, the result of step 1, which has a size of $256\times logn$.
- 2.
- Some additional classical information from the miner’s transaction and the header of the tree. These are of constant size; let us denote this constant with k.

## 6. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Acknowledgments

## Conflicts of Interest

## References

- Knapp, G.F. Staatliche Theorie des Geldes; Verlag von Duncker & Humblot: Munchen, Germany; Leipzig, Germnay, 1905. [Google Scholar]
- Narayanan, A.; Bonneau, J.; Felten, E.; Miller, A.; Goldfeder, S. Bitcoin and Cryptocurrency—A Comprehensive Introduction; Princeton University Press: Princeton, NJ, USA; Oxford, UK, 2016. [Google Scholar]
- Aggarwal, D.; Brennen, G.; Lee, T.; Santha, M.; Tomamichel, M. Quantum Attacks on Bitcoin, and How to Protect Against Them. Ledger
**2018**, 3. [Google Scholar] [CrossRef] [Green Version] - Brassard, G.; Hoyer, P.; Tapp, A. Quantum cryptanalysis of hash and claw-free functions. In LATIN’98: Theoretical Informatics. Lecture Notes in Computer Science; Lucchesi, C., Moura, A., Eds.; Springer: Berlin/Heidelberg, Germany, 1998; Volume 1380, pp. 163–169. [Google Scholar]
- Bernstein, D.J.; Hopwood, D.; Hülsing, A.; Lange, T.; Niederhagen, R.; Papachristodoulou, L.; Schneider, M.; Schwabe, P.; Wilcox-O’Hearn, Z. SPHINCS: Practical stateless hash-based signatures. In Proceedings of the EUROCRYPT 2015: Advances in Cryptology–EUROCRYPT2015 Annual International Conference on the Theory and Applications of Cryptographic Techniques, Sofia, Bulgaria, 26–30 April 2015; Oswald, E., Fischlin, M., Eds.; Springer: Berlin/Heidelberg, Germany, 2015; Volume 9056, pp. 368–397. [Google Scholar]
- Sun, S.; Zhang, R.; Ma, H. Efficient Parallelism of Post-Quantum Signature Scheme SPHINCS. IEEE Trans. Parallel Distrib. Syst.
**2020**, 31, 2542–2555. [Google Scholar] [CrossRef] - Tang, H.; Pal, A.; Qiao, L.F.; Wang, T.Y.; Gao, J.; Jin, X.M. Quantum Computation for Pricing the Collateralized Debt Obligations. arXiv
**2021**, arXiv:2008.04110. [Google Scholar] [CrossRef] - Stewart, I.; Ilie, D.; Zamyatin, A.; Werner, S.; Torshizi, M.; Knottenbelt, W. Committing to quantum resistance: A slow defence for Bitcoin against a fast quantum computing attack. R. Soc. Open Sci.
**2018**, 5, 180410. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Shahid, F.; Khan, A. Smart Digital Signatures (SDS): A post-quantum digital signature scheme for distributed ledgers. Future Gener. Comput. Syst.
**2020**, 111, 241–253. [Google Scholar] [CrossRef] - Zheng, B.; Zhu, L.; Shen, M.; Du, X.; Guizani, M. Identifying the vulnerabilities of Bitcoin anonymous mechanism based on address clustering. Sci. China Inf. Sci.
**2020**, 63, 132101. [Google Scholar] [CrossRef] [Green Version] - Bao, Z.; Shi, W.; Kumari, S.; yin Kong, Z.; Chen, C.M. Lockmix: A secure and privacy-preserving mix service for Bitcoin anonymity. Int. J. Inf. Secur.
**2020**, 19, 311–321. [Google Scholar] [CrossRef] - Wang, Q.; Qin, B.; Hu, J.; Xiao, F. Preserving transaction privacy in Bitcoin. Future Gener. Comput. Syst.
**2020**, 107, 793–804. [Google Scholar] [CrossRef] - Eyal, I.; Sirer, E.G. Majority is not enough: Bitcoin mining is vulnerable. In Proceedings of the International Conference on Financial Cryptography and Data Security, Christ Church, Barbados, 3–7 March 2014; Springer: Berlin/Heidelberg, Germany, 2014; pp. 436–454. [Google Scholar]
- Negy, K.A.; Rizun, P.R.; Sirer, E.G. Selfish mining re-examined. In Proceedings of the International Conference on Financial Cryptography and Data Security, Kota Kinabalu, Malaysia, 14 February 2020; Springer: Berlin/Heidelberg, Germany, 2020; pp. 61–78. [Google Scholar]
- Sattath, O. On the insecurity of quantum Bitcoin mining. Int. J. Inf. Secur.
**2020**, 19, 291–302. [Google Scholar] [CrossRef] [Green Version] - Wei, S.; Chen, Y.; Zhou, Z.; Long, G. A Quantum Convolutional Neural Network on NISQ Devices. arXiv
**2021**, arXiv:2104.06918. [Google Scholar] [CrossRef] - Nakamoto, S. Bitcoin: A Peer-to-Peer Electronic Cash System. White Paper. 2008. Available online: https://bitcoin.org/en/ (accessed on 15 June 2020).
- Nielsen, M.; Chuang, I. Quantum Computation and Quantum Information; Cambridge University Press: Cambridge, MA, USA, 2000. [Google Scholar]
- Grover, L. A fast quantum mechanical algorithm for database search. In Proceedings of the 28th Annual ACM Symposium on the Theory of Computing, Philadelphia, PA, USA, 22–24 May 1996; pp. 212–220. [Google Scholar]
- National Institute of Standards and Technology. Secure Hash Standard; FIPS Publication 180-2; NIST: Gaithersburg, MD, USA, 2002.
- Moran, C.C. Mastering Quantum Computing with IBM QX; Packt Publishing Ltd.: Birmingham, UK, 2019. [Google Scholar]
- Amy, M.; Di Matteo, O.; Gheorghiu, V.; Mosca, M.; Parent, A.; Schanck, J. Estimating the cost of generic quantum pre-image attacks on SHA-2 and SHA-3. In Proceedings of the International Conference on Selected Areas in Cryptography, St. John’s, NL, Canada, 10–12 August 2016; Springer: Berlin/Heidelberg, Germany, 2016; pp. 317–337. [Google Scholar]
- IBM-QX. IBM Quantum Experience. 2020. Available online: https://quantum-computing.ibm.com (accessed on 20 July 2020).
- Zhou, P.; Lv, L.; He, L. Effect of noise on remote preparation of an arbitrary single-qubit state. Quantum Eng.
**2021**, 3, e64. [Google Scholar] [CrossRef] - Long, G.L. Grover algorithm with zero theoretical failure rate. Phys. Rev. A
**2001**, 64, 022307. [Google Scholar] [CrossRef] [Green Version] - Toyama, F.; van Dijk, W.; Nogami, Y. Quantum search with certainty based on modified Grover algorithms: Optimum choice of parameters. Quantum Inf. Process.
**2013**, 12, 1897–1914. [Google Scholar] [CrossRef]

**Figure 3.**The items marked in green are all classical information. The classical circuit computes all the hash values for the right children along the Merkle tree’s left leg.

**Figure 4.**Step 2 applies the HASH function on the superposition of all possible values of the extra nonce and the miner’s classical information. Additionally, the hashing quantum circuit needs enough input qubits to hold the value of the Hash. These are 256 qubits and they are initially set to $|0\rangle $.

**Figure 5.**Step 3 computes the hashes along the leftmost path of the Merkle tree. All the inputs, outputs, and hashes are retrievable in the final state.

**Figure 6.**Step 4 computes the final hash value. It depends on the values of the primary nonces and the extra nonces, which are in superposition.

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Benkoczi, R.; Gaur, D.; Nagy, N.; Nagy, M.; Hossain, S.
Quantum Bitcoin Mining. *Entropy* **2022**, *24*, 323.
https://doi.org/10.3390/e24030323

**AMA Style**

Benkoczi R, Gaur D, Nagy N, Nagy M, Hossain S.
Quantum Bitcoin Mining. *Entropy*. 2022; 24(3):323.
https://doi.org/10.3390/e24030323

**Chicago/Turabian Style**

Benkoczi, Robert, Daya Gaur, Naya Nagy, Marius Nagy, and Shahadat Hossain.
2022. "Quantum Bitcoin Mining" *Entropy* 24, no. 3: 323.
https://doi.org/10.3390/e24030323