Create your own Bitcoin mixer

Carding Forum

Professional
Messages
1,297
Reputation
3
Reaction score
465
Points
83
Bitcoin wallets only give a feeling of anonymity. When registering a wallet, new addresses are generated, without any contact information, location or information about the user. But Bitcoin is a pseudo-anonymous cryptocurrency, in which you can view the entire transaction history and interaction of addresses through a blockchain explorer.

There are several commercial wallet de-anonymization services. They parse information about forum participants around the clock, study the hot wallets of large exchanges and exchangers, and monitor investment movements and the shadow market. In this way, a huge database of address-owner correspondences is collected, like key elements in a chain of money. From them you can determine the movement of funds.

How does a Bitcoin mixer work?

Not all users would like to show their transactions, for example, when paying for adult industry services, crypto-voting or purchasing digital content. And in general, the inviolability of private life, personal data and finances is protected by law in European countries.

In order to interrupt or confuse the chain of transactions, a Bitcoin mixer (or toggle switch) was created. The main goal of the process is to completely break the connection between the incoming payment and the anonymous transaction received in the payee’s wallet.

The following may participate in this process:
  1. pre-mixed coins from various sources
  2. intermediate coin pool
  3. random division of coins in different proportions
  4. payment of one or more amounts
  5. different payment times stretched over several hours
  6. floating mixer commission and blockchain network

The most primitive way of mixing coins may be coins from other participants in the mixer. But their dubious origin will only deepen the anonymity of clients. Therefore, it is more correct to buy pure Bitcoins from large exchanges such as Binance, Huobi, Poloniex and others, take them from ETH-LTC-BTC cross-currency exchangers, and also receive new mined coins during the issue.

Preparing for development

In this article, we do not provide a ready-made solution that can be downloaded and installed. Because the logic of mixing and giving coins has a huge number of options. You can also manage not only your bitcoins, but attract investment ones at interest or even get by with only incoming coins. In this article, we will only talk about the key implementation options, methods of accepting payments and distributing transactions.

For security purposes, the project can be divided into two parts: the main page and the payment server (backend). If the web server is compromised, the attacker will not be able to gain access to the mixer’s monetary resources. The server part will receive callbacks from the payment server, make payments according to a timer and manage the service’s capital.

Raising your own Bitcoin node, keeping a separate powerful server and servicing it is quite expensive and labor-intensive. After all, the node needs at least 200 GB of hard drive, 2 GB of RAM and a more or less decent processor. It is much more convenient to use ready-made API (Application Programming Interface).

Several such variants were found:

https://btcpayjungle.com
https://www.blockchain.com
https://bitpay.com/api
https://apirone.com

Let's take a ready-made solution from Apirone. Here, all incoming transactions can be accepted absolutely free of charge. And in one transaction, you can specify up to 255 recipients and pay a fixed commission, only 0.0002 BTC ($0.7). This service is ideal for our Mixer. It is easy to scale and quickly deploy on any server. In addition, there is no need to send documents and deanonymize yourself.

Wallets are completely anonymous, and you can create as many of them as you like, without restrictions.

To store clean Bitcoins, we will need a Saving wallet. We create it with a simple POST request in JSON format: {"type": "saving"} to the endpoint


In response we receive the result in JSON format:

PHP:

PHP:
{
  "wallet": "8e9c53a62755bcc66e4d2aaae3a2af6d",
  "type": "saving",
  "transfer_key": "7j0ap91o99cxj8k97j0ap91o99cxj8k9",
  "currency": "btc"
}

wallet - identifier of the created wallet.

transfer_key - the key for creating payments and managing the wallet.

Home page

On the main page we will place the option to pay one or several recipients at once in different percentage proportions, and also give the opportunity to choose the service fee yourself.

By clicking on the Continue button, the addresses and the corresponding percentages are saved as an order in the database.

For our existing wallet, we create a new bitcoin address for payment. We send a POST request in JSON format.

Example PHP code:

PHP:

PHP:
<?php
  $json_data = array (
    "callback" => array(
        'url'=> 'http://example.com/callback',
        'data' => array (
            'invoice_id' => "1234",
            'secret' => "7j0ap91o99cxj8k9"
        )
    )
  );
 
  $wallet = "8e9c53a62755bcc66e4d2aaae3a2af6d";
  $api_base = "https://apirone.com/api/v2/btc/wallet/". $wallet ."/address";
 
  $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_encode($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 "Please send the payment to the following bitcoin address: " .
  $decoded["address"];
?>

In 'url' => 'http://example.com/callback' we change the link to the address of the callback page on your website. This page will receive all information about incoming payments.

'invoice_id' - order number saved in the database.

'secret' - a secret code you created for additional security when receiving data from the payment service.

$wallet - identifier of the wallet we are working with

For convenient payment from a mobile phone, we show a QR code with a Bitcoin address,

PHP:

PHP:
echo '<img src="https://apirone.com/api/v1/qr?message='. $decoded["address"] .'">' ;

The payment amount can be any, since the payment will be divided by percentage.

Callback processing

The callback page is needed to receive transaction data and execute business logic when paying. Bitcoin processing transfers to this page: address, amount, transaction hash, number of confirmations and the data we specified: invoice_id and secret. The data is transferred by POST request in JSON format, it is more convenient and safer.

For processing we need a simple script:

PHP:
PHP:
<?php
$secret = "7j0ap91o99cxj8k9";

//receive JSON data
$data = file_get_contents('php://input');

if ($data) {
 $params = json_decode($data, true);

 // Check the secret code
 if ($params["data"]["secret"] !== $secret) die();

 $url = $params["data"]["url"];
 $logo = $params["data"]["logo"];
 $input_address = $params["input_address"];
 $value_in_satoshi = $params["value"];

 // If the number of confirmations is zero, then we write the data to the database, but do not pay

 if ($params["confirmations"] == 0) {

 // write transaction data and
 mark the invoice status - waiting for payment confirmation

 }

 if ($params["confirmations"] >= 3) {

 // the transaction is confirmed three times on the network, we respond to the payment server *ok* and set the order status to payment

 echo "*ok*";
 }
}
?>

We strongly recommend making a payment after at least one confirmation online!

Payout in Bitcoin. Backend server.

After the payment is confirmed by the client, we need to get the list of payment recipients and percentages again. Then we create a JSON request for payment:

PHP:
PHP:
<?php
$secret = "7j0ap91o99cxj8k9";

//receive JSON data
$data = file_get_contents('php://input');

if ($data) {
 $params = json_decode($data, true);

 // Check the secret code
 if ($params["data"]["secret"] !== $secret) die();

 $url = $params["data"]["url"];
 $logo = $params["data"]["logo"];
 $input_address = $params["input_address"];
 $value_in_satoshi = $params["value"];

 // If the number of confirmations is zero, then we write the data to the database, but do not pay

 if ($params["confirmations"] == 0) {

 // write transaction data and
 mark the invoice status - waiting for payment confirmation

 }

 if ($params["confirmations"] >= 3) {

 // the transaction is confirmed three times on the network, we respond to the payment server *ok* and set the order status to payment

 echo "*ok*";
 }
}
?>

We strongly recommend making a payment after at least one confirmation online!

Payout in Bitcoin. Backend server.

After the payment is confirmed by the client, we need to get the list of payment recipients and percentages again. Then we create a JSON request for payment:

PHP:
PHP:
<?php
  $WalletID = "8e9c53a62755bcc66e4d2aaae3a2af6d";
 
  $json_data = '{"transfer_key": "3847fud983d30d303ie093uj97"}' .
  array (
    'destinations' => array (      
        array('address' => "1apiKcJM95jENZeom2dQo8ShK7dUQkRaS", 'amount' => "52.57%"),
        array('address' => "1ApiwpetcWnBbkpU7cb7biPfc6Tiucasf8", 'amount' => "47.43%")
    )
  );
 
  $api_base = file_get_contents("https://apirone.com/api/v2/btc/wallet/" .
              $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_encode($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 hash: " . $decoded["txid"];
?>

Here we form a payout to two bitcoin addresses in the appropriate proportions, without taking into account the mixer commission, you should add it to the list.

In this case, the payment gateway fee will be fixed and will be only 0.0002 BTC, regardless of the amount. The Bitcoin network fee is deducted proportionally from the entire transaction.

Attracting Bitcoin investors and advertising.

The "Mixer" needs working capital, which you can attract at the expense of investors, sharing part of the profit with them. And for greater involvement of the audience in the project, you can add a referral program for attracting clients, say, for each attracted client, an instant payment.

Create a bonus system for bloggers and active social media participants. networks, distributing incentives for active advertising. Let's say several thousand Satoshi for each action.

You can be a good organizer, an advanced project manager or a startup to start a Bitcoin mixer. After all, every idea is worthy of implementation!
 
Top