Cryptocurrencies are pseudo-anonymous means of payment. On the one hand, you do not need to pass verification to create a wallet, and on the other hand, you can determine the source of funds from the transaction chain. Exchangers do not want to deal with “dirty” coins, so they conduct KYC processes and check each transaction.
A crypto wallet contains many addresses. Usually, when transferring, several coins are combined into one, and the change is returned to a new address. If you have a p2p exchange, a trading platform, a telegram bot, or a service related to fiat currency withdrawal, then you need to have isolated transactions within the same address.
Such a function is unique since no other processing (at the time of this writing) has a similar solution, i. e. does not provide the client with the choice of coins when paying.
Test wallet: tbtc-bde1cfc70297e4ff7068334b25986819
Test Transfer_key: hyl1aQkd5vwdzT1uExgUCOXOcekUg4Yc
*Code example: *
<?php
$WalletID = "tbtc-bde1cfc70297e4ff7068334b25986819";
$json_data = '{"transfer_key": "hyl1aQkd5vwdzT1uExgUCOXOcekUg4Yc",
"addresses": ["2N919xVyDyutwTX87zg1NBQWJQWcFcpVVUf"],
"destinations": [{"address": "2N4obeEuEidHmuXLCLvWeA4tH9FhB8W8EyD", "amount": 40000}]}';
$api_base = "https://apirone.com/api/v2/wallets/" . $WalletID . "/transfer";
$curl = curl_init($api_base);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$http_status_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$response = curl_exec($curl);
curl_close($curl);
$decoded = json_decode($response, true);
echo "Transaction created: " . $decoded["created"] . "<br>";
echo "Transaction hash: " . $decoded["txs"]["0"] . "<br>";
echo "Total amount: " . $decoded["total"] . " Satoshies";
?>
Where addresses is an array of one or more addresses from which coins will be taken for the transaction.
The recipients of destinations can be from 1 to 255, they are also listed in an array.
Business logic can be as followed:
Payment is sent to you, and it is confirmed on the network
You check it for purity, for example, in the Crystal Blockchain service
In case of insufficient purity of the origin of funds, they are to be returned to the sender without affecting other clients
In the amount parameter, you can specify the value “100%”, so the network commission will be subtracted from the amount and the balance of the indicated address(es) will be zero.
Top comments (0)