Understanding Of Proof-of-stake

Discussion in 'Questions' started by Dyrk, Jan 13, 2016.

  1. 2017/12/15 - Decred v1.1.2 released! → Release Notes  → Downloads
  1. davecgh

    davecgh Hero Member
    Developer Organizer

    Dec 31, 2015
    642
    788
    Male
    United States
    Ultimately I would expect there to be a way to perform buying a ticket through a GUI, however at launch I'm fairly certain it will only be possible via the command line and dcrwallet daemon at launch. As far as I know the copay-based GUI wallet won't be able to handle staking at launch, but one of the devs working on that would have to confirm.

    You can use the CLI and dcrctl utility you can get a list of outstanding tickets via the gettickets RPC and expired tickets via the missedtickets RPC. However, there is no GUI way to do these things. Obviously that would be ideal and something the community can help with.

    Your wallet (or once stake pools are out there, the pool) needs to be online when a ticket is selected in order to receive a winning ticket notification. The wallet (or pool) will then vote according to how it's configured to vote.

    This has been answered in detail already. Please read the entire thread.

    This has already been answered in the thread as well. Purchasing a ticket only locks the coins, it doesn't consume them. When you vote, you unlock the original coins and receive a reward. In other words if you purchase a ticket for X DCR and the reward is Y DCR, you end up with X+Y DCR.

    A vetoed block still exists, it's just the normal transaction tree and PoW/dev subsidy in it is invalidated. So, it does not cause a chain reorganization. Miners still follow the chain with the most PoW as normal. Miners can tell their block was vetoed by examining the vote transactions broadcast to the network for the previous block once that block has been broadcast for something more real-time, or by looking at the voting bits in the header of the next block.
     
    Morphy, tacotime and Dezryth like this.
  2. davecgh

    davecgh Hero Member
    Developer Organizer

    Dec 31, 2015
    642
    788
    Male
    United States
    As far as I know, there won't be any code in place to actually set policies like that at launch. I mention them because the system is designed to allow such things to happen. As more development takes place, I would imagine stake pools will form with their own set of policies and users can choose which pool(s) to join and how to allocate their staking according to their preferences.
     
    jinlei likes this.
  3. Blizzy

    Blizzy Full Member

    Jan 4, 2016
    225
    109
    Male
    Please Dave don't leave us alone! This community needs people like you,really!
     
  4. above

    above New Member

    Jan 12, 2016
    33
    13
    Will the odds stay the same to win the next lottery if you have won the previous one?

    Also how many tickets will there be available for sell per block? since max 20 may be purchased per block.
     
  5. Terminator

    Terminator New Member

    Dec 31, 2015
    2
    1
    Male
    Probably those with experiece can start to organize to build a pool?
     
  6. davecgh

    davecgh Hero Member
    Developer Organizer

    Dec 31, 2015
    642
    788
    Male
    United States
    Yes, every lottery is independent. A ticket's probability of being selected each block is always based on the number of tickets in the ticket pool at the time of the lottery. There is no bias based on age. That is why it's possible your ticket may never win, even though statistically the average win time is 28 days. It's also why the expiration time is 40960 blocks (~4.7 months) so that there is around a 99% chance the ticket will be selected before expiring.

    There is no limit to the number of tickets for sale. Each participant that wants to purchase a ticket submits an sstx (stake submission transaction) to the network. As you noted, only 20 of that type of transaction can be mined into the stake transaction tree for each block which effectively limits the number of tickets that can be purchased per block to 20. An sstx, like all transactions, can have a fee associated with it. So if there is high demand for ticket purchase, you might want to pay a higher transaction fee so the miners prefer yours over others.

    As previously mentioned, the ticket price is dynamically adjusted based on demand, so if there is persistent high demand for tickets, the price will rise which will in turn cause fewer tickets to be purchased which in turn causes the price to fall which results in more demand and the cycle continues. The result is a ticket market where the price to reward ratio reaches an equilibrium.
     
    Morphy and chappjc like this.
  7. davecgh

    davecgh Hero Member
    Developer Organizer

    Dec 31, 2015
    642
    788
    Male
    United States
    There will be some details about building a stake pool released soon. I would expect that will be a good starting point for those interested.
     
    Freemind likes this.
  8. drunkenmugsy

    drunkenmugsy Sr. Member
    Advocate (Reddit)

    Dec 28, 2015
    405
    218
    Male
    #48 drunkenmugsy, Jan 26, 2016
    Last edited: Jan 26, 2016
    When you say stake ticket price what are you referring to? The amount of decred it takes to purchase(or put in reserve as I understand?) a single stake or ? I dont think this was explained anywhere.
     
  9. davecgh

    davecgh Hero Member
    Developer Organizer

    Dec 31, 2015
    642
    788
    Male
    United States
    Yes. I did explain it earlier, but I'll clarify here a bit since more details about the block header have been released. There is a minimum amount of decred it takes to purchase a ticket (put in reserve) for a block.

    Looking at the block header specification, you can see the SBits field (stake difficultly target, aka ticket price) that determines this. That value is adjusted every 144 blocks (12 hours on average) based on the number of currently active stake tickets (the PoolSize field) and number of new tickets purchased per block (sum of the FreshStake fields) across the retarget interval.
     
    tacotime, David and Blizzy like this.
  10. drunkenmugsy

    drunkenmugsy Sr. Member
    Advocate (Reddit)

    Dec 28, 2015
    405
    218
    Male
    Yes I do recall you posting this now that I read it again. I guess I was looking for a number we would start at. But then it is all dynamic depending on how many people stake how many coins. We start at 0 if only for an instant... I get it 8)
     
  11. David

    David Sr. Member

    Jan 22, 2016
    364
    207
    Male
    USA
    Great questions everyone, and great answers @davecgh! Thank you for explaining the PoS system. This helped clarify quite a bit.
     
  12. Neurosploit

    Neurosploit New Member

    Jan 19, 2016
    36
    13
    Male
    .NET Software Engineer
    Amsterdam
    #52 Neurosploit, Jan 29, 2016
    Last edited: Jan 30, 2016
    Thanks for providing the extra information about proof of stake. I think I'll just put it up on a vps somewhere for it to be up 24/7.
     
  13. tries

    tries New Member

    Dec 31, 2015
    2
    1
    Male
    Switzerland
    @davecgh, thank you for this detailed and interesting elaboration on PoS. So far, all my questions about PoS have been answered by reading this thread.
     
  14. Bagdar13

    Bagdar13 New Member

    Jan 27, 2016
    39
    15
    Male
    Good Morning,

    So having gotten it all up and running (wallet mining staking etc) I was wondering what the command was to check the amount you have staked. I couldn't find it anywhere on the wiki or here, so if someone could tell me the command to check number of tickets and number of decred that you have staked that would be great!

    Thanks,
     
  15. sambiohazard

    sambiohazard Sr. Member

    Jan 21, 2016
    844
    372
    You can use command below to check your tickets. It will return hash of sstx you sent to purchase your ticket.

    dcrctl --testnet -u user -P pass --notls --wallet gettickets 1

    I am looking for a way to see what was my stake reward for voting successfully but haven't found anything yet. Also what is the time for stake reward to mature & show up in balance?
     
  16. Bagdar13

    Bagdar13 New Member

    Jan 27, 2016
    39
    15
    Male
    #56 Bagdar13, Jan 30, 2016
    Last edited: Jan 30, 2016
    So, as far as I can tell its like 1 day to stake after buying the ticket, then on average 28 ish days to get a reward. I think its 16 block confirmation time after the random successful lottery pick. I don't know the form of the generating function (Poisson, gaus etc.)

    However, I cant figure out how to track if this has happened/when it has happened. I guess a good block explorer would be able to do this if you just click on the address it would show the payments to the addresses, however, I am not up for coding that right now :)

    also looks like ticket price was cheap when i told the system to stake

    "44a7636ff342c2ec24004020ea35997ba4a25bf3fdf025527b3590329d88300d",
    "660f1fbf74a474c3ffe2c29d507417139b4c6ca0b322e4aca71e78c64dc8ce25",
    "bb5825d7bbe06736b8bb4530144496f14c0d1fb832976f606e91a0c1325e9026",
    "25f63dc5b19ffc24e5f0f5c3122fd51c5363db3f3fda84479b5ad6ff5807662b",
    "52932470364b2f99e2c9b0baea29e43c11a89318c185054943619153f98f943d",
    "0885f2309ef97bd860df4f528236891514bbe563fe220ffad9c900aa2ccace41",
    "4100131a622c1c16f9538fd7224fdd871e3b5eddf26f57d1de887f49306c4752",
    "a5bbad3d54d12fd14979e01f5bf894ca40af33bb21cbd5dc58667ce8b116b153",
    "8996e657b80c37f31dda54e55b90bb79d940e67b64b2acf6778316042a567261",
    "6e180fa37eb08813e056999b007ac7079bdbf0b1f067ebba70fa7f5d0c7b0893",
    "8a7e994d165bfd0bbff1ae8ab009aac9d4558fc32e4bf8bbbb45925bcc7b24a2",
    "f5656fd570c9620c1aa038e680cdedfee9790491bf3a73c9e2f32d915a974da4",
    "991d55b68d117bbf9b9ba8e4c90ce67cb3bad09f49f457298e96ebb1240a36b3",
    "b0165c082c71417b5ec9e20cfa4c8ec56f6f68c239203cd762876922811b04be",
    "e7045c2107184cf2d5ac741632a26b3429793f1a298359ad68e1c37d3ef809c3",
    "2691d459d63a7f0d3f9c0dc547493f19e814d7624c7298e7d19e6bfb4794ffc4",
    "fbdadcffe41a039c3a63b691bc59914470bccd985acd808eb6608f223f049dca",
    "2b4a10bd1cfd4133640cf5ec764685f65547cb8a776c86a601efb09b1d3643f9"
    ]

    I only had like 105 Decred in the wallet....will report back in 2 days or so if this results in any mining activity
     
    sambiohazard likes this.
  17. Blizzy

    Blizzy Full Member

    Jan 4, 2016
    225
    109
    Male
    @davecgh I have made one vote!

    21:46:08 2016-01-30 [INF] WLLT: Voted on block 00000000001a8391ed0588da15dc350536400daf9c4faa01d507a5452a6619e8 (height 3577) using ticket 1e8edbbebc0
    1c2a8a3264de7826dd4f772094c5bcdedcad941fb452778171134 (vote hash: 23b04fe1cb1c8b335781ca979d37e43043b08e1af4c97151fa041d3fec45807c)

    Were i can set the yes or no option?

    Is there any command to see the reward?

    thanks!
     
  18. davecgh

    davecgh Hero Member
    Developer Organizer

    Dec 31, 2015
    642
    788
    Male
    United States
    You can manually set the --votebits parameter on dcrwallet. So to vote no, you'd set it to 0. However, that will vote no to all blocks. It's only really just the infrastructure that is in place currently. Obviously there will need to be better ability to tweak policy, preferably through a GUI and that will certainly come with time. The most important thing at the current time is having the infrastructure in place and working properly.

    As far as the stake reward, there is not an easy way to do it right now. There is an open issue (https://github.com/decred/dcrwallet/issues/6) for a new RPC to do that though.

    In the mean time, you basically have to issue a getrawtransaction <votehash> 1 and look at the vout values to find it. So for your particular case here:

    Code:
    $ dcrctl getrawtransaction 23b04fe1cb1c8b335781ca979d37e43043b08e1af4c97151fa041d3fec45807c 1 | grep value
      "value": 0,
      "value": 0,
      "value": 7.93480071,   <---- This is what you got back
    
    Now if we look at your original stake ticket purchase:
    Code:
    $  dcrctl --wallet getrawtransaction 1e8edbbebc01c2a8a3264de7826dd4f772094c5bcdedcad941fb452778171134 1 | grep value
      "value": 6.4496522,   <---- The original ticket purchase price
      "value": 0,
      "value": 29.0537158,
    
    We can see that your balance went up by 7.93480071 - 6.4496522 = 1.48514851 DCR.
     
    Morphy, Scott Briggs, David and 3 others like this.
  19. Blizzy

    Blizzy Full Member

    Jan 4, 2016
    225
    109
    Male
    #59 Blizzy, Jan 30, 2016
    Last edited: Jan 30, 2016
    This happened because i forgot to unlock the wallet?


    02:07:18 2016-01-31 [ERR] WLLT: Cannot handle chain server voting notification WinningTickets: failed to sign ssgen or ssrtx, error: address manager is locked

    02:08:19 2016-01-31 [ERR] WLLT: Cannot handle chain server voting notification MissedTickets: failed to sign ssgen or ssrtx, error: address manager is locked
     
  20. davecgh

    davecgh Hero Member
    Developer Organizer

    Dec 31, 2015
    642
    788
    Male
    United States
    @Blizzy Yes, the wallet has to be unlocked in order to sign transactions.
     
    Blizzy likes this.

Share This Page