Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- top part of https://www.blockchain.com/explorer/addresses/btc/bc1qnytlr0qtkq8avgae763tdz7nc5nt2dguuzgsy4
- */
- $string = "bc1qnytlr0qtkq8avgae763tdz7nc5nt2dguuzgsy4";
- $shortning=intval(strlen($string)*0.10);
- $shortAddr = substr($string,0,$shortning)."-". substr($string,-$shortning);
- $typeOfWallet = substr($string,0,3);
- if ($typeOfWallet == "bc1"){
- echo "$shortAddr\n";
- echo "Bech32 (P2WPKH)\n";
- echo "Bitcoin Address\n";
- echo "$string\n";
- }else{
- //condition for other wallet types (Base58 (P2SH))
- echo substr($string,0,4)." - ". substr($string,-5);}
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement