Skip to content

Instantly share code, notes, and snippets.


Gert-Jaap Glasbergen gertjaap

View GitHub Profile
gertjaap /
Last active Dec 4, 2019
Nicehash monitor

Nicehash monitor

The idea is simple. We build a proxy that connects to Nicehash as one or more stratum clients (both EU and US endpoints preferably), and acts as a stratum server to miners.

The work that Nicehash sends contains the previousBlockHash. We run full nodes to all coins using Lyra2REv3, and index those blocks. We can then lookup the previousBlockHash that's part of the stratum work in our set of known blocks. If it is absent from there, there is most likely someone privately mining blocks.

We add a public frontend to this data that shows all work on blockhashes not matching any known public blocks. We keep the work given to the miner archived in a database, so that in case of an actual reorg we can prove Nicehash was used to conduct the attack.

The reason for actually mining versus just connecting to stratum and reading work, is that Nicehash will eventually kick you off their stratum server if you don't submit any work.

View lint.txt
share/qt/ invalid syntax at "print('Cannot extract strings: xgettext utility is not installed or not configured.',file=sys.stderr)"
test/functional/ invalid syntax at "print("Opening latest test directory: {}".format(testdir), file=sys.stderr)"
test/functional/ invalid syntax at "def next_block(self, number, spend=None, additional_coinbase_value=0, script=CScript([OP_TRUE]), solve=True, *, version=1):"
test/functional/ invalid syntax at "def get_node_output(self, *, ret_code_expected):"
test/functional/ invalid syntax at "def chain_tip(b_hash, *, status='headers-only', branchlen=1):"
test/functional/ invalid syntax at "def __init__(self, *, str_data):"
test/functional/ invalid syntax at "def bootstrap_p2p(self, *, num_connections=1):"
test/functional/test_framework/ invalid syntax at "def create_block(hashprev, coinbase, ntime=None, *, versio
gertjaap / dlcflow
Last active Apr 13, 2018
Message flow for DLC
View dlcflow
// Structure for storing the contract data
type DlcContract struct {
Idx uint64 // Index of the contract for referencing in commands
ContractPubKey [33]byte // Unique key for the contract so we can reference it in messages (accept/decline) in case we have more than one contract between two peers
CoinType uint32 // Coin type
OracleA [33]byte // Pub keys of the oracle
OracleR [33]byte // Pub key of the data point we are using
OracleTimestamp uint64 // Expected timestamp (epoch) of publication
ValueAllOurs, ValueAllTheirs uint64 // The values of the data point based on which all money in the contract goes to either party