0xB10C / stratum-observer

WORK-IN-PROGRESS stratum job monitoring
3 stars 1 forks source link

coinbase tag parsing can skip the coinbase height #9

Closed 0xB10C closed 2 months ago

0xB10C commented 5 months ago

Currently, the coinbase tag is parsed based on the whole script sig. But we can skip the coinbase height, which should reduce the random characters included coinbase tag.

https://github.com/0xB10C/stratum-observer/blob/96b053478219ce624a0a401d593bcb8dca2efb5b/src/utils.rs#L41-L55

0xB10C commented 2 months ago

Looking into it in https://github.com/0xB10C/stratum-observer/pull/11, I noticed that the BIP-34 coinbase height does not have an effect on the extracted string.

However, some pools (for example, Foundry, MaraPool, SpiderPool, and SBICrypto) include a timestamp in the block. This timestamp sometimes shows up in the extracted string.

An example the scriptSig of Foundry's coinbase transaction dbb5ac4b963babbaa3a7c85ef234959a702d583c09f1a609ad7f5b80cc0c064a of block 856604: 031c120d048867bb662f466f756e6472792055534120506f6f6c202364726f70676f6c642f4892b78e0000b3b25d010000.

This script sig consists of

- 031c120d: 3 byte long, low-endian BIP-34 block height (856604) 
- 048867bb66: 4 byte long, low-endian timestamp (1723557768)
- 2f466f756e6472792055534120506f6f6c202364726f70676f6c642f: ASCII text "/Foundry USA Pool #dropgold/"
- 4892b78e0000b3b25d010000: some other (unidentified) data