p2p alternatives

46 views
Skip to first unread message

Oscar Guindzberg

unread,
Nov 16, 2020, 5:07:03 PM11/16/20
to bitc...@googlegroups.com
Hi,

Are there examples of using bitcoinj's wallet and blockchain without
using bitcoin p2p to get blockchain data?

E.g. using bitcoin core rpc interface (
https://github.com/johannbarbie/BitcoindClient4J) or a block explorer
API to get blockchain data.

I am trying to find ways to integrate electrumJ with bitcoinj.

Thanks.

--
Oscar Guindzberg

Sean Gilligan

unread,
Nov 16, 2020, 6:35:50 PM11/16/20
to bitcoinj
You can use the ConsensusJ RPC client which conveniently uses bitcoinj types (where possible) for parameters and return values:


Gradle setup:

repositories {
maven {
}
}

dependencies {
    implementation 'com.msgilligan:cj-btc-jsonrpc:0.5.4'
}

Example code:

var client = new BitcoinClient(MainNetParams.get(), RpcURI.defaultMainNetURI, rpcTestUser, rpcTestPassword);
Sha256Hash hash = getBlockHash(324140);
Block block = getBlock(hash);

You probably can't use WalletKit or any of the blockchain implementations, but you could probably use one of the Key Chain classes.

-- Sean
Reply all
Reply to author
Forward
0 new messages