UTXO Size vs Efficiency for upcoming Constant Block Rewards

in #gridcoin6 years ago (edited)

As most of the community should be aware at this point, Gridcoin will be switching from 1.5% APR rewarded for staking to a constant value of 10 GRC awarded per block staked (Constant Block Reward). The exact timing of this is TBD; however, Gridcoin testing of CBR is commencing on testnet, so we are making good progress towards implementation.

When Constant Block Rewards (CBR) are activated in the Gridcoin network, you may want to consider optimizing your wallet for rewards. Before CBR, you are paid interest when you stake (make a block for the network that includes a payment to you) based on the amount of time elapsed since the coins were acquired, or since they last staked, at a rate of 1.5% per year. With CBR, the concept of time based interest is being replaced with a flat 10 GRC payment per stake. This means you may want to consider how to make the staking in your wallet more efficient. The probability to stake is dependent on the amount of coins you have that are mature. Mature coins are coins that have been in your wallet for at least 16 hours. When you stake, the coins that were used to stake become immature for 16 hours and cannot stake during that time. This is called “cooldown.”

Why should you be concerned about cooldown and how do you minimize its effects? The key is to understand what really underlies your balance in the wallet. Gridcoin utilizes transactions between addresses that are recorded in the blockchain. Just like cash transactions, there are inputs and outputs to each transaction. Staking itself involves transactions. Since everything in the blockchain must be traceable, one or more outputs from a prior transaction which are “unspent” (not sent to an address in another wallet by the transaction), are used as the inputs for the next transaction by the wallet. These unspent “outputs” are called Unspent Transaction Outputs (UTXOs). In an extreme example, if you only had one UTXO in your wallet comprising your balance, once this UTXO stakes, you would have to wait 16 hours for it to be eligible to stake again. Therefore it may make sense to split your coins into more UTXOs. (The UTXOs can be at the same address or different addresses in your wallet. That is entirely up to you.) To do this, just send coins to yourself (to any of your addresses) the amount you desire for the size of the UTXO via the "Coin Control" feature (Settings >> Options >> Display >> Display Coin Control Features) in the wallet. By using this feature you can make sure that you do not use coins that are already broken down to smaller bundles.

Having your wallet balance comprised of more UTXOs will help you stake more often, increasing what you are paid for staking over time, and helping to better secure the network.

A simple calculation to illustrate:

Let's say you stake once per week (roughly every 160 hours) now and have every coin in one UTXO. You extend the staking time by 16 hours once you stake because 100% of your balance becomes immature at that point. This means you stake at 91% (= 160 / (160 + 16)) efficiency. If you had your coins equally distributed in 2 UTXOs, your staking probability only decreases by 50% during the 16 hours timeframe, so on average you would extend your staking time by only 16/2 or 8 hours. So with 2 UTXOs, you would stake at 95% (= 160 / (160 + 8)) efficiency.

You can use the following formula to tell you the UTXO size you need for a desired staking efficiency:

UTXO size = 15000 * Difficulty * ((1/Efficiency) – 1)

For example, a difficulty of 1.0 at 90% efficiency would yield a UTXO size of 15000 * 1.0 * (1/0.9 – 1) = 1667 GRC. At 95% efficiency, the UTXO size would be 15000 * 1.0 * (1/0.95 – 1) = 789 GRC.

We expect the difficulty to rise to 5.0 or greater once CBR is implemented due to increased network participation, so the actual UTXO size required for a given efficiency will be larger. (Notice the UTXO size required is proportional to the difficulty.)

From the above it shows that you do not have to create UTXOs smaller than about 800 GRC each to achieve greater than 95% efficiency for network difficulties of 1.0 or higher, so resist the urge to create really small UTXOs. Creating "dust" will not help you stake more often. In reality UTXO sizes of around 2000 GRC should be perfectly adequate and give good efficiency.

Here is a link to a spreadsheet that provides a table and graph of UTXO size versus efficiency for various difficulties. (Below is the graph from that spreadsheet...)

https://docs.google.com/spreadsheets/d/1QpRMUUBCxE8bvGqSbi4gvQmOElwyvjXVsaFBk4RTHEM/edit?usp=sharing

Note that the above efficiency formula, along with all of the other formulas/thumb rules I have posted in the past, related concepts, and the algorithm used in 3.7.12.0+ for estimated time to stake (ETTS) will be concisely described in an upcoming bluepaper section that will be posted very soon.

Watch out for further updates on CBR from the core team as we make progress on moving to CBR implementation.

I also would like to refer people to the excellent tour guide of the Gridcoin wallet at https://www.reddit.com/r/gridcoin/comments/84xtij/a_tour_of_the_gridcoin_wallet/, which provides an excellent overview for those needing a tutorial on advanced coin control.

Sort:  

I think the link to the spreadsheet is missing.
Very nice explanation. I'm curious about the difficulty we will achieve with cbr

Fixed! Thank you! :)

Thanks for the overview @jamescowens. Is there an auto-optimisation option planned in the new client for anybody who doen't have the technical capability to grasp the concept but still doesn't want to loose out?

There is a bounty on providing an rpc command for UTXO management (https://github.com/gridcoin-community/Gridcoin-Research/issues/1173). We need to focus more energy on getting MRC done, which is the complement to CBR. Many people shouldn't have to worry about their UTXOs too much anyway for a reasonable staking efficiency.

A really simple rule of thumb is just to split any UTXO you have that is much bigger than 2000 GRC. That should be more than adequate...

Excellent guide! It's a bit rough splitting addresses manually, but it's worth doing!

I have created 2 files on Github for people interested in an offline version:

Thanks so much! :)

Could you explain a little bit more what is wrong with having 10,000 GRC in 10,000 different UTXOs of 1 GRC each?

A) It is wholly unnecessary. The smallest UTXO you will ever need is 800, and that is with a difficulty of 1.
B) Sending 10,000 GRC to 10,000 UTXO addresses will take you ages, congest the network, and cost you a small fortune in transaction fees.
C) Your wallet has to iterate over every UTXO every 8 seconds when staking. Depending on your hardware (such as if you were running a raspberry pi or other low power device) you may not be able to "check" all your UTXOs in time for each block, causing you to miss stakes.

How would we know if we were being affected by the problem described in C?

Unless you've done something silly like manually create thousands of UTXOs, that would never realistically occur. Through testing on my RPI3 I know that <500 UTXOs you see no issues at all.

Will anyone explain whether the chances to stake are exactly the same with 10K grx in 10K UTXO rather than having 1 single 10K UTXO?
Somehow, it looks like probability is not a "linear" addition of each UTXO...

James:

Thank you for posting this article. I was wondering why my total coins were not staking. Hopefully, they will now all be able to participate.

Thank you,

Prescott

@jamescowens Fantastic. This guide will really help GRC become the planetary currency. You tried to assist me a while back and while I couldn't solve the issue then, this guide cleared things up enough for me to get it correct. Many thanks and continued great work. I run a macbook air on net 99.99999% Can you use another testnet user?

we can always use ore testnet users to test upcoming releases, fixes and changes. requires some juggling since we do not run testnet clients on production network. come to slack chat and join channel testnet for more information.

Loading...

Sorry, I do not understand what to do to optimize my stacking, although I do understand your explanation of the stacking mechanics.

As I understand it, if I have three Gridcoin-adresses:
XXXX with 25000 coins
YYYY with 1000 coins
ZZZZ with 10 coins
You suggest that we transfer coins to YYYY and ZZZZ so they do have at least 2000 coins each. So it would look like:
XXXX 22010 coins
YYYY 2000 coins
ZZZZ 2000 coins

Correct? If so, I tried to send from my wallet to my own addresses YYYY and ZZZZ the needed coins, as I would send to another user, but this did not work. Can you explain how to?

As well as I am in Options: What do you suggest to click or change?

Thanks a lot!

I would recommend reading the section UTXOs and coin control from this guide:
https://www.reddit.com/r/gridcoin/comments/84xtij/a_tour_of_the_gridcoin_wallet/
I think it would help you clarify things a little bit, but if not, please ask again.

This guide helped to join small UTXOs together. But I have not understand how I would divide a “big” UTXO in various smaller UTXOs: “So if you have 1 large UTXO that is big enough to stake more than once every 16 hours, you can split it into smaller UTXOs which can allow you to stake slightly more often.”
I do this by transferring an amount smaller than “After Fee” (e.g. After Fee is 20000.00 so I will put in Amount [to send]: 100) this will split the UTXO to two UTXOs, one: 19900 and the other 100?
And if I will not fill “custom change address” with an existing address it will create a new address with 100?
Is this correct?
Thanks.

Simply send a smaller amount than is selected from the input back to yourself, with the change address set to the same as the receive address if desired. This will "split" the input into two pieces, the "send" part and the "change" part.

Coin Marketplace

STEEM 0.20
TRX 0.25
JST 0.038
BTC 96907.08
ETH 3380.66
USDT 1.00
SBD 3.23