Advertisement
Rzgar_Bokan

blockchain.com wallet type

Feb 4th, 2023
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | Cryptocurrency | 0 0
  1. <?php
  2. /*
  3. top part of https://www.blockchain.com/explorer/addresses/btc/bc1qnytlr0qtkq8avgae763tdz7nc5nt2dguuzgsy4
  4. */
  5. $string = "bc1qnytlr0qtkq8avgae763tdz7nc5nt2dguuzgsy4";
  6. $shortning=intval(strlen($string)*0.10);
  7. $shortAddr = substr($string,0,$shortning)."-". substr($string,-$shortning);
  8. $typeOfWallet = substr($string,0,3);
  9.  if ($typeOfWallet == "bc1"){
  10.     echo "$shortAddr\n";
  11.     echo "Bech32 (P2WPKH)\n";
  12.     echo "Bitcoin Address\n";
  13.     echo "$string\n";
  14.  }else{
  15.     //condition for other wallet types (Base58 (P2SH))
  16.     echo substr($string,0,4)." - ". substr($string,-5);}
  17. ?>
Tags: php bitcoin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement