mirror of
				https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
				synced 2025-10-31 02:17:24 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			17 lines
		
	
	
		
			427 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			427 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| const RpcAgent = require('bcrpc');
 | |
| agent = new RpcAgent({port: 18332, user: 'StandUp', pass: '6305f1b2dbb3bc5a16cd0
 | |
| f4aac7e1eba'});
 | |
| 
 | |
| agent.getBlockCount(function (err, blockCount) {
 | |
|   if (err)
 | |
|     throw Error(JSON.stringify(err));
 | |
|   console.log(blockCount.result);
 | |
| 
 | |
|   agent.getBlockHash(blockCount.result, function (err, hash) {
 | |
|     if (err)
 | |
|       throw Error(JSON.stringify(err));
 | |
|     console.log(hash.result);
 | |
|   });
 | |
|     
 | |
| });
 |