Bitcoin Forum
June 28, 2024, 01:24:14 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Porting bitcoinj -- specific issue?  (Read 2605 times)
magcoin-crypto (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 0


View Profile
August 08, 2014, 01:46:57 AM
 #1

So, I've been doing some dev work and I'm a little stuck. I managed to change most parameters of bitcoinj to match my coin -- merkel hash, genesis hash, the works! Grin

However, under NetworkParameters, I can't seem to crack the second hex value.

I've determined as much that the first is simply the scriptSig from the genesis block, so difficulty bits + timestamp message.

Here's a snippet of the try catch around it:

try {
            // A script containing the difficulty bits and the following message:
            //
            //   "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"
            byte[] bytes = Utils.HEX.decode
                    ("04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f7 2206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73");
            t.addInput(new TransactionInput(n, t, bytes));
            ByteArrayOutputStream scriptPubKeyBytes = new ByteArrayOutputStream();
            Script.writeBytes(scriptPubKeyBytes, Utils.HEX.decode
                    ("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3 8c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f"));
            scriptPubKeyBytes.write(ScriptOpCodes.OP_CHECKSIG);
            t.addOutput(new TransactionOutput(n, t, FIFTY_COINS, scriptPubKeyBytes.toByteArray()));
        } catch (Exception e) {
            // Cannot happen.
            throw new RuntimeException(e);
        }

How does one even find the second value? It appears to be a public key of sorts.
Stouse49
Full Member
***
Offline Offline

Activity: 209
Merit: 100



View Profile
January 13, 2015, 07:09:53 AM
 #2

Look in the C++ source code for your coin.  That second value is in the section that creates the Genesis block.

BTC:
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!