0

I have the following...

Bitcoin Address: 1H2zzoAncRcQYihgTMYtX55ioXYErmYQQC

Public Key: 021FE07FBBB27AD176F1E082950474CD6252FB86751B893BC0887962B008830798

WIF Key: Kzy3fea4xCwLczAj3g8TYvDw6QRKCMqvVZX2J7vaXgy78VhieRdV

HEX Key: 6FCE4A50EA529B2D4B3E9671B5B0AA0D5D19266D778FB005F25AE4599D5D2BA0

I need to sign: Just a sample text

I want this result: H9saC8UiO0n++3dHZev/apRXkQCrqFofvW9vMpzWqPKsYTNvx/4bdtbdcMORGvNblQknT34UErnwEM3fxTZII0U=

How can I code it only in PHP without calling any API or invoking any JS library?

  • The ultimate documentation is the Bitcoin Core source code. So the short answer to your question is: read their code and reimplement in your language. – Nate Eldredge Aug 16 '17 at 1:02
  • BTW, never use this address for anything ever again since the priv key is published. – Willtech Mar 11 '18 at 1:20
2

A bit late but I created a PHP library for cryptocurrency. You can use this library to achieve what you want.

You can use it like this:

require('CryptoPHP.php');
$wif_key = 'Kzy3fea4xCwLczAj3g8TYvDw6QRKCMqvVZX2J7vaXgy78VhieRdV'; //this is your wif key
$private_key = $this -> wif2key($wif_key); //get the wif key to a hex private key
$hash = 'Just a sample text'; //this is what you're trying to sign.

$signature = $this -> sign($hash,$private_key);
  • Not working. Throwing Fatal Error. – Midnight Engineer Jan 28 at 18:38
  • What error are you getting? – user2298995 Jan 30 at 8:15
  • Fatal error: Using $this when not in object context in sign_message.php on line 4. sign_message.php contains your code. – Midnight Engineer Jan 30 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.