-
Notifications
You must be signed in to change notification settings - Fork 0
/
17_2_App-listen.java
36 lines (27 loc) · 955 Bytes
/
17_2_App-listen.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.blockchaincommons.lbtc;
import wf.bitcoin.javabitcoindrpcclient.BitcoinAcceptor;
import wf.bitcoin.javabitcoindrpcclient.BitcoinJSONRPCClient;
import wf.bitcoin.javabitcoindrpcclient.BitcoinPaymentListener;
import wf.bitcoin.javabitcoindrpcclient.BitcoindRpcClient;
import wf.bitcoin.javabitcoindrpcclient.BitcoindRpcClient.*;
public class App
{
public static void main( String[] args ) throws Exception
{
BitcoindRpcClient rpcClient = new BitcoinJSONRPCClient("http://StandUp:6
305f1b2dbb3bc5a16cd0f4aac7e1eba@localhost:18332");
String blockHash = rpcClient.getBestBlockHash();
BitcoinAcceptor acceptor = new BitcoinAcceptor(rpcClient, blockHash, 6,
new BitcoinPaymentListener() {
@Override
public void transaction(Transaction tx) {
System.out.println("Transaction: " + tx);
}
@Override
public void block(String block) {
System.out.println("Block: " + block);
}
});
acceptor.run();
}
}