Safe Hash

Correct way to work on the server, so avoid hacks and secure your funds

On the client side we must add to the walletudrox where the hash will be sent

walletudrox.notifyServer = "https://mysite.com/app/release_funds";

This makes your client, at the end of the transaction in a server-to-server way, send the hash of the operation safely

We receive the hash

<?php 
    $hash = $_POST('hash');
?>

With the SafeHash system we verify that the hash is correct, the SafeHash system allows you to safely verify the operation with securities funds

Call SafeHash with curl in php

<?php
    $hash = $_POST('hash');
    $url = 'https://wallet.udrox.com/wallet/app/safehash?hash='.$hash;
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    $jsonSafeHash = curl_exec($ch);
    curl_close($ch);
    $safeHash = json_decode($jsonSafeHash,true);
    $walletFrom = $safeHash["from"];
    $walletTo = $safeHash["to"];
?>

It will provide us with a JSON with the following information

{
"hash":"IDHASH",
"coin":"UDROX",
"net":"UDROX",
"value":5,
"time":1689701615,
"from":"0X...",
"to":"0X...",
"request":0
}
Objeto
Descripcion

coin

net

value

Asset value sent

time

Date in seconds time format

from

Address 0X of the person who sends the funds

to

Address 0X of the person receiving the funds

request

The total number of queries, if it is the first time it is consulted, it will show 0

Finally we must verify that whoever receives the funds is the correct address

<?php
$safeHash = json_decode($jsonSafeHash,true);
if($walletTo!="0x..."){
    echo "ERROR";
    exit();
}
// It is also advisable to verify that the currency sent is correct.
$coin =  $safeHash["coin"];
if($coin!="UDROX"){
	echo "ERROR"; exit();
}
?>

Using these verification methods we will be safe against any attack and we can proceed safely

BASIC PHP EXAMPLE

<?php
	$hash = $_POST('hash');
	if($hash==""){echo "ERROR"; exit();}

	$url = 'https://wallet.udrox.com/wallet/app/safehash?hash='.$hash;
	$ch = curl_init($url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	$jsonSafeHash = curl_exec($ch);
	curl_close($ch);
	$safeHash = json_decode($jsonSafeHash,true);
	$walletFrom = $safeHash["from"];
	$walletTo = $safeHash["to"];	
	if($walletTo!="0X..."){
		echo "ERROR";
		exit();
	}
	$value = $safeHash["value"];
	$coin =  $safeHash["coin"];
	if($coin!="UDROX"){
		echo "ERROR"; exit();
	}
	// WE RELEASE FUNDS
	
?>

Last updated