I managed to write the below code which will create public and private keys
Private Key
$input = "satoshinakamoto";
$sha256 = hash("sha256", ($input));
echo "<strong>Private Key: </strong>".$sha256."<br/>";
Public Key
$step1 = hexStringToByteString("0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6");
echo "<p><strong>Step 1:</strong> ".$step1."</p>";
$step2 = hash("sha256", $step1);
echo "<p><strong>Step 2: </strong>".$step2."</p>";
$step3 = hash('ripemd160', hexStringToByteString($step2));
echo "<p><strong>Step 3: </strong>".$step3."</p>";
$step4 = '00'.$step3;
echo "<p><strong>Step 4: </strong>".$step4."</p>";
$step5 = hash("sha256", hexStringToByteString($step4));
echo "<p><strong>Step 5: </strong>".$step5."</p>";
$step6 = hash("sha256",hexStringToByteString($step5));
echo "<p><strong>Step 6: </strong>".$step6."</p>";
$step7 = substr($step6,0,8);
echo "<p><strong>Step 7: </strong>".$step7."</p>";
$step8 = $step4.$step7;
echo "<p><strong>Step 8: </strong>".$step8."</p>";
$step9 = bc_hexdec($step8);
echo "<p><strong>Step 9: </strong>".$step9."</p>";
$step10 = bc_base58_encode($step9);
echo "<p><strong>Step 10: </strong>1".$step10."</p>";
return $step10;
To generate public key I took reference from https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses
In that link they provided Step by Step process and I followed the same and if
I input from Step 1 in the link
then I am able to convert the code to public key but I am not sure how to convert Step 0 to Step 1
i.e.
From:
18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725
To
0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6
Document says
Take the corresponding public key generated with it (65 bytes, 1 byte 0x04, 32 bytes corresponding to X coordinate, 32 bytes corresponding to Y coordinate)
What does that mean? How can I generate this value from Private Key.
Edit 1
This question says https://stackoverflow.com/questions/17672696/generating-bitcoin-address-from-ecdsa-public-key
Joining the Elliptic Public Key
and I still don’t understand what are they.