MerosCrypto / Meros

An instant and feeless cryptocurrency for the future, secured by the Merit Caching Consensus Mechanism.
https://meroscrypto.io
Other
82 stars 19 forks source link

Send and Data Difficulties should use 2-bytes. #268

Closed kayabaNerve closed 3 years ago

kayabaNerve commented 3 years ago

This issue has two facets:

1) The existing protocol isn't valid.

- difficulty: An unsigned 64-bit number representing the difficulty for the Send Transactions' spam filter.

`SendDifficulty` has a message length of 10 bytes; the 2-byte holder, 4-byte nonce, and the 4-byte difficulty. The signature is produced with a prefix of "\2". That said, `SendDifficulty` is not a standalone message type.

It declares an 8-byte number with a 4-byte serialization.

2) Even 4 bytes is extremely high and unnecessary. The difficulty represents the divisor on the chance of producing a valid hash. A difficulty of 6 means an average of 3 attempts will be needed. Why should any transaction take 2 billion hashes to produce a valid spam proof? It should only use 2 bytes.