Files
carrotcoin/docs/protocol.md
2024-02-10 20:32:46 +01:00

1.4 KiB

Protocol of the carrotcoin cryptocurrency

The carrotcoin cryptocurrency is a bitcoin-like currency with proof-of-work, created just for learning purposes.

Blockchain

The network should stabilize at around 1 block every 5 minutes.

Blocks are hashed with SHA256 and need to start with a certain number of zeros (or, more precise, be below a given value depending on the difficulty)

ed25519 keys are used to validate transactions.

block datastructure

content size (bytes)
previous hash 32
message (arbitrary) 32
nonce 8
timestamp (unix time in seconds, BE) 8
block id (BE) 4
miner pubkey 32
transaction (optional) 148

If no transaction is included, its 148 bytes are all null.

The first block has block id 0 and a "previous hash" value of 32 null bytes.

transaction datastructure

1 carrotcoin (cc) consists of 100 cents

content size (bytes)
id (arbitrary) 4
sender (pubkey) 32
receiver (pubkey) 32
amount (BE, in cents) 8
transaction fee (BE, in cents, can be zero) 8
signature (signed by sender, over transaction fields before signature) 64

transactions

For every block, the miner gets a reward of 1,00 cc. (100 cents)

If a transaction is included, the following happens additionally:

  • The sender needs to pay "amount" + "transaction fee"
  • The receiver gets "amount"
  • The miner gets "transaction fee" on top of the reward.