5+ Facts You Must Know About DigitalPortal2.Club Before You

Using blockchain API

Uses For The Blockchain / November 13, 2017

All functionality is provided through the Blockchain object.

###Call Limits

The official documentation lists API call limits, which may be bypassed with an API code. If you use a code, enter it when you create the Blockchain object:

$Blockchain = new \Blockchain\Blockchain(' ', $my_api_code);

Set the cURL timeout, in seconds, with the setTimeout member function:

$Blockchain->setTimeout($timeout_seconds);

The default network timeout is 60 seconds.

A Note about Bitcoin Values

All Bitcoin values returned by the API are in string float format, in order to preserve full value precision. It is recommended that all arithmetic operations performed on Bitcoin values within PHP utilize the bcmath functions as follows:

#####bcadd Add Two Numbers

$result = bcadd("101.234115", "3", 8); // "13"

#####bcsub Subtract Two Numbers

$result = bcsub("101.234115", "3", 8); // "7"

#####bcmul Multiply Two Numbers

$result = bcmul("101.234115", "3", 8); // "3513"

#####bcdiv Divide Two Numbers

$result = bcdiv("101.234115", "3", 8); // "2.89833679"

The 8 in the final parameter of each bcmath function call represents the numerical precision to keep in the result.

More help on the bcmath functions can be found in the PHP BC Math documentation.

Source: github.com