Describe mining messages

This commit is contained in:
2024-02-25 15:26:27 +01:00
parent ea2d9577ae
commit e041a8cb04

View File

@@ -145,6 +145,36 @@ A "block transfer" message is sent back in response to a "block request" message
|---|---| |---|---|
| protocol version = 0 (BE) | 2 | | protocol version = 0 (BE) | 2 |
| capable version = 0 (BE) | 2 | | capable version = 0 (BE) | 2 |
| type = 4 (BE) | 1 | | type = 6 (BE) | 1 |
| list position (0 <= x < 1024) (BE) | 2 | | list position (0 <= x < 1024) (BE) | 2 |
| transaction | 148 | | transaction | 148 |
## Client to Node message packet formats
### Mining task request (Client -> Node)
| content | size (bytes) |
|---|---|
| protocol version = 0 (BE) | 2 |
| capable version = 0 (BE) | 2 |
| type = 7 (BE) | 1 |
The node should answer to a "Mining task request" with a "Mining task response"
### Mining task response (Node -> Client)
| content | size (bytes) |
|---|---|
| protocol version = 0 (BE) | 2 |
| capable version = 0 (BE) | 2 |
| type = 8 (BE) | 1 |
| timestamp (unix time in seconds, BE) | 8 |
| previous hash | 32 |
| difficulty sum (BE) | 32 |
| transaction (optional) | 148 |
The node tells the miner "timestamp", "previous hash", "difficulty sum" and "transaction" for the new block.
The miner fills "nonce", "message" and "miner pubkey" on its own.
When a miner finds a block, it sends a "block transfer" message to the node.