mirror of
				https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
				synced 2025-10-31 02:17:24 +00:00 
			
		
		
		
	Create 17_2_App-listen.java
This commit is contained in:
		
							parent
							
								
									83384ab2af
								
							
						
					
					
						commit
						06d02eddcd
					
				
							
								
								
									
										36
									
								
								src/17_2_App-listen.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								src/17_2_App-listen.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,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(); | ||||
|     } | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user