Multiple Daemons
Since version 1.2.0, laravel-bitcoinrpc allows you to use multiple configurations to connect to different bitcoin or even altcoin daemons.
You’ll need to define parameters for each of your connections in ./config/bitcoind.php
(see example)
<?php
return [
...
// Bitcoin Core
'default' => [
'scheme' => 'http',
'host' => 'localhost',
'port' => 8332,
'user' => '(rpcuser from bitcoin.conf)', // required
'password' => '(rpcpassword from bitcoin.conf)', // required
'ca' => null,
'timeout' => false,
'zeromq' => null,
],
// Litecoin Core
'litecoin' => [
'scheme' => 'http',
'host' => 'localhost',
'port' => 9332,
'user' => '(rpcuser from litecoin.conf)', // required
'password' => '(rpcpassword from litecoin.conf)', // required
'ca' => null,
'timeout' => false,
'zeromq' => null,
],
...
];
Then, you can call specific configuration by passing it’s name to client()
method through any means described in Making Requests section.
$blockhash = bitcoind()
->client('litecoin')
->getBestBlockHash();