<p>Best similar and alternative is Bitwasp for PHP, with a few lines you can create much more than addresses and keys. </p>

<h2>Presently supported:</h2>

<ul>
<li>Bloom filters</li>
<li>Blocks, headers, and Merkle blocks</li>
<li>P2SH &amp; Segregated witness scripts</li>
<li>An adaptable elliptic-curve library, using [<a href="https://github.com/mdanter/phpecc" rel="nofollow noreferrer">PhpEcc</a>] by default, or libsecp256k1 if the bindings are found</li>
<li>Support for building, parsing, signing/validating transactions</li>
<li>Deterministic signatures (RFC6979)</li>
<li>BIP32 and electrum (older type I) deterministic key algorithms</li>
<li>ScriptFactory for common input/output types, parser, interpreter, and classifiers</li>
<li>Supports bindings to libbitcoinconsensus</li>
<li>RPC bindings to Bitcoin Core's RPC</li>
<li>Bindings to Stratum (electrum) servers</li>
<li>Easy serialization to binary representation of most classes</li>
<li>SIGHASH types when creating transactions</li>
<li>Payment Protocol (BIP70)</li>
</ul>

<p>Take a look <a href="https://github.com/Bit-Wasp/bitcoin-php" rel="nofollow noreferrer">bitcoin-php</a></p>

CC BY-SA 3.0
2018-02-06T09:57:25.853Z
2018-02-06T09:57:25.853Z
Tailer
<p>For old and new address format (P2SH, P2WPKH, P2WSH) you can use Universal Bitcoin Address Generator library:<br>
<a href="https://github.com/toggio/BitcoinAddressGenerator/" rel="nofollow noreferrer">https://github.com/toggio/BitcoinAddressGenerator/</a></p>
<p>You can generate and convert every type of private/public key and address format:</p>
<pre><code>&lt;?php

require_once('BitcoinAddressGenerator.php');

$BTC = new BitcoinAddressGenerator();

echo &quot;Private key: &quot;.$BTC-&gt;getPrivateKey().&quot;\n&quot;;
echo &quot;Public key: &quot;.$BTC-&gt;getPublicKey().&quot;\n&quot;;
echo &quot;Compressed Public Key: &quot;.$BTC-&gt;getCompPublicKey().&quot;\n&quot;;
echo &quot;WIF: &quot;.$BTC-&gt;getWIF().&quot;\n&quot;;
echo &quot;Compressed WIF: &quot;.$BTC-&gt;getCompWIF().&quot;\n&quot;;
echo &quot;P2PKH Address: &quot;.$BTC-&gt;getP2PKH().&quot;\n&quot;;
echo &quot;Compressed P2PKH Address: &quot;.$BTC-&gt;getCompP2PKH().&quot;\n&quot;;
echo &quot;P2SH Address: &quot;.$BTC-&gt;getP2SH().&quot;\n&quot;;
echo &quot;P2WPKH Address: &quot;.$BTC-&gt;getP2WPKH().&quot;\n&quot;;
echo &quot;P2WSH Address: &quot;.$BTC-&gt;getP2WSH().&quot;\n&quot;;
?&gt;
</code></pre>
<p>The output will be something like this:</p>
<pre><code>Private key: 90bae5e94c422b7d8ba8cda13b6f8974e63fa409e909afda2ffb400dd1bc448d
Public key: 04f94c255da6ffb59d1859fa08c2d4b4942b4cf533a6d7ec9eb242047a60f4801ef47fad20a3b143194bca890ab9edb7de80635e3441f95eaaa917f59ae96e63af
Compressed Public Key: 03f94c255da6ffb59d1859fa08c2d4b4942b4cf533a6d7ec9eb242047a60f4801e
WIF: 5Jv2WwACnLoqbuqmY7uix2YW2xWGoXSBS736yTW1vNZSh1J15vt
Compressed WIF: L253h83d18RjX6EFaMVi9sp39dzCkML93oeHNBy54aACPMHyMBS4
P2PKH Address: 1JkQH9oQ8EiCzCAW3D2auwXz7LfKiC1m8o
Compressed P2PKH Address: 1BdyvjvUgdmu1AtmhV3CTGJ9H79SfD4b4P
P2SH Address: 3QAsNPQJBgFs98YjPoDquuE3Bju6T6Jgr2
P2WPKH Address: bc1qwjhupxjkrs2sctfqwm2a4rlhhxna93kk29x7he
P2WSH Address: bc1u7znk6gn992vuzn9u5044rdurwa8yw5a5f5kaacgs555mnnrarvswkuv8v
</code></pre>
<p>Or if you already have your own private key, you can supply it and then obtain all other keys and addresses:</p>
<pre><code>$BTC-&gt;newKeys(&quot;b428729db6df4dd1b14e20887d3f9cd71486f1c39ed994c065b17b5eb2f7e4a7&quot;);

echo &quot;Private key: &quot;.$BTC-&gt;getPrivateKey().&quot;\n&quot;;
echo &quot;Public key: &quot;.$BTC-&gt;getPublicKey().&quot;\n&quot;;
echo &quot;Compressed Public Key: &quot;.$BTC-&gt;getCompPublicKey().&quot;\n&quot;;
echo &quot;WIF: &quot;.$BTC-&gt;getWIF().&quot;\n&quot;;
echo &quot;Compressed WIF: &quot;.$BTC-&gt;getCompWIF().&quot;\n&quot;;
echo &quot;P2PKH Address: &quot;.$BTC-&gt;getP2PKH().&quot;\n&quot;;
echo &quot;Compressed P2PKH Address: &quot;.$BTC-&gt;getCompP2PKH().&quot;\n&quot;;
echo &quot;P2SH Address: &quot;.$BTC-&gt;getP2SH().&quot;\n&quot;;
echo &quot;P2WPKH Address: &quot;.$BTC-&gt;getP2WPKH().&quot;\n&quot;;
echo &quot;P2WSH Address: &quot;.$BTC-&gt;getP2WSH().&quot;\n&quot;;
</code></pre>
<p>This will output:</p>
<pre><code>Private key: b428729db6df4dd1b14e20887d3f9cd71486f1c39ed994c065b17b5eb2f7e4a7
Public key: 043acb033826e2c3018fb88bc0e8a192f926cf3b2a73df2a00c7d45b5b522a47cd9953c59826bb217464d95cd9c0fbe4f1306b09ef526dabd55a8452c64a9d04cf
Compressed Public Key: 033acb033826e2c3018fb88bc0e8a192f926cf3b2a73df2a00c7d45b5b522a47cd
WIF: 5KBdUYphQaPwmcsvssq3JBqFGnVCAM563qDFNfpGqyz8JeKPBSC
Compressed WIF: L3FuzbTXM4QGjwMnoZM38rowzfmSGFb3HVo4SeKewCX9Ei5VhEFM
P2PKH Address: 1P2iFYGFB6GwguBfLEaqo2hSz6V9N5261J
Compressed P2PKH Address: 1E1P4noxSdNpErNwRHFzMSPucgmeDsHi4p
P2SH Address: 3DxLbTj5ARZ33VQ6yvccaEqWVVkEsdj3cz
P2WPKH Address: bc1q36kqmmduxne6fzse362e2ms7xxcmycw8uh4gft
P2WSH Address: bc1qx8hepy0nqq5r76jm5grqf6ash2hlydhe5upuw4gzsc5tpnxxxsq522h3u
</code></pre>

CC BY-SA 4.0
2024-04-19T10:12:52.533Z
2024-04-19T10:12:52.533Z
toggio
<p>I think <a href="https://www.btcschools.net/bitcoin/bitcoin_start_intro.php" rel="nofollow noreferrer">this page</a> would be helpful as well for this kind of purpose.</p>
<p>It supports converting public key hex to p2pkh and p2wpkh address, and redeem script hex to p2sh and p2wsh. It also supports multisig address and locktime address(CLTV, CSV).</p>
<p>It also provides various tools w.r.t. encoding(wif, little-endian) and crypto(sha256, ripemd160...)</p>

CC BY-SA 4.0
2024-04-23T15:50:56.303Z
Whilst this may theoretically answer the question, [it would be preferable](//meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.
Ava Chow
CC BY-SA 4.0
2024-05-17T05:41:25.297Z
I apologize to violate rule, I've just edited to include detailed feature so that it can answer original post.
Hyunhum Cho
CC BY-SA 4.0
2024-04-23T03:10:09.273Z
2024-05-17T05:38:13.480Z
2024-05-17T05:38:13.480Z
Hyunhum Cho
<p>I loved those two </p>

<ul>
<li><a href="https://github.com/grondilu/bitcoin-bash-tools" rel="nofollow noreferrer">https://github.com/grondilu/bitcoin-bash-tools</a></li>
<li><a href="https://www.bitaddress.org/" rel="nofollow noreferrer">https://www.bitaddress.org/</a></li>
</ul>

<p>because you can convert HEX into WIF private key. </p>

<p>Is there something similar what allows to create Segwit Bitcoin addresses from HEX? It is useful for those who want to dice wallet. </p>

CC BY-SA 3.0
2018-02-06T09:52:35.357Z
How are you creating it, can you give an example?
Tailer
<segregated-witness><address-generation>
Bitcoin segwit addresses from HEX
zsedc
# Bitcoin segwit addresses from HEX

(Asked by: username_0 on 2018-02-06)

I loved those two

* <https://github.com/grondilu/bitcoin-bash-tools>
* <https://www.bitaddress.org/>

because you can convert HEX into WIF private key.

Is there something similar what allows to create Segwit Bitcoin addresses from HEX? It is useful for those who want to dice wallet.

**Tags:** segregated-witness, address-generation

> **Comments:**
> **username_1**: How are you creating it, can you give an example?  

---

## 3 answers

### Answer by username_1 on 2018-02-06. Score: 1

Best similar and alternative is Bitwasp for PHP, with a few lines you can create much more than addresses and keys.

## Presently supported:

* Bloom filters
* Blocks, headers, and Merkle blocks
* P2SH & Segregated witness scripts
* An adaptable elliptic-curve library, using [[PhpEcc](https://github.com/mdanter/phpecc)] by default, or libsecp256k1 if the bindings are found
* Support for building, parsing, signing/validating transactions
* Deterministic signatures (RFC6979)
* BIP32 and electrum (older type I) deterministic key algorithms
* ScriptFactory for common input/output types, parser, interpreter, and classifiers
* Supports bindings to libbitcoinconsensus
* RPC bindings to Bitcoin Core's RPC
* Bindings to Stratum (electrum) servers
* Easy serialization to binary representation of most classes
* SIGHASH types when creating transactions
* Payment Protocol (BIP70)

Take a look [bitcoin-php](https://github.com/Bit-Wasp/bitcoin-php)


---

### Answer by username_2 on 2024-04-19. Score: 0

For old and new address format (P2SH, P2WPKH, P2WSH) you can use Universal Bitcoin Address Generator library:  
<https://github.com/username_2/BitcoinAddressGenerator/>

You can generate and convert every type of private/public key and address format:

```
<?php

require_once('BitcoinAddressGenerator.php');

$BTC = new BitcoinAddressGenerator();

echo "Private key: ".$BTC->getPrivateKey()."\n";
echo "Public key: ".$BTC->getPublicKey()."\n";
echo "Compressed Public Key: ".$BTC->getCompPublicKey()."\n";
echo "WIF: ".$BTC->getWIF()."\n";
echo "Compressed WIF: ".$BTC->getCompWIF()."\n";
echo "P2PKH Address: ".$BTC->getP2PKH()."\n";
echo "Compressed P2PKH Address: ".$BTC->getCompP2PKH()."\n";
echo "P2SH Address: ".$BTC->getP2SH()."\n";
echo "P2WPKH Address: ".$BTC->getP2WPKH()."\n";
echo "P2WSH Address: ".$BTC->getP2WSH()."\n";
?>

```

The output will be something like this:

```
Private key: 90bae5e94c422b7d8ba8cda13b6f8974e63fa409e909afda2ffb400dd1bc448d
Public key: 04f94c255da6ffb59d1859fa08c2d4b4942b4cf533a6d7ec9eb242047a60f4801ef47fad20a3b143194bca890ab9edb7de80635e3441f95eaaa917f59ae96e63af
Compressed Public Key: 03f94c255da6ffb59d1859fa08c2d4b4942b4cf533a6d7ec9eb242047a60f4801e
WIF: 5Jv2WwACnLoqbuqmY7uix2YW2xWGoXSBS736yTW1vNZSh1J15vt
Compressed WIF: L253h83d18RjX6EFaMVi9sp39dzCkML93oeHNBy54aACPMHyMBS4
P2PKH Address: 1JkQH9oQ8EiCzCAW3D2auwXz7LfKiC1m8o
Compressed P2PKH Address: 1BdyvjvUgdmu1AtmhV3CTGJ9H79SfD4b4P
P2SH Address: 3QAsNPQJBgFs98YjPoDquuE3Bju6T6Jgr2
P2WPKH Address: bc1qwjhupxjkrs2sctfqwm2a4rlhhxna93kk29x7he
P2WSH Address: bc1u7znk6gn992vuzn9u5044rdurwa8yw5a5f5kaacgs555mnnrarvswkuv8v

```

Or if you already have your own private key, you can supply it and then obtain all other keys and addresses:

```
$BTC->newKeys("b428729db6df4dd1b14e20887d3f9cd71486f1c39ed994c065b17b5eb2f7e4a7");

echo "Private key: ".$BTC->getPrivateKey()."\n";
echo "Public key: ".$BTC->getPublicKey()."\n";
echo "Compressed Public Key: ".$BTC->getCompPublicKey()."\n";
echo "WIF: ".$BTC->getWIF()."\n";
echo "Compressed WIF: ".$BTC->getCompWIF()."\n";
echo "P2PKH Address: ".$BTC->getP2PKH()."\n";
echo "Compressed P2PKH Address: ".$BTC->getCompP2PKH()."\n";
echo "P2SH Address: ".$BTC->getP2SH()."\n";
echo "P2WPKH Address: ".$BTC->getP2WPKH()."\n";
echo "P2WSH Address: ".$BTC->getP2WSH()."\n";

```

This will output:

```
Private key: b428729db6df4dd1b14e20887d3f9cd71486f1c39ed994c065b17b5eb2f7e4a7
Public key: 043acb033826e2c3018fb88bc0e8a192f926cf3b2a73df2a00c7d45b5b522a47cd9953c59826bb217464d95cd9c0fbe4f1306b09ef526dabd55a8452c64a9d04cf
Compressed Public Key: 033acb033826e2c3018fb88bc0e8a192f926cf3b2a73df2a00c7d45b5b522a47cd
WIF: 5KBdUYphQaPwmcsvssq3JBqFGnVCAM563qDFNfpGqyz8JeKPBSC
Compressed WIF: L3FuzbTXM4QGjwMnoZM38rowzfmSGFb3HVo4SeKewCX9Ei5VhEFM
P2PKH Address: 1P2iFYGFB6GwguBfLEaqo2hSz6V9N5261J
Compressed P2PKH Address: 1E1P4noxSdNpErNwRHFzMSPucgmeDsHi4p
P2SH Address: 3DxLbTj5ARZ33VQ6yvccaEqWVVkEsdj3cz
P2WPKH Address: bc1q36kqmmduxne6fzse362e2ms7xxcmycw8uh4gft
P2WSH Address: bc1qx8hepy0nqq5r76jm5grqf6ash2hlydhe5upuw4gzsc5tpnxxxsq522h3u

```


---

### Answer by username_3 on 2024-04-23. Score: -2

I think [this page](https://www.btcschools.net/bitcoin/bitcoin_start_intro.php) would be helpful as well for this kind of purpose.

It supports converting public key hex to p2pkh and p2wpkh address, and redeem script hex to p2sh and p2wsh. It also supports multisig address and locktime address(CLTV, CSV).

It also provides various tools w.r.t. encoding(wif, little-endian) and crypto(sha256, ripemd160...)

> **Comments:**
> **username_4**: Whilst this may theoretically answer the question, [it would be preferable](//meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.  
> **username_3**: I apologize to violate rule, I've just edited to include detailed feature so that it can answer original post.  

---

