EasyBitcoin-PHP very slow

1

I am trying to use bitcoins on my website. For this I use EasyBitcoin-PHP. It works good except that it is very slow. It takes about 5 seconds to load a simple script like this:

<?php
require_once 'easybitcoin.php'; 
$bitcoin = new Bitcoin('...', '...');
echo $bitcoin->getinfo();
?>

Is there a faster alternative than EasyBitcoin-PHP or is there a way to make it faster?

Jan Wytze

Posted 2016-01-12T20:51:49.123

Reputation: 289

Answers

3

This is likely implementation specific. Bitcoind is an intensive application to run on a basic server, especially if the webapp lives on the same machine.

You should never directly connect a page's code with Bitcoin Core, for static information you should run a cronjob to update a cache every n seconds. If all you're showing is the last 10 blocks, maybe you shouldn't have every user at that moment triggering calls for the same data.

Update: It's worth mentioning that RPC responses suffer a delay whenever Bitcoin Core is syncing, whether syncing for the first time, or being switched on after a day. This is because the block verification functions block for a while.

karimkorun

Posted 2016-01-12T20:51:49.123

Reputation: 763

The problem was that bitcoind wasn't yet synchronized but your also of course will also help me.Jan Wytze 2016-01-13T16:46:28.743

Ah, I was going to mention that but thought against it :) I'll mention it in my answer, since it'll happen every time you start the node.karimkorun 2016-01-14T18:20:41.783