$my_address = "0xd85f18d58982db82e1916d84bc9ecec2a6e93d45"; // Your destination address
$desiredConfirmations = 12;
// If you're using a secret, put it in here
$secret = "7j0ap91o99cxj8k9";
if(!isset($_GET['secret'])) {
if ($_GET["secret"] !== $secret) die();
// Make sure we have all the POST variables we want to get
if(!$_POST['input_address'] || !$_POST['input_transaction_hash'] || !$_POST['transaction_hash'] || !$_POST['valueWEI'] || !$_POST['gas'] || !$_POST['gasPrice'] || !$_POST['valueETH'] || !$_POST['confirmations'] || !$_POST['destination_address']) {
die('One of more of the POST variables was not set in the request to our callback url.');
if ($_POST["destination_address"] !== $my_address) die();
$gasPrice = $_POST["gasPrice"];
$value_in_eth = $_POST["valueETH"];
$value_in_wei = $_POST["valueWEI"];
$transaction_fee = ($gasPrice * $gas); // Transaction fee in WEI
$input_address = $_POST["input_address"];
$input_transaction_hash = $_POST["input_transaction_hash"];
$transaction_hash = $_POST["transaction_hash"];
$confirmations = $_POST["confirmations"];
// Work out the real amount they sent to the our address
$totalSent = bcsub($value_in_wei, $transaction_fee); // Use BCMath extension to use this - it's for huge/large numbers that do not fit into 32bit
// Confirmation check to make sure the confirmations is above our desired amount
if($confirmations >= $desiredConfirmations) {
// Insert your data into a database so you can later on, fetch that data and update it
// {{ Do you magic here }}
// Transaction has not reached our desired number of confirmations.
// Keep waiting for confirmations to be larger