Professional Documents
Culture Documents
A Survey On Coin Selection Algorithms in UTXO-based Blockchains
A Survey On Coin Selection Algorithms in UTXO-based Blockchains
UTXO-based Blockchains
Gholamreza Ramezan Manvir Schneider Mel McCann
IEEE Member Cardano Foundation Cardano Foundation
g2n@ieee.org manvir.schneider@cardanofoundation.org mel.mccann@cardanofoundation.org
B. Objectives Now, the set of the possible values of 𝑈 for each pool is:
∙ User 1, {0.5, 1}.
The coin selection algorithms employ various strategies
∙ User 2, {0.25, 0.5, 0.75, 1}.
to ensure efficient utilization of UTXOs while taking into
∙ User 3, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1}.
account parameters such as transaction fees, privacy, etc. In
this section, we will dive into the objectives that govern the As can be seen, User 3 has more options to pay for a wider
design and implementation of these algorithms. range of target values.
(O1) Minimizing Transaction Fee: Just pay enough transaction Example 2. Assume that there are two users, each has 1 token:
fees to get the transaction included in a block inside ∙ User 4 with UTXO pool 𝑈 = {0.5, 0.5}.
a blockchain. A good coin selection algorithm should ∙ User 5, with UTXO pool 𝑈 = {0.1, 0.2, 0.3, 0.4}.
not only reduce the transaction fee for the current
Now, to pay a target value of 0.6 token, the coin selection
transaction, but should also focus on minimizing the
algorithm can form the following UTXO sets as input for the
transaction fee in the long run [11]. The lowest number
transaction:
of inputs (UTXOs) is required to minimize transaction
∙ User 4, {0.5, 0.5}, change value = 0.4.
size [12]. The transaction fee may also contain an extra
∙ User 5, {0.1, 0.2, 0.3}, change value = 0.
incentive to encourage block producers to accelerate the
processing of transactions. As can be seen, for the requested payment from User 4, all
(O2) Enhancing Privacy: Everyone has access to every trans- of its funds would be used, there would be no confirmed
action. This may result in a breach of financial privacy. UTXOs left to send another transaction, and the recipient
Data miners and third-party observers should not be able would learn that the sender has an additional 0.4 token.
to get access to user data, such as the total balance However, User 5 has more options. A sufficient number of
or economic activity of a user. A good coin selection UTXOs in User 5’s pool results in not revealing all funds in the
algorithm should use a minimum number of UTXO wallet. Furthermore, the created transaction would leave the
addresses in the selected UTXO set. This is because data other UTXOs untouched in the wallet and would not require
miners may use the transaction information to reveal the the creation of a change output [10].
user’s identity [11], [13]. Another objective that we will not focus on in this work
(O3) Minimizing Pool Size: The size of the UTXO pool is maximizing the speed of execution of the coin selection
directly affects storage requirements as a way of how algorithm [12].
storing UTXO affects the processing speed of block
producers [14]. In addition, a small UTXO pool limits III. COIN SELECTION A LGORITHMS
the number of dust UTXOs in the pool. Various coin selection algorithms are currently employed in
(O4) Minimizing Confirmation Time: Block producers select wallet and blockchain software, as well as proposed in different
the transaction based on the fee per byte (token per byte) papers [15], [14], [16], [13], [12]. Each coin selection algo-
to maximize their revenue. A higher fee will increase the rithm selects a set of UTXO, denoted by 𝑆 alg ⊆ 𝑈 . The goal
1 Here we use the notation, [𝑛] = {1, ..., 𝑛}. 2 Note that in numerical examples, we write 𝑈 = {𝑢𝑣1 , ..., 𝑢𝑣𝑛 } for simplicity.
TABLE I: Coin Selection Algorithms Algorithm 1 Primitive Algorithms — 𝑃 (𝑈 )
Category Coin Selection Algorithm 𝑆 alg Input: Sorted UTXO pool 𝑈 = {𝑢1 , ..., 𝑢𝑛 }
First In First Out (FIFO) 𝑆 FIFO Input: Target 𝑇 > 0
Last In First Out (LIFO) 𝑆 LIFO Output: Set of selected UTXOs 𝑆 alg
Highest Value First (HVF) 𝑆 HVF
Primitive
Lowest Value First (LVF) 𝑆 LVF
Require: 𝑈 𝑣 > 𝑇
Highest Priority First (HPF) 𝑆 HPF 1: 𝑆 𝑎𝑙𝑔 ← {}
Greedy 𝑆 Greedy 2: 𝑟𝑒𝑚𝑎𝑖𝑛 ← 𝑇
Random Draw [15] 𝑆 RndDrw 3: while 𝑟𝑒𝑚𝑎𝑖𝑛 > 0 do
Random-Improve [17] 𝑆 RndImp
Basic
Knapsack [15] 𝑆 Knp
4: for 𝑖 = 1 to 𝑛 do
Branch and Bound [15] 𝑆 BnB 5: 𝑆 𝑎𝑙𝑔 .add(𝑢𝑖 )
Optimization [14] 𝑆 Opt 6: 𝑟𝑒𝑚𝑎𝑖𝑛 ← 𝑟𝑒𝑚𝑎𝑖𝑛 − 𝑢𝑣𝑖
Advanced Knapsack with Leverage [16] 𝑆 KnpLv 7: end for
Myopic and Strategic Optimization [13] 𝑆 Myop , 𝑆 Strat
8: end while
Greedy and Genetic [12] 𝑆 GrGe
9: return 𝑆 alg
R EFERENCES
[1] S. Nakamoto, “Bitcoin: A Peer-to-Peer Electronic Cash System,”
https://bitcoin.org/bitcoin.pdf, 2008.
[2] M. M. T. Chakravarty, J. Chapman, K. MacKenzie, O. Melkonian,
M. Peyton Jones, and P. Wadler, “The Extended UTXO Model,” in
Financial Cryptography and Data Security (M. Bernhard, A. Bracciali,
L. J. Camp, S. Matsuo, A. Maurushat, P. B. Rønne, and M. Sala, eds.),
(Cham), pp. 525–539, Springer, 2020.
[3] C. Pérez-Solà, S. Delgado-Segura, G. Navarro-Arribas, and J. Herrera-
Joancomart, “Another Coin Bites the Dust: An Analysis of Dust in
UTXO Based Cryptocurrencies.” Cryptology ePrint Archive, Paper
2018/513, 2018. https://eprint.iacr.org/2018/513.
[4] S. Delgado-Segura, C. Pérez-Solà, G. Navarro-Arribas, and J. Herrera-
Joancomartí, “Analysis of the Bitcoin UTXO Set,” in Financial Cryp-
tography and Data Security (A. Zohar, I. Eyal, V. Teague, J. Clark,
A. Bracciali, F. Pintore, and M. Sala, eds.), (Berlin, Heidelberg), pp. 78–
91, Springer Berlin Heidelberg, 2019.
[5] “Bitcoin Design – Coin Selection.” https://bitcoin.design/guide/how-i
t-works/coin-selection/ (accessed July 25, 2023).
[6] “What is the Coin Selection Algorithm?.” https://bitcoin.stackexcha
nge.com/questions/1077/what-is-the-coin-selection-algorithm#29962
(accessed July 25, 2023).
[7] “Coin Selection for Dummies: Part 2 — Branch and Bound Coin Selec-
tion.” https://blog.summerofbitcoin.org/coin-selection-for-dummies-2/
(accessed July 25, 2023).
[8] E. de Vries, “Self Organisation in Coin Selection.” https://iohk.io/en/b
log/posts/2018/07/03/self-organisation-in-coin-selection/ (accessed July
25, 2023).
[9] M. Erhardt, “What Are The Trade-offs Between The Different Algo-
rithms For Deciding Which UTXOs To Spend?.” https://bitcoin.stacke
xchange.com/questions/32145/what-are-the-trade-offs-between-the-dif
ferent-algorithms-for-deciding-which-utxo, 2014.
[10] M. Erhardt, “What is the Waste Metric?.” https://murch.one/posts/wast
e-metric/, 2022.
[11] “Coin Selection for Dummies Part 1 — Overview.” https://blog.summe
rofbitcoin.org/coin-selection-part-1/ (accessed July 25, 2023).
[12] X. Wei, C. Wu, H. Yu, S. Liu, and Y. Yuan, “A Coin Selection Strategy
Based on the Greedy and Genetic Algorithm,” Complex Intelligent
Systems, vol. 9, pp. 421–434, 2023.
[13] S. Abramova and R. Böhme, “Your Money or Your Privacy: A System-
atic Approach to Coin Selection,” Cryptoeconomic Systems, 2020.
[14] V.-H. Nguyen, H.-S. Trang, Q.-T. Nguyen, N. Huynh-Tuong, and T.-
V. Le, “Building Mathematical Models Applied to UTXOs Selection
for Objective Transactions,” in 2018 5th NAFOSTED Conference on
Information and Computer Science (NICS), pp. 160–164, 2018.
[15] M. Erhardt, “An Evaluation of Coin Selection Strategies.” https://murc
h.one/erhardt2016coinselection.pdf, 2016.