Proposal for Stake-Days-based PoS mining system with Proof-of-Connection

I posted this idea on the bitcointalk forums, and d5000 replied to it there, and mentioned these forums. I have been working on this idea for the past several weeks, posting as “bitbadger” over on the bitsharetalk.org forums, in hope of getting this idea adopted by BitShares. However, it does not look like that is going to happen. I believe that it is something novel for PoS coins, although granted, I haven’t been on top of every new development. I would like to hear some feedback.

There are two parts to this proposal: Stake-Days (and Stake-Days Destroyed) and Proof-of-Connection.

Stake-Days are the rough analogue of Coin-Days. As Stake-Days go up, PoS mining difficulty goes down. If I hold 30 coins for 30 days, my Stake-Days are equal to 900. This is the equivalent of somebody with 900 coins holding them for 1 day. The key part is this: My Stake-Days only drop back to 0 when I actually mine a block with that stake. Since Stake-Days are only reset to 0 when a block is mined, they can be transferred from one address to another without being reset. The stake travels along with the coins (and can probably be additive within a given address, although this may make things too complicated). If I receive coins from you, and your coins have Stake-Days built up, I receive that stake when I receive the coins, and my chances of mining a block with that stake are just as high as they were when you held that stake. Proof-of-Stake mining (aka minting) still remains a stochastic process, but every address has its own difficulty level based on the stake associated with that address.

Now for Proof-of-Connection. A big problem with existing PoS coins (and indeed, PoW coins) is that nobody is incentivized to run a full node. With (say) PeerCoin, if I have low stake and little chance of mining a PoS block, I can turn off my PeerCoin client and leave it off for a month or three while my stake continues to build. I am not helping to secure the network or propagate transactions when my node is turned off.

So there needs to be a way to make stake dependent on running a node continuously. The proposed mechanism for this is as follows: Every block has a hash. Let’s say the hash for a given block starts with ABC. Once this block is created, every address matching AxxxxxxBxxxxxxC (or some other formulation; this is just an example) must “check in” by sending a transaction to themselves to prove that they’re connected. These Proof-of-Connection transactions will be included in the next mined blocks. This transaction does not lose Stake-Days or Coin-Days. If this Proof-of-Connection transaction does not appear in a block within X blocks (perhaps 30 minutes’ worth?) of the triggering block, their Stake-Days drops back to 0. This would prevent people from accumulating stake by simply keeping their coins dormant.

The parameters could be chosen to try different lengths of expected-time-to-check-in, which would also be dependent on the block production rate. I would suggest a target of something between 6 and 24 hours, although given the random nature of this process, and in the interest of having smaller blocks, perhaps longer times could be used. On a coin with fast blocks, maybe 2 or 3 bytes would be required to match; on a coin with slow blocks, just 1 or 2. Of course, full bytes would not necessarily be required; it could be a bitwise match of a certain number of arbitrary bits from the hash of a block, matched with arbitrary bits from the coin address. Full bytes just make it easier to understand.

The Proof-of-Connection transactions will include the hash of the entire blockchain up to and including triggering block, signed with the address’s private key, in order to tie the PoC transaction with the block that triggered it and also to prove that the address is running a full node. Due to the random nature of this process, all stakeholders will be incentivized to keep their nodes up and running all the time. If they want to shut down for a few days, they will simply not earn stake during that time.

Disclaimer: I am not a coin developer, and I do not believe that I have the resources to develop a coin built on this idea myself, if it should turn out to be a good idea. If somebody wants to do so, or wants to adapt an existing PoS coin to use some of these features, you are free to do so, although I would appreciate some kind of compensation.

If every block will include a check-in log for all wallets, if every wallet only needs 3bytes to identify itself in the log, a million wallets will need 3MB space in every block.

If every block will include a check-in log for all wallets, if every wallet only needs 3bytes to identify itself in the log, a million wallets will need 3MB space in every block.[/quote]

Not every block for every wallet. Every block includes a check-in log for addresses which match the parameters determined by the hash of the previous block(s). So take a million addresses and a 24-hour expected-time-to-check-in, and 10-minute blocks or 144 blocks per day; there will be ~7000 of these transactions per block. Which, granted, is a lot, but 1M connected addresses is a lot. How many Peercoin nodes would you say are connected at any given time? Maybe 1,000? Let’s say an average of 10 stake-holding addresses per node? That’s 10k addresses, or roughly 70 PoC transactions per block.

Still, point taken. Each transaction will obviously need more than 3 bytes (although they should be smaller than normal transactions), and that’s still a lot of space in the blockchain.

Bitcoin is working on “prunable” transactions, i.e. those which can be safely removed from the blockchain by those who don’t wish to store the full thing. Maybe we can say that these “check-in” transactions can be pruned after the stake has been used up. Or maybe it could constitute sort of a “side-chain” where these transactions are stored separately.

Or… I think this would work. Let the expected-time-to-check-in (ETTCI) scale with the # of non-PoC transactions included in the last 24h of blocks. Create the algorithm such that the target is no more than half of the transactions in a given block are PoC transactions. If the coin is lightly transacted and there are lots of stakeholders, then maybe the ETTCI might scale to 7 days or even longer. But as non-PoC transactions get more numerous, the ETTCI will become faster.

The problem I see here, is that all online nodes would need to check in on a regular basis (even once every 24 hours), which creates extra network traffic.

The alternative is some thing we were talking about taking the stake minter out of the main wallet, and away from the private key. This way, there is only two times there is an addition to the block chain:

  1. When a wallet goes offline, into cold storage, and authorizes a minter

  2. When a wallet comes back online, from cold storage, and de-authorizes a minter.

This way people can run an authorized minter for coinage, participate in network confirmations, meanwhile the private keys are in cold storage. Some one might want their wallet in cold storage for 3 to 6 months. Just before they turn it into a cold storage wallet, they would basically “wave goodbye” to the network, and authorize a minter by creating a special transaction.

I called it mint-by-proxy and it’s in this thread here:

www.peercointalk.org/index.php?topic=2467.msg20540#msg20540

I also suggested a transactional cost of 0.02 (to be destroyed) for going into a cold wallet, and 0.02 to come back.

Use these extra coins to create bigger block rewards, or award more than 1% stake per year. Any time we destroy coins it means some one earns new coins too, so that’s good.

I have seen a few proxy/delegation/nomination proposals, and I think they could be made to work with my proposal. With the following huge caveat:

Firstly, an unstated assumption to my proposal is that I think this would have to take place with a pure PoS coin, i.e. not Peercoin but maybe a derivative. Given this, I want to get away from the word “minting” for pure PoS coins. It implies that there is a fundamental difference between PoW mining and PoS minting. There really isn’t, although I can see how in a hybrid PoW/PoS coin like Peercoin, you would want to make the distinction, and “minting” is fairly clever.

The goal of Proof-of-Stake is to replace Proof-of-Work as a system to create and secure the blockchain. What is the goal of mining in PoW coins? Part of it is distribution of new coins (especially when a coin is first launched), but the major part is securing the blockchain. Similarly, the goal of PoS should not be to earn “interest” on holdings, but to create a secure blockchain without using ridiculous amounts of electricity. The PoS rewards should be enough to incentivize mining/minting. Given this, I actually think that the PoS earning rate in most coins is too low. For one thing, I think that all transaction fees in the mined block should go to the miner, regardless of their initial stake value. Yes, this would allow a PoS block miner to earn more coinage than he had to start with, if he had a small amount of coins to begin with and included a lot of transactions into his block. This is just the same as if someone were solo-mining in Bitcoin and found a block and received 25 BTC as his reward.

My proposal is trying to fix the problem of not enough people running active nodes, and not enough incentive to PoS mine. I don’t care about the people that want to keep their coins locked away in cold storage. The more copies of the blockchain that are out there, and the more nodes that are propagating transactions, the better for the health of the network.

I think that the idea of people being able to store up large amounts of stake is flawed, and is part of what my proposal solves. People need to be transacting with their coins, and if they’re not transacting with their coins, then they at LEAST need to be helping to secure the network. The only way for a coin to really be valuable is for it to be useful. And if they are incentivized not to spend their coins for 30-90 days, IMO that is a perverse incentive. I’m not saying that we need to punish people for holding their coins like the demurrage folks, but people should NOT be rewarded for simply owning coins, holding onto them, and connecting to the network sporadically and infrequently. That is pretty much like charity to the lazy. People should be rewarded for doing things that help the network, and rewards should be withheld when they do things that do not help the network. Keeping their coins in cold storage and never connecting to the network is not beneficial to the network.

In a pure-PoS system where a large number of nodes are incentivized to be connected to the network at all times, hopefully the mining/minting rate of PoS blocks would be fairly fast, and most folks with a reasonable amount of coins will be minting blocks every week or two at least.

I have come up with an improvement/refinement to the proposal which will prevent some of the blockchain bloat resulting from the PoC transactions.

Each block mined will distribute PoS earnings to ALL addresses who sent PoC transactions which would have been included in that block. So the PoC transactions aren’t added to the block explicitly, but the addresses will receive outputs from the coinbase transaction which will be the payout of PoS earnings, based on the Stake-Days held by each address. The Stake-Days of those addresses are also reset to 0, since their Stake has been paid out. The actual miner of the block will also receive earned PoS + all transaction fees from that block, and their Stake-Days will also be reset to 0.

In this way, you earn your stake earnings by staying connected, even if you never have enough stake accumulated to actually mine a block. This also consolidates the PoC transactions into a single summary Coinbase transaction, which will cut them down in size somewhat. This also ensures that everybody receives their stake payouts on a consistent and frequent basis, and stake will never get too high, which should cut down on any difficulty whipsawing.

This is a clever idea, but it doesn’t address the OP’s concern of encouraging nodes to stay connected. The authorized minter would still only join the network rarely (when minting is desired).

[quote=“bitbadger, post:6, topic:2135”]The Stake-Days of those addresses are also reset to 0, since their Stake has been paid out.

This also ensures that everybody receives their stake payouts on a consistent and frequent basis, and stake will never get too high, which should cut down on any difficulty whipsawing.[/quote]
This idea shows a lot of promise. Combined with other modifications, it may remove the need to have the 90-day limitation on stake accumulation, because of a periodic stake reset for minting and non-minting coins. Many of the potential attacks on PoS involve collecting a huge stake with which to attack the network by minting many blocks in succession.

This is a clever idea, but it doesn’t address the OP’s concern of encouraging nodes to stay connected. The authorized minter would still only join the network rarely (when minting is desired).[/quote]

When minting is desired?

You don’t mint upon desire. You mint upon luck of creating a Proof-of-stake block.

Since luck requires you to be online minting for a very long time and have multiple attempts, you would leave your minter online and it would stay on the network most of the time.

You could expect this to take several days or weeks. Even then, you mint 1 transaction’s worth of PoS, and you move on to the next oldest aged transaction. Minting is required on an ongoing basis to be fully successful.

Every one is minting. It’s a competitive field to see who mints the next PoS block. It mathematically isn’t easy, and can’t happen upon “desire”.

I don’t understand what you mean “when minting is desired?” and joining the network “rarely”.

Regarding the phrase, “when minting is desired,” I was a bit unclear. I was thinking of the 30 days after successfully minting, during which there is no incentive to attempt to mint. Also, it may be that many wallet holders don’t bother to begin attempting to mint until nearing the 90-day threshold.

I should have said, “The authorized minter might leave the network when minting is not possible, or is unlikely.”

New refinement: The miner should be incentivized to include as many PoC transactions in the block as possible (by way of the coinbase transaction). If they were not included, a malicious miner could keep people from earning their stake. This should be incentivized as an additional bonus earned by the block miner per PoC transaction included. This bonus might be generated in the coinbase transaction, not as fees from the PoC transactions. I’m not sure which would be better.

Also, the coinbase transaction must be made slightly larger by including the signatures of the PoC transaction senders / PoS recipients, which they included in their PoC transactions. The miner must not be allowed to cheat by including fake PoS payouts to addresses that did not send valid PoC transactions. So some space can be saved as per the prior refinement, but not as much as imagined.

An additional problem that must be addressed is the divisibility of the coin. What do you do with somebody who has a very small amount of coins, say 2 Satoshis? You can’t pay out a reasonable amount of PoS earnings/interest to them because you can’t fractionalize a Satoshi. It would be a bad idea to set a minimum PoS payout of 1 Satoshi that everyone gets when their PoS turn comes up, because then that person with 2 Satoshis earns 50% on his first PoS payout. People would divide their coins into many accounts with 1 Satoshi in each, and double their money in short time.

So there needs to be some minimum limit of Stake-Days in order to earn PoS. This can be implemented by saying that only accounts with a certain minimum number of Stake-Days need to stay connected, send PoC transactions, and collect PoS earnings. The person with 2 Satoshis can safely disconnect, and his Stake-Days will grow for a long time, until they are large enough to earn 1 Satoshi in interest. (years? With a 5% yearly interest rate, it would be ~8 years) This limit would also hopefully prevent some blockchain bloat.

[quote=“Chronos, post:9, topic:2135”]Regarding the phrase, “when minting is desired,” I was a bit unclear. I was thinking of the 30 days after successfully minting, during which there is no incentive to attempt to mint. Also, it may be that many wallet holders don’t bother to begin attempting to mint until nearing the 90-day threshold.

I should have said, “The authorized minter might leave the network when minting is not possible, or is unlikely.”[/quote]

It depends on one’s interaction with the system and the number of coins/transactions that one has accumulated. Somebody with many incoming transactions would want to stay connected more regularly, like ppcman stated. On the other hand, many people dabbling/investing in various crypto-currencies buy some on an exchange, get the payout and then just hold on to them, not transacting with them. These people have no incentive to stay connected to the network beyond the minimal amount needed to grow their stake.

Any transaction, including your PoC transaction, has to be recorded in a block to be valid. The blockchain will explode.

Any transaction, including your PoC transaction, has to be recorded in a block to be valid. The blockchain will explode.[/quote]

You’re right, a significant chunk of information has to be included in the blockchain, so the PoC transactions will be have to be crafted to be very minimal.

But I think that the further refinement of having a minimum required number of Stake-Days to send a PoC transaction would help. As would the automatic scaling of PoC trigger frequency, to keep PoC transactions to 1/2 of each block or less.

Overall, it is a trade-off. Yes, the blockchain will be bigger. This will consume some data storage and network resources. On the other hand, mining itself will consume much fewer resources. I believe that in terms of pure cost, storage and bandwidth < compute.

I think that most people would willingly trade off the MW (GW?) of electricity being spent on Bitcoin mining, for a blockchain that is twice as large.

[quote=“Chronos, post:9, topic:2135”]Regarding the phrase, “when minting is desired,” I was a bit unclear. I was thinking of the 30 days after successfully minting, during which there is no incentive to attempt to mint. Also, it may be that many wallet holders don’t bother to begin attempting to mint until nearing the 90-day threshold.

I should have said, “The authorized minter might leave the network when minting is not possible, or is unlikely.”[/quote]

When you mint, you are minting coins based on the oldest transaction of coins you have received. Not based on your entire wallet’s contents or the current unspent coin balance.

So after you minted a block, you do not wait 30 days. You move on to the very next oldest transaction in the list, and start minting using the next transaction as the next stake.

So on, and so on, until eventually you end up with no more mintable transactions.

Since most people have a dozen incoming transactions or more, it feasibly could keep your minter going for a long while to mint PoS blocks for each one.

The only way your concept works is if some one has a wallet, with only 1 transaction in it to mint. Most people buy or receive coins in increments, and have several individual transactions, each one is used towards its own proof-of-stake minted block.

[quote=“ppcman, post:14, topic:2135”][quote=“Chronos, post:9, topic:2135”]Regarding the phrase, “when minting is desired,” I was a bit unclear. I was thinking of the 30 days after successfully minting, during which there is no incentive to attempt to mint. Also, it may be that many wallet holders don’t bother to begin attempting to mint until nearing the 90-day threshold.

I should have said, “The authorized minter might leave the network when minting is not possible, or is unlikely.”[/quote]

When you mint, you are minting coins based on the oldest transaction of coins you have received. Not based on your entire wallet’s contents or the current unspent coin balance.

So after you minted a block, you do not wait 30 days. You move on to the very next oldest transaction in the list, and start minting using the next transaction as the next stake.

So on, and so on, until eventually you end up with no more mintable transactions.

Since most people have a dozen incoming transactions or more, it feasibly could keep your minter going for a long while to mint PoS blocks for each one.

The only way your concept works is if some one has a wallet, with only 1 transaction in it to mint. Most people buy or receive coins in increments, and have several individual transactions, each one is used towards its own proof-of-stake minted block.[/quote]

It doesn’t work in order of coin-days / stake? Like, say I received 1 coin on day 1, and 30 coins on day 10. On day 40, the first transaction will have 40 coin-days and the 2nd transaction will have 900 coin-days. I think that the 900 coin-days transaction will have a lot better chance of minting a block. (Ok, maybe the numbers should have been 11 and 41 etc., but you get the idea, and of course this doesn’t take into account the time-of-day when received, etc. These are just round example numbers.)

And actually, I think that people have an incentive to combine all of their coins into one transaction, as it gives them more coins to use for stake. If you’ve got 2, 3, 5, 2, 7, 9 coins all in different transactions, you’re going to have a hard time building-up coin-days for each of those. Better to do a consolidation transaction (even though it resets the coin-days for the earliest coins) to get 38 coins all in one transaction, which will mine PoS blocks more quickly and reliably.

Of course, this all depends on how many coins you have in the first place. If you’ve got thousands and thousands of PPC, it might not matter. But for those of us who were late getting into the game, and who only have single-digit or double-digit PPC, I think that consolidating the coins would be a better option.

Consolidating coins could work for having a larger transaction to use as stake.

But when you consolidate coins, it also can cost more in transaction size (kb) and therefore cost you a higher than 0.01 transaction fee. Understand that it isn’t 0.01 per transaction. It is 0.01 per kb

So if you spend a lot of money consolidating a bunch of fragmented amounts of coins, just to earn 1% stake, then it might not be beneficial for a few years, because you have to break-even on the cost of consolidation first.

bitbager, I enjoy your ethusiasm to put the ideas forward. It is unfortunate that you are still coming up to speed on how this all works though. I’m just barely understanding the inner workings of the code myself and I’ve been around since June 2013 or so.

The best way to see how this stuff works is to download a copy of the source code, put some printf statements through out it, and run your own node on testnet. You can see how proof-of-stake and minting works that way. (That’s what I did).

To be honest though, I did come to these conclusions with BCX (Battlecoin), who appeared to use a ppcoin 0.2.0 proof-of-stake code in it, and that’s how that stake minter was working.

I don’t know if it is the same in ppcoin 0.3 or ppcoin 0.4, but I am assuming it might.

Either way, let’s wait until 0.4 is released and hear from Sunny on what is planned for the next release after this…

People have been saying on the forums “there is nothing to encourage people from staying on the network and mint”

…but guess what has been happening from 2012 until now? There have been people staying on the network and mint.

All the theories people have aren’t true when you look at the network history and amount of proof-of-stake blocks.

[quote=“ppcman, post:14, topic:2135”]When you mint, you are minting coins based on the oldest transaction of coins you have received. Not based on your entire wallet’s contents or the current unspent coin balance.

So after you minted a block, you do not wait 30 days. You move on to the very next oldest transaction in the list, and start minting using the next transaction as the next stake.

So on, and so on, until eventually you end up with no more mintable transactions.[/quote]
This makes sense. However, your explanation seems to imply that minting must occur in order, starting from oldest transaction, to the newest. Instead, any of a wallet’s transactions can mint a new block at any time, provided it is older than 30 days. The oldest transaction is not even necessarily the most likely to mint successfully, since it may have smaller stake than a newer transaction. And, even if it also has the greatest stake, it may still fail to mint first, simply due to bad luck.

[quote=“Chronos, post:17, topic:2135”][quote=“ppcman, post:14, topic:2135”]When you mint, you are minting coins based on the oldest transaction of coins you have received. Not based on your entire wallet’s contents or the current unspent coin balance.

So after you minted a block, you do not wait 30 days. You move on to the very next oldest transaction in the list, and start minting using the next transaction as the next stake.

So on, and so on, until eventually you end up with no more mintable transactions.[/quote]
This makes sense. However, your explanation seems to imply that minting must occur in order, starting from oldest transaction, to the newest. Instead, any of a wallet’s transactions can mint a new block at any time, provided it is older than 30 days. The oldest transaction is not even necessarily the most likely to mint successfully, since it may have smaller stake than a newer transaction. And, even if it also has the greatest stake, it may still fail to mint first, simply due to bad luck.[/quote]

Sorry it took me 889 days to reply to this…
but you are correct [member=29308]Chronos[/member] - it has been happening in my wallet and I can confirm that it is true. :slight_smile:

I never really minted much stake because I never tried much. I’ve been minting stake lately, and I can see it will mint from transactions wherever it wants. I think it makes it more interesting this way.

There’d be nothing worse than seeing me stuck at my very first transaction of 0.05 as a test to my new wallet as an example, and then be stuck there until it could mint.

That doesn’t happen.

Instead it will jump around and mint from a transaction of 25 ppc or 100 ppc if it wants. I prefer it, exactly the way you described.

Interesting topic :slight_smile:

I think the PoS mechanism of PPC is pretty out-dated, compared to other PoS currencies such as Blackcoin or the likes, considering huge wallets can still basically just mint massive amounts of PPC by going online and offline within a day and contributing not really much to the network, whereas with other PoS coins, it’s been proved to be a more successful incentive for holders to be continuously online and thus support and strenghten the core network better.

Is there any chance that a developer is going to seriously consider a revamp of the PoS protocol in the foreseeable future? I have been following the development for many years and I know it’s pretty slow and steady but other than some convenience fixes in the upcoming v. 0.6 it doesn’t really seem to change much at all in terms of how distribution of PoS works, which I do think PPC is lacking behind currently.

Would be great to hear some feedback in terms of this, as most would agree it’s only healthy for the network and for the smaller stakeholder :slight_smile:

Have a great weekend all!