$arr = GetTx($client,$myAddress);
$RawTx = $client->getrawtransaction($arr,1);
$pieces = explode(" ", $RawTx["vin"][0]["scriptSig"]["asm"]);
$myHash = hash('ripemd160',hash('sha256',$pieces[1]));
$myHashStr = chr(0x00).$myHash;
$myHash2 = hash('sha256',hash('sha256',$myHashStr));
$myHashStr.=substr($myHash2,0,4);
echo "Hash:".$myHashStr."<br>";
echo "Base58:".base58_encode($myHashStr)."<br>";
function base58_encode($num) {
$alphabet = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
$base_count = strlen($alphabet);
$encoded = '';
while ($num >= $base_count) {
$div = $num / $base_count;
$mod = ($num - ($base_count * intval($div)));
$encoded = $alphabet[$mod] . $encoded;
$num = intval($div);
}
if ($num) {$encoded = $alphabet[$num] . $encoded;}
return $encoded;
}
What is wrong with this code?