Thanks Andreas but I am running out of time that is why I could get from
.NET since I needed only string.
Only last week I ventured into bitcoinj api and due to lack of time, I
couldn't go deep into code.
I have looked into the bitcoin core code and the string
"04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73"
is already hardcoded.
NetworkParameters.java
Method: private static Block createGenesis(NetworkParameters n)
// 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
("04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73");
On Saturday, May 5, 2018 at 10:02:21 PM UTC+8, Andreas Schildbach wrote:
>
> Have you tried looking at the Bitcoin Core code for this message? That's
> where it comes from originally.
>
>
> On 05/03/2018 03:12 PM, Commentors-net wrote:
> > I manage to convert but not via java.
> > I need string so I could get it easily using .net version NBitcoin and
> > best part is that it is exactly same implementation as C++.
> >
> >
> > On Wednesday, May 2, 2018 at 9:11:36 AM UTC+8, Commentors-net wrote:
> >
> > In the code we have
> >
> >
> 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73
>
>
> >
> > which is a difficulty bits for message
> >
> > The Times 03/Jan/2009 Chancellor on brink of second bailout for
> banks
> >
> > can anyone provide a update what hashing or encoding is used to get
> > that string?
> >
> > I used
> >
> > String str = "The Times 03/Jan/2009 Chancellor on brink of second
> > bailout for banks";
> > String ss =
> BaseEncoding.base16().lowerCase().encode(str.getBytes()));
> >
> > and output I have
> >
> 5468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73
>
>
> > whereas in code it has extra "04ffff001d010445"
> >
> > I am struggling to find that but failed so far.
> >
> > A help will be very much appreciated and my job will be saved :-)
> >
> > This is the output when I am decoding the string in code via
> >
> > byte[] bytes = Utils.HEX.decode(
> >
> "04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73");
>
>
> > String s = new String(bytes);
> >
> >
> > Output is below:
> >
> >
> > <
> https://lh3.googleusercontent.com/-IH6fJkwGJI8/WukQLiC5wCI/AAAAAAAAEXY/JRTuXE4qKHIvVFSrv2b9-kDpnx2TuoW9ACLcBGAs/s1600/decoding.PNG>
>
>
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "bitcoinj" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to [email protected] <javascript:>
> > <mailto:[email protected] <javascript:>>.
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.