0

I have been using Bitcoin (JSON-RPC) for Blockchain.info

this plugin for bitcoin transaction in magento. one day suddenly it stopped working due to update in block chain wallet version. so i switched to spectrocoin. Later i found that spectrocoin is not working the way i have expected .So i decided to get a fix for appmerce.Then i found this Blockchain Wallet API V2

I went through it's documentation but i couldn't find a way to integrate this to magento. I can see lot of js files. So i'm open to suggestions.I would like to know how can i integrate Blockchain Wallet API V2` to magento or PHP.

  • Please fix the spelling in your posts and use complete sentences. – Murch Nov 29 '16 at 14:30
3

You need to run a local nodejs service. From there you can then integrate with php.

As of January 2016 Blockchain.info made changes to the wallet API service that now require you to run a local nodeJS service to handle the calls. This will require you to have root access to your webserver so you will need to use a VPS instead of a basic shared web host.

  • Create an account with blockchain.info, and register an email address.
  • Request an API key here https://blockchain.info/api/api_create_code
  • Login to your blockchain wallet, goto account settings, IP Restrictions and check the box to allow API access
  • Goto DigitalOcean, register, create a new droplet, goto one-click-install and choose the MEAN stack Other options are up to you, I chose $5/month and IPv6
  • Open your console or SSH through putty
  • type root, enter your password, create a new password
  • Now you're in!
  • type sudo apt-get update
  • now install nodejs
  • type sudo apt-get install nodejs
  • press y to accept
  • install NPM
  • sudo apt-get install npm
  • y to accept
  • install blockchain-wallet
  • type npm install -g blockchain-wallet-service
  • if you see some warnings or errors, don't worry
  • once complete verify it installed
  • navigate to usr/local/bin
  • type node blockchain-wallet-service -V
  • if installed it should return with the version number
  • you can now launch the service, but first we will want to install apache and PHP so we can interact with it outside of nodejs
  • Navigate back to root
  • Install Apache
  • type sudo apt-get update
  • type sudo apt-get install apache2
  • Install PHP
  • type sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
  • Install curl
  • type sudo apt-get install php5-curl
  • Restart your VPS reboot
  • Launch the blockchain-wallet-service
  • navigate to usr/local/bin
  • type node blockchain-wallet-service start --port 3030
  • Login to your wallet using the below code

    $url = "http://127.0.0.1:3030/merchant/YOUR-GUID/login?password=YOUR-PASSWORD&api_code=YOUR-API-CODE";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_URL, $url);
    $ccc = curl_exec($ch);
    $json = json_decode($ccc, true);
    var_dump($json);

Save the above and run it on your server. The file should keep spinning and loading since blockchain doesn't recognize the IP address. Wait for it to timeout about 60 seconds, and then check your email. Blockchain should have sent you an API access attempt showing what IP tried to connect. Follow the link and authorize the attempt, also the IP address from the email and whitelist it in your wallet account settings.

Now try running the file again. If you did everything correctly you should see a response that lists your GUID followed by Success TRUE

Now you're connected and you can start sending requests with your wallet.

The calls work the same as version one, except you will send your requests through this service instead of get requests to blockchain.info.

  • dear, how we can run it on our servers as it is currently running on localhost. what should we've to do to run it from servers where should we'll be call it in our websites from any where? – Tashen Jazbi Sep 6 '18 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.