Bitcoin Forum
May 28, 2024, 02:52:12 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: messing around with forking: cpu mine a valid block by hand (no pool, no solo)  (Read 112 times)
merelcoin (OP)
Hero Member
*****
Offline Offline

Activity: 675
Merit: 504


View Profile
August 01, 2019, 07:34:23 AM
 #1

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 <hash>" 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?
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!