2

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?

1 Answer 1

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.

2
  • The problem was that bitcoind wasn't yet synchronized but your also of course will also help me.
    – Jan Wytze
    Commented Jan 13, 2016 at 16:46
  • 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
    Commented Jan 14, 2016 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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