Author

Topic: messing around with forking: cpu mine a valid block by hand (no pool, no solo) (Read 126 times)

hero member
Activity: 675
Merit: 504
I've been messing around with blockchain technology for a while now... Creating my own (private) coins cloned from litecoin to learn a bit. I'm not a shitcoin coder, nor do i plan to become one... My coins are usually private, or shared with a very limited number of people, not that premined ICO crap intended to line the pockets of the devs so they can run away with peoples money.

Mind you, i'm not a programmer, i do script once in a while (python, php, perl), so i do know how to read litecoin's sourcecode... However, editing the sourcecode itself is always a pain.

I've recently cloned a private coin using LTC 0.17 as a starting point, i generated a couple thousand blocks (using the generate rpc) and now i wanted to try to create a fork at height 701...
Theoretically, i know what to do:
  • use the rpc "getblockhash 700" to get the hash of block 700
  • use the rpc "getblock " to get the difficulty which was applicable at height 700 (and since there was no diff retarget at this point, this diff should also be valid for height 701)
  • generate a coinbase transaction and find the merkle root of this transaction
  • using the blockhash of block 700 and  the merkle root, iterate trough the nonces to find a new block header whose scrypt hash is under the target (target can be calculated by using the difficulty)
  • actually create the block at height 701 by combining the coinbase transaction and the block header i just found by iterating trough the nonces
  • Add a checkpoint to my sourcecode with the hash i found for height 701, compile, make sure all my nodes are running the new version
  • using the rpc "submitblock" to submit block height 701

The problem is that i'm not a programmer, i can't wrap my head around writing a script that actually takes the difficulty, previous block header and one of my addresses as input, then creates a coinbase tx, a merkle root, a header, iterates trough the nonces untill scrypt(header) < Target, then returns the hex of the valid block so i can include a checkpoint and submit the block.

Is there anybody who has such a script somewhere on his shelve, or is able to point a relatively tech-savvy NON-programmer towards some documentation or half-finished project i can use?
Jump to: