Photo by Esther Jiao on Unsplash

Analyzing RSK Blocks: Miners

Angel Java Lopez
2 min readNov 2, 2020

--

Some months ago, I wrote about Command Line Tools for RSK Node; now those tools are included in the latest RSKJ release (under the package with name co.rsk.tools.cli).

Using a local testnet database, I exported 5000 blocks with the command:

java -cp <rsk.jar> co.rsk.cli.tools.ExportBlocks 718000 722999 --testnet > testnetblocks.txt

These days, I wrote new commands in JavaScript to analyze that info, specially to obtain the blocks mined by each miner account.

Counting the Blocks

Using count.js, I executed:

node count testnetblocks.txt

The output was:

no blocks 5000
no transactions 250849
average no transactions per block 50.1698
no uncles 6461
average no uncles per block 1.2922
no uncles same miner 4126
total size (bytes) 57563723
block average size (bytes) 11512.7446

It’s interesting to see that the number of uncles included into a BLOCK that belongs to the same miner that the one that builds the block, it’s only around 2/3, so each miner uses the blocks received from other miners.

Blocks by Miner

Using miners.js, I executed:

node miners.js testnetblocks.txt

the output was:

{
"1fab9a0e24ffc209b01faa5a61ad4366982d0b7f": 3933,
"b774aa2876145b2f6f3de27e5e6ac970aa12d771": 1067
}

There are only two miners in RSK testnet. More interesting result could be obtained from mainnet block ranges.

Blocks and Uncles by Miner

I also wrote minersu.js and executed:

node minersu.js testnetblocks.txt

This time not only the blocks were processed but also their uncles. The result was:

{
"1fab9a0e24ffc209b01faa5a61ad4366982d0b7f": 8702,
"b774aa2876145b2f6f3de27e5e6ac970aa12d771": 2759
}

Pending Work

The minersu.js command was written thinking on processing NOT only the blocks that were included into the main chain, but also siblings (avoiding to count repeated uncles more than once). I should modify the export blocks commands to export the known siblings in the working database (it could vary from node to node). Now, that command line tools only exports the blocks included in the mainchain.

I want to add also more analysis, ie, the works executed by federated accounts (ie which one sends more transaction and info, etc)

Angel “Java” Lopez

--

--