Implement gambling
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
The carrotcoin cryptocurrency is a bitcoin-like currency with proof-of-work, created just for learning purposes.
|
||||
|
||||
A special feature is its builtin option for gambling.
|
||||
|
||||
# The currency
|
||||
|
||||
One carrotcoin (abbreviated cc) consists of 100 cents. Internally, only cent amounts are processed using integer fields. The recommended notation for an amount is like in this example:
|
||||
@@ -93,6 +95,7 @@ If a payment transaction is included, the following happens additionally:
|
||||
If a gambling transaction is included, the following happens additionally:
|
||||
|
||||
- The player needs to pay "gambling amount" + "transaction fee"
|
||||
- The miner gets "transaction fee" on top of the reward.
|
||||
|
||||
If a gambling reveal transaction is included, the following happens additionally:
|
||||
|
||||
@@ -182,13 +185,13 @@ Technically, gambling happens in the following steps:
|
||||
|
||||
## Gambling transaction
|
||||
|
||||
A user can create a gambling transaction at any time to participate in the gambling process. Such transactions are described above in the section "Blockchain" / "transaction datastructure" / "gambling transaction". The id and player fields (along with other information) will be used to calculate, if the player wins.
|
||||
A user can create a gambling transaction at any time to participate in the gambling process. Such transactions are described above in the section "Blockchain" / "transaction datastructure" / "gambling transaction". The id and player fields (along with other information) will be used to calculate if the player wins.
|
||||
|
||||
## Gambling commitment blocks
|
||||
|
||||
To find out which block is a gambling commitment block, you need to number all blocks of the blockchain. The first block (this is the one with 32 nullbytes in the "previous hash" field) gets block number 0. From there on, just count up. (The block number of a block is the block number of its previous block plus one.)
|
||||
|
||||
Every block with a block number of 255 (modulo 256) is a gambling commitment block. Its hash value will also be relevant to calculate, if a player wins.
|
||||
Every block with a block number of 255 (modulo 256) is a gambling commitment block. Its hash value will also be relevant to calculate if a player wins.
|
||||
|
||||
## Decision of winning / losing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user