My forged block #2

Here is another block that links back to a block with a null hash, an alternative block #1. It is the hex form of the block.:


I am pretty sure it’s valid. If not, please let me know.
Here’s how to get a block object out of this:

Nimiq.Block.unserialize(Nimiq.BufferUtils.fromHex("[hex string here]"))

It’s a fairly basic block, with no transactions, and basically no mining difficulty.

Here’s how I made it:


const nullHash = Nimiq.Hash.NULL;
const randomHashBlake = Nimiq.Hash.blake2b("smitop");
const randomSha256 = Nimiq.Hash.sha256("smitop");

const interlink = new Nimiq.BlockInterlink([], nullHash);
const interlinkHash = interlink.hash();

const body = new Nimiq.BlockBody(Nimiq.Address.NULL, [], Nimiq.BufferUtils.fromUtf8("smitop"), []);
const bodyHash = body.hash();

const header = new Nimiq.BlockHeader(nullHash, interlinkHash, bodyHash, randomHashBlake, 1, 1, Math.floor( / 1000), 5);

const block = new Nimiq.Block(header, interlink, body);


1 Like

What would be the use of this in any form? Super interesting that if can be done so easily as well as serialized and deserialized, I’m curious how I and others could use it in our applications. I’m thinking it would only be useful for a miner since I can’t think of anything else that requires building blocks, but maybe it’d be good for building genesis blocks for private testnets? Any other ideas?