<p>Private Key is a 32 bytes data
Apply ECDSA or Elliptic Curve Digital Signature Algorithm to the private key.
The above step dervies the public key,.
(Legacy)Now append 0x04 to the start of the public key.
(Current Practise)  Take X from derived public key. Now add  byte 0x03 if the last byte of Y is odd or 0x02 if the last byte is even.
Now, apply SHA-256 to the above public key, and then apply RIPEMD-160.
Add Network Byte at the start of key:
Mainnet : 0x00
Testnet: 0x6f
Calculate the checksum: Apply SHA-256 twice and then take starting 4 bytes of the result.
Finally to get the address concatenate the key from Step7 and checksum.</p>

CC BY-SA 4.0
2019-10-19T18:26:18.287Z
Yes, but how can this be done in PHP?  What do I need?
Patoshi パトシ
CC BY-SA 4.0
2019-10-19T05:53:13.447Z
2019-10-19T05:58:26.703Z
2019-10-19T05:58:26.703Z
Nvest Campus
<p>I'm building out an application, but I need to verify if the bitcoin private keys have a positive balance. Is there a PHP script or some type of service that I can pass in a private key and outputs all the bitcoin public keys in 1... and 3... formats? From there I'll just pass those addresses to a block explorer. </p>

<private-key><public-key><php><balance><nodejs>
How can I extract my bitcoin public address from my bitcoin private key using PHP for Nodejs?
Patoshi パトシ
# How can I extract my bitcoin public address from my bitcoin private key using PHP for Nodejs?

(Asked by: username_0 on 2019-10-18)

I'm building out an application, but I need to verify if the bitcoin private keys have a positive balance. Is there a PHP script or some type of service that I can pass in a private key and outputs all the bitcoin public keys in 1... and 3... formats? From there I'll just pass those addresses to a block explorer.

**Tags:** private-key, public-key, php, balance, nodejs


---

## 1 answers

### Answer by username_1 on 2019-10-19. Score: 2

Private Key is a 32 bytes data
Apply ECDSA or Elliptic Curve Digital Signature Algorithm to the private key.
The above step dervies the public key,.
(Legacy)Now append 0x04 to the start of the public key.
(Current Practise) Take X from derived public key. Now add byte 0x03 if the last byte of Y is odd or 0x02 if the last byte is even.
Now, apply SHA-256 to the above public key, and then apply RIPEMD-160.
Add Network Byte at the start of key:
Mainnet : 0x00
Testnet: 0x6f
Calculate the checksum: Apply SHA-256 twice and then take starting 4 bytes of the result.
Finally to get the address concatenate the key from Step7 and checksum.

> **Comments:**
> **username_0**: Yes, but how can this be done in PHP?  What do I need?  

---

