Click here to Skip to main content
15,898,371 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i have php code to validate btc address! but i need code for vb.net please help ...

some time php code is not loading...

anyone help me to give me code for vb.net???

php code is below

can anyone do code for vb.net? like the php code below??

may i know how to validate bitcoin address using vb.net?  
i just tried with validating btc address with php! its working fine but i need code for vb.net 


What I have tried:

PHP
<pre><?php
function validate($address){
        $decoded = decodeBase58($address);
 
        $d1 = hash("sha256", substr($decoded,0,21), true);
        $d2 = hash("sha256", $d1, true);
 
        if(substr_compare($decoded, $d2, 21, 4)){
                throw new \Exception("invalid Address");
        }
        return true;
}
function decodeBase58($input) {
        $alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
 
        $out = array_fill(0, 25, 0);
        for($i=0;$i<strlen($input);$i++){
                if(($p=strpos($alphabet, $input[$i]))===false){
                        throw new \Exception("invalid character found");
                }
                $c = $p;
                for ($j = 25; $j--; ) {
                        $c += (int)(58 * $out[$j]);
                        $out[$j] = (int)($c % 256);
                        $c /= 256;
                        $c = (int)$c;
                }
                if($c != 0){
                    throw new \Exception("This is Not Bitcoin Address");
                }
        }
 
        $result = "";
        foreach($out as $val){
                $result .= chr($val);
        }
 
        return $result;
}

function main () {
  $s = array($_GET['WalletAdd']);
  foreach($s as $btc){
    $message = "Valid Address";
    try{
        validate($btc);
    }catch(\Exception $e){ $message = $e->getMessage(); }
    echo "$message\n";
  }
}
main();
?>
Posted
Updated 20-Jul-20 3:14am
Comments
ZurdoDev 20-Jul-20 8:38am    
Where are you stuck? It's unlikely anyone will re-write it all for you.
MirshadRI 20-Jul-20 8:45am    
can you help me to converting thats all php code to vb.net code?
ZurdoDev 20-Jul-20 8:51am    
We can all help, but we won't do it all for you. Do you know any programming at all?
MirshadRI 21-Jul-20 1:56am    
yes i know programming with vb.net

This is not a code conversion service: either learn PHP and VB then convert it yourself, use the PHP software as a specification for e net VB project, or pay someone to do it for you: I suggest you go to Freelancer.com and ask there. But be aware: you get what you pay for. Pay peanuts, get monkeys.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900