Announcement

Collapse
No announcement yet.

How to do mass payouts via blockchain API

Collapse
X
Collapse
  •  

  • How to do mass payouts via blockchain API

    How to do mass payouts via blockchain API

    What is BlockChain?
    The blockchain is basically an Application Programming Interface (API) a mediator like a wallet which is used to send the payments to the users or another person. Blockchain generates the unique address ( BoatSLRHtKNngkdXEeobR76b53LETtpyT ) for payments to different users. So, in short, the addresses generated are the identifiers which are used to send bitcoins to another person.

    Click image for larger version  Name:	blogchain.png Views:	1 Size:	112.3 KB ID:	293

    1. Steps:
    Create a file index.php
    Code:

    Code:
    <?php
    $api_key = "your_blockchain_api_Key";
    $xpub = "xpubYour_extended_public_key";
    $secret = "your_secret"; //this can be anything you want
    $rootURL = "http://yourrooturl.com/directory"; //example https://mysite.org or http://yourhomepage.com/store
    $orderID = uniqid();
    
    //call blockchain info receive payments API
    $callback_url = $rootURL."/callback.php?invoice=".$orderID."&secret=".$secret ;
    $receive_url = "https://api.blockchain.info/v2/receive?key=".$api_key."&xpub=".$xpub."&callback=" .urlencode($callback_url);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_URL, $receive_url);
    $ccc = curl_exec($ch);
    $json = json_decode($ccc, true);
    $payTo = $json['address']; //the newly created address will be stored under 'address' in the JSON response
    echo $payTo; //echo out the newly created receiving address
    ?>
    2. Implement the Callback - Create a file callback.php

    Code:
    <?php
    $secret = "abc123";
    if($_GET['secret'] != $secret){
    die('stop doing that');
    } else {
    $fff =fopen("test.txt","w");
    $value = $_GET['value']." - ";
    $fw =fwrite($fff, $value);
    $txhash =$_GET['transaction_hash']." - ";
    $fw =fwrite($fff, $txhash);
    $invoice = $_GET['invoice'];
    $fw =fwrite($fff, $invoice);
    fclose($fff);
    echo "*ok*";
    }
    ?>
    3. Steps to generate Blockchain API key -To generate BlockChain API key click on:
    1. Click on this link: https://blockchain.info/api/
    2. See below screenshot:
    Click image for larger version  Name:	screenshot-1.png Views:	1 Size:	69.4 KB ID:	284

    Click on view documentation.
    1. See below screenshot:
    Click image for larger version  Name:	screenshot-2.png Views:	1 Size:	100.9 KB ID:	285
    1. Click on “Please create an API code here including permissions to "Create Wallets""
    2. See below screenshot
    Click image for larger version  Name:	screenshot-3.png Views:	1 Size:	34.9 KB ID:	286
    1. Fill out this form.
    2. An activation link will appear on your email id. As soon as we verify our email id the api key will be generated within 2-3 business days and the api key will appear on our email id.

    4. To generate Extended Public Key (xPub)
    1. Click on this link: https://blockchain.info/
    2. Refer below screenshot:
    Click image for larger version  Name:	screenshot-4.png Views:	1 Size:	69.0 KB ID:	287
    1. Click on Get a free wallet.
    2. Refer below screenshot:
    Click image for larger version  Name:	screenshot-5.png Views:	1 Size:	27.9 KB ID:	288
    1. Fill out the information and then a verification email will be sent in your inbox along with the wallet ID.
    2. Then click on login button type the wallet ID which have been sent on your email id and type the password.
    3. Click on Settings -> Expand Settings -> Addresses
    Click image for larger version  Name:	screenshot-6.png Views:	1 Size:	68.5 KB ID:	289
    1. Click on Manage -> More Options -> Show xPub
    Click image for larger version  Name:	screenshot-7.png Views:	1 Size:	64.6 KB ID:	290
    1. Click on Continue Button then an xpub key will be there.

    5. Then upload the code which is index.php and then type the url in your browser

    i.e. yourrooturl.com/directory then an address will be generated.

    Click image for larger version  Name:	screenshot-8.png Views:	1 Size:	3.7 KB ID:	291


    Such kind of address will get generated everytime we refresh the page.

    6. Then upload the 2nd file which is callback.php and then type the url in your browser as :

    https://blockchain.info/address/url of address which is generated in yourrooturl.com/directory.

    Click image for larger version  Name:	screenshot-9.png Views:	1 Size:	53.0 KB ID:	292

    Then such kind of page occurs where we have scan the QR-code generator.

    For testing purpose:

    We can install bitpay on our mobile-device and a QR-scan option is there scan the QR-code.

    It will provide us with the option like:
    1. Pay amount so we have to select the option of the payment amount and send the transaction to that particular address.

    This how we can mass payout payment through Blockchain API.
      Posting comments is disabled.

    Categories

    Collapse

    Latest Articles

    Collapse

    • What is Containerization? A Deep Dive into Containerization
      by Lalit_Waghulkar
      Hey there tech enthusiasts!

      Today, we're diving into the tech wonderland of containerization – a game-changer in the world of software development. So, buckle up your coding belts as we explore the ins and outs of this revolutionary technology and how it's turning the tables for developers everywhere.

      Containerization: What's the Buzz About?
      Alright, let's start with the basics. Containerization is like a digital lunchbox for your apps, keeping everything they need...
      01-10-2024, 03:08 PM
    • Enable native brute-force protection
      by Akash Gorane
      Error on Imunify 360 dashboard: Enable native brute-force protection module for Dovecot to protect against IMAP/POP3 services attacks.
      Screenshot: https://prnt.sc/ExqjW1hdfOrR

      Solution: Dovecot native brute force protection module improves stability and resolves issues that standard PAM caused in some cases The following commands can be used to control the Dovecot native module.

      Enable:
      :
      imunify360-agent config update '{"PAM": {"enable":
      ...
      02-03-2023, 06:12 PM
    • Enable native brute-force protection.
      by Akash Gorane
      Error on Imunify 360 dashboard: Enable native brute-force protection module for Dovecot to protect against IMAP/POP3 services attacks.
      Screenshot: https://prnt.sc/ExqjW1hdfOrR

      Solution: Dovecot native brute force protection module improves stability and resolves issues that standard PAM caused in some cases The following commands can be used to control the Dovecot native module.
      Enable:

      :
      imunify360-agent config update '{"PAM": {"enable":
      ...
      02-03-2023, 06:09 PM
    • Top Command
      by Akash Gorane
      [COLOR=rgba(0, 0, 0, 0.9)]'top' command is used to display dynamic real-time information about running processes in the system.[/COLOR]



      - PID: Shows task’s unique process id.
      - PR: Stands for priority of the task.
      - SHR: Represents the amount of shared memory used by a task.
      - VIRT: Total virtual memory used by the task.
      - USER: User name of owner of task.
      - %CPU: Represents the CPU usage.
      - TIME+: CPU Time, the same as ‘TIME’,
      ...
      01-12-2023, 05:12 PM
    • Top Command
      by Akash Gorane
      [COLOR=rgba(0, 0, 0, 0.9)]top command is used to display dynamic real-time information about running processes in the system.[/COLOR]



      - PID: Shows task’s unique process id.
      - PR: Stands for priority of the task.
      - SHR: Represents the amount of shared memory used by a task.
      - VIRT: Total virtual memory used by the task.
      - USER: User name of owner of task.
      - %CPU: Represents the CPU usage.
      - TIME+: CPU Time, the same as ‘TIME’,...
      01-12-2023, 05:05 PM
    • TOP Command
      by Akash Gorane
      #[COLOR=rgba(0, 0, 0, 0.9)] top command is used to display dynamic real-time information about running processes in the system.[/COLOR]

      -
      - PID: Shows task’s unique process id.
      - PR: Stands for priority of the task.
      - SHR: Represents the amount of shared memory used by a task.
      - VIRT: Total virtual memory used by the task.
      - USER: User name of owner of task.
      - %CPU: Represents the CPU usage.
      - TIME+: CPU Time, the same as ‘TIME’,
      ...
      01-12-2023, 05:04 PM
    Working...
    X