use of com.neemre.btcdcli4j.core.client.BtcdClientImpl in project bisq-core by bisq-network.
the class RpcService method setup.
public void setup() throws BsqBlockchainException {
try {
long startTs = System.currentTimeMillis();
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
CloseableHttpClient httpProvider = HttpClients.custom().setConnectionManager(cm).build();
Properties nodeConfig = new Properties();
nodeConfig.setProperty("node.bitcoind.rpc.protocol", "http");
nodeConfig.setProperty("node.bitcoind.rpc.host", "127.0.0.1");
nodeConfig.setProperty("node.bitcoind.rpc.auth_scheme", "Basic");
nodeConfig.setProperty("node.bitcoind.rpc.user", rpcUser);
nodeConfig.setProperty("node.bitcoind.rpc.password", rpcPassword);
nodeConfig.setProperty("node.bitcoind.rpc.port", rpcPort);
nodeConfig.setProperty("node.bitcoind.notification.block.port", rpcBlockPort);
nodeConfig.setProperty("node.bitcoind.notification.alert.port", "64647");
nodeConfig.setProperty("node.bitcoind.notification.wallet.port", "64648");
nodeConfig.setProperty("node.bitcoind.http.auth_scheme", "Basic");
BtcdClientImpl client = new BtcdClientImpl(httpProvider, nodeConfig);
daemon = new BtcdDaemonImpl(client);
log.info("Setup took {} ms", System.currentTimeMillis() - startTs);
this.client = client;
} catch (BitcoindException | CommunicationException e) {
if (e instanceof CommunicationException)
log.error("Probably Bitcoin core is not running or the rpc port is not set correctly. rpcPort=" + rpcPort);
log.error(e.toString());
e.printStackTrace();
log.error(e.getCause() != null ? e.getCause().toString() : "e.getCause()=null");
throw new BsqBlockchainException(e.getMessage(), e);
} catch (Throwable e) {
log.error(e.toString());
e.printStackTrace();
throw new BsqBlockchainException(e.toString(), e);
}
}
Aggregations