Java Code Examples for org.bitcoinj.core.PeerGroup#start()
The following examples show how to use
org.bitcoinj.core.PeerGroup#start() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LevelDB.java From green_android with GNU General Public License v3.0 | 6 votes |
public static void main(String[] args) throws Exception { /* * This is just a test runner that will download blockchain till block * 390000 then exit. */ FullPrunedBlockStore store = new LevelDBFullPrunedBlockStore( MainNetParams.get(), args[0], 1000, 100 * 1024 * 1024l, 10 * 1024 * 1024, 100000, true, 390000); FullPrunedBlockChain vChain = new FullPrunedBlockChain( MainNetParams.get(), store); vChain.setRunScripts(false); PeerGroup vPeerGroup = new PeerGroup(MainNetParams.get(), vChain); vPeerGroup.setUseLocalhostPeerWhenPossible(true); vPeerGroup.addAddress(InetAddress.getLocalHost()); vPeerGroup.start(); vPeerGroup.downloadBlockChain(); }
Example 2
Source File: WatchMempool.java From green_android with GNU General Public License v3.0 | 6 votes |
public static void main(String[] args) throws InterruptedException { BriefLogFormatter.init(); PeerGroup peerGroup = new PeerGroup(PARAMS); peerGroup.setMaxConnections(32); peerGroup.addPeerDiscovery(new DnsDiscovery(PARAMS)); peerGroup.addOnTransactionBroadcastListener(new OnTransactionBroadcastListener() { @Override public void onTransaction(Peer peer, Transaction tx) { Result result = DefaultRiskAnalysis.FACTORY.create(null, tx, NO_DEPS).analyze(); incrementCounter(TOTAL_KEY); log.info("tx {} result {}", tx.getHash(), result); incrementCounter(result.name()); if (result == Result.NON_STANDARD) incrementCounter(Result.NON_STANDARD + "-" + DefaultRiskAnalysis.isStandard(tx)); } }); peerGroup.start(); while (true) { Thread.sleep(STATISTICS_FREQUENCY_MS); printCounters(); } }
Example 3
Source File: LevelDB.java From GreenBits with GNU General Public License v3.0 | 6 votes |
public static void main(String[] args) throws Exception { /* * This is just a test runner that will download blockchain till block * 390000 then exit. */ FullPrunedBlockStore store = new LevelDBFullPrunedBlockStore( MainNetParams.get(), args[0], 1000, 100 * 1024 * 1024l, 10 * 1024 * 1024, 100000, true, 390000); FullPrunedBlockChain vChain = new FullPrunedBlockChain( MainNetParams.get(), store); vChain.setRunScripts(false); PeerGroup vPeerGroup = new PeerGroup(MainNetParams.get(), vChain); vPeerGroup.setUseLocalhostPeerWhenPossible(true); vPeerGroup.addAddress(InetAddress.getLocalHost()); vPeerGroup.start(); vPeerGroup.downloadBlockChain(); }
Example 4
Source File: WatchMempool.java From GreenBits with GNU General Public License v3.0 | 6 votes |
public static void main(String[] args) throws InterruptedException { BriefLogFormatter.init(); PeerGroup peerGroup = new PeerGroup(PARAMS); peerGroup.setMaxConnections(32); peerGroup.addPeerDiscovery(new DnsDiscovery(PARAMS)); peerGroup.addOnTransactionBroadcastListener(new OnTransactionBroadcastListener() { @Override public void onTransaction(Peer peer, Transaction tx) { Result result = DefaultRiskAnalysis.FACTORY.create(null, tx, NO_DEPS).analyze(); incrementCounter(TOTAL_KEY); log.info("tx {} result {}", tx.getHash(), result); incrementCounter(result.name()); if (result == Result.NON_STANDARD) incrementCounter(Result.NON_STANDARD + "-" + DefaultRiskAnalysis.isStandard(tx)); } }); peerGroup.start(); while (true) { Thread.sleep(STATISTICS_FREQUENCY_MS); printCounters(); } }