org.bitcoinj.utils.BriefLogFormatter Java Examples

The following examples show how to use org.bitcoinj.utils.BriefLogFormatter. 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: BlockChain.java    From polling-station-app with GNU Lesser General Public License v3.0 7 votes vote down vote up
public void startDownload() {
    BriefLogFormatter.init();
    String filePrefix = "voting-wallet";
    File walletFile = new File(Environment.getExternalStorageDirectory() + "/" + Util.FOLDER_DIGITAL_VOTING_PASS);
    if (!walletFile.exists()) {
        walletFile.mkdirs();
    }
    kit = new WalletAppKit(params, walletFile, filePrefix);

    //set the observer
    kit.setDownloadListener(progressTracker);

    kit.setBlockingStartup(false);

    PeerAddress peer = new PeerAddress(params, peeraddr);
    kit.setPeerNodes(peer);
    kit.startAsync();
}
 
Example #2
Source File: FetchBlock.java    From green_android with GNU General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    BriefLogFormatter.init();
    System.out.println("Connecting to node");
    final NetworkParameters params = TestNet3Params.get();

    BlockStore blockStore = new MemoryBlockStore(params);
    BlockChain chain = new BlockChain(params, blockStore);
    PeerGroup peerGroup = new PeerGroup(params, chain);
    peerGroup.start();
    PeerAddress addr = new PeerAddress(params, InetAddress.getLocalHost());
    peerGroup.addAddress(addr);
    peerGroup.waitForPeers(1).get();
    Peer peer = peerGroup.getConnectedPeers().get(0);

    Sha256Hash blockHash = Sha256Hash.wrap(args[0]);
    Future<Block> future = peer.getBlock(blockHash);
    System.out.println("Waiting for node to send us the requested block: " + blockHash);
    Block block = future.get();
    System.out.println(block);
    peerGroup.stopAsync();
}
 
Example #3
Source File: BlockChainTest.java    From green_android with GNU General Public License v3.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    BriefLogFormatter.initVerbose();
    Context.propagate(new Context(testNet, 100, Coin.ZERO, false));
    testNetChain = new BlockChain(testNet, new Wallet(testNet), new MemoryBlockStore(testNet));
    Context.propagate(new Context(PARAMS, 100, Coin.ZERO, false));
    wallet = new Wallet(PARAMS) {
        @Override
        public void receiveFromBlock(Transaction tx, StoredBlock block, BlockChain.NewBlockType blockType,
                                     int relativityOffset) throws VerificationException {
            super.receiveFromBlock(tx, block, blockType, relativityOffset);
            BlockChainTest.this.block[0] = block;
            if (isTransactionRelevant(tx) && tx.isCoinBase()) {
                BlockChainTest.this.coinbaseTransaction = tx;
            }
        }
    };
    wallet.freshReceiveKey();

    resetBlockStore();
    chain = new BlockChain(PARAMS, wallet, blockStore);

    coinbaseTo = wallet.currentReceiveKey().toAddress(PARAMS);
}
 
Example #4
Source File: WatchMempool.java    From green_android with GNU General Public License v3.0 6 votes vote down vote up
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 #5
Source File: TestFeeLevel.java    From green_android with GNU General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    BriefLogFormatter.initWithSilentBitcoinJ();
    if (args.length == 0) {
        System.err.println("Specify the fee rate to test in satoshis/kB as the first argument.");
        return;
    }

    Coin feeRateToTest = Coin.valueOf(Long.parseLong(args[0]));
    System.out.println("Fee rate to test is " + feeRateToTest.toFriendlyString() + "/kB");

    kit = new WalletAppKit(PARAMS, new File("."), "testfeelevel");
    kit.startAsync();
    kit.awaitRunning();
    try {
        go(feeRateToTest, NUM_OUTPUTS);
    } finally {
        kit.stopAsync();
        kit.awaitTerminated();
    }
}
 
Example #6
Source File: FetchBlock.java    From GreenBits with GNU General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    BriefLogFormatter.init();
    System.out.println("Connecting to node");
    final NetworkParameters params = TestNet3Params.get();

    BlockStore blockStore = new MemoryBlockStore(params);
    BlockChain chain = new BlockChain(params, blockStore);
    PeerGroup peerGroup = new PeerGroup(params, chain);
    peerGroup.start();
    PeerAddress addr = new PeerAddress(params, InetAddress.getLocalHost());
    peerGroup.addAddress(addr);
    peerGroup.waitForPeers(1).get();
    Peer peer = peerGroup.getConnectedPeers().get(0);

    Sha256Hash blockHash = Sha256Hash.wrap(args[0]);
    Future<Block> future = peer.getBlock(blockHash);
    System.out.println("Waiting for node to send us the requested block: " + blockHash);
    Block block = future.get();
    System.out.println(block);
    peerGroup.stopAsync();
}
 
Example #7
Source File: TestFeeLevel.java    From GreenBits with GNU General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    BriefLogFormatter.initWithSilentBitcoinJ();
    if (args.length == 0) {
        System.err.println("Specify the fee rate to test in satoshis/kB as the first argument.");
        return;
    }

    Coin feeRateToTest = Coin.valueOf(Long.parseLong(args[0]));
    System.out.println("Fee rate to test is " + feeRateToTest.toFriendlyString() + "/kB");

    kit = new WalletAppKit(PARAMS, new File("."), "testfeelevel");
    kit.startAsync();
    kit.awaitRunning();
    try {
        go(feeRateToTest, NUM_OUTPUTS);
    } finally {
        kit.stopAsync();
        kit.awaitTerminated();
    }
}
 
Example #8
Source File: WatchMempool.java    From GreenBits with GNU General Public License v3.0 6 votes vote down vote up
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 #9
Source File: BlockChainTest.java    From bcm-android with GNU General Public License v3.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    BriefLogFormatter.initVerbose();
    Context.propagate(new Context(TESTNET, 100, Coin.ZERO, false));
    testNetChain = new BlockChain(TESTNET, new Wallet(TESTNET), new MemoryBlockStore(TESTNET));
    Context.propagate(new Context(UNITTEST, 100, Coin.ZERO, false));
    wallet = new Wallet(UNITTEST) {
        @Override
        public void receiveFromBlock(Transaction tx, StoredBlock block, BlockChain.NewBlockType blockType,
                                     int relativityOffset) throws VerificationException {
            super.receiveFromBlock(tx, block, blockType, relativityOffset);
            BlockChainTest.this.block[0] = block;
            if (isTransactionRelevant(tx) && tx.isCoinBase()) {
                BlockChainTest.this.coinbaseTransaction = tx;
            }
        }
    };
    wallet.freshReceiveKey();

    resetBlockStore();
    chain = new BlockChain(UNITTEST, wallet, blockStore);

    coinbaseTo = LegacyAddress.fromKey(UNITTEST, wallet.currentReceiveKey());
}
 
Example #10
Source File: BlockChainTest.java    From GreenBits with GNU General Public License v3.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    BriefLogFormatter.initVerbose();
    Context.propagate(new Context(testNet, 100, Coin.ZERO, false));
    testNetChain = new BlockChain(testNet, new Wallet(testNet), new MemoryBlockStore(testNet));
    Context.propagate(new Context(PARAMS, 100, Coin.ZERO, false));
    wallet = new Wallet(PARAMS) {
        @Override
        public void receiveFromBlock(Transaction tx, StoredBlock block, BlockChain.NewBlockType blockType,
                                     int relativityOffset) throws VerificationException {
            super.receiveFromBlock(tx, block, blockType, relativityOffset);
            BlockChainTest.this.block[0] = block;
            if (isTransactionRelevant(tx) && tx.isCoinBase()) {
                BlockChainTest.this.coinbaseTransaction = tx;
            }
        }
    };
    wallet.freshReceiveKey();

    resetBlockStore();
    chain = new BlockChain(PARAMS, wallet, blockStore);

    coinbaseTo = wallet.currentReceiveKey().toAddress(PARAMS);
}
 
Example #11
Source File: KeyCrypterScryptTest.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    Protos.ScryptParameters.Builder scryptParametersBuilder = Protos.ScryptParameters.newBuilder()
            .setSalt(ByteString.copyFrom(KeyCrypterScrypt.randomSalt()));
    scryptParameters = scryptParametersBuilder.build();

    BriefLogFormatter.init();
}
 
Example #12
Source File: DeterministicKeyChainTest.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setup() {
    BriefLogFormatter.init();
    // You should use a random seed instead. The secs constant comes from the unit test file, so we can compare
    // serialized data properly.
    long secs = 1389353062L;
    chain = new DeterministicKeyChain(ENTROPY, "", secs);
    chain.setLookaheadSize(10);
    assertEquals(secs, checkNotNull(chain.getSeed()).getCreationTimeSeconds());
}
 
Example #13
Source File: DeterministicKeyChainTest.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setup() {
    BriefLogFormatter.init();
    // You should use a random seed instead. The secs constant comes from the unit test file, so we can compare
    // serialized data properly.
    long secs = 1389353062L;
    chain = new DeterministicKeyChain(ENTROPY, "", secs);
    chain.setLookaheadSize(10);
    assertEquals(secs, checkNotNull(chain.getSeed()).getCreationTimeSeconds());

    bip44chain = new DeterministicKeyChain(new DeterministicSeed(ENTROPY, "", secs),
            ImmutableList.of(new ChildNumber(44, true), new ChildNumber(1, true), ChildNumber.ZERO_HARDENED));
    bip44chain.setLookaheadSize(10);
    assertEquals(secs, checkNotNull(bip44chain.getSeed()).getCreationTimeSeconds());
}
 
Example #14
Source File: KeyChainGroupTest.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setup() {
    BriefLogFormatter.init();
    Utils.setMockClock();
    group = new KeyChainGroup(PARAMS);
    group.setLookaheadSize(LOOKAHEAD_SIZE);   // Don't want slow tests.
    group.getActiveKeyChain();  // Force create a chain.

    watchingAccountKey = DeterministicKey.deserializeB58(null, XPUB, PARAMS);
}
 
Example #15
Source File: ExamplePaymentChannelClient.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    BriefLogFormatter.init();
    OptionParser parser = new OptionParser();
    OptionSpec<NetworkEnum> net = parser.accepts("net", "The network to run the examples on").withRequiredArg().ofType(NetworkEnum.class).defaultsTo(NetworkEnum.TEST);
    OptionSpec<Integer> version = parser.accepts("version", "The payment channel protocol to use").withRequiredArg().ofType(Integer.class);
    parser.accepts("help", "Displays program options");
    OptionSet opts = parser.parse(args);
    if (opts.has("help") || !opts.has(net) || opts.nonOptionArguments().size() != 1) {
        System.err.println("usage: ExamplePaymentChannelClient --net=MAIN/TEST/REGTEST --version=1/2 host");
        parser.printHelpOn(System.err);
        return;
    }
    IPaymentChannelClient.ClientChannelProperties clientChannelProperties = new PaymentChannelClient.DefaultClientChannelProperties(){
        @Override
        public PaymentChannelClient.VersionSelector versionSelector() { return PaymentChannelClient.VersionSelector.VERSION_1; }
    };

    if (opts.has("version")) {
        switch (version.value(opts)) {
            case 1:
                // Keep the default
                break;
            case 2:
                clientChannelProperties = new PaymentChannelClient.DefaultClientChannelProperties(){
                    @Override
                    public PaymentChannelClient.VersionSelector versionSelector() { return PaymentChannelClient.VersionSelector.VERSION_2; }
                };
                break;
            default:
                System.err.println("Invalid version - valid versions are 1, 2");
                return;
        }
    }
    NetworkParameters params = net.value(opts).get();
    new ExamplePaymentChannelClient().run(opts.nonOptionArguments().get(0), clientChannelProperties, params);
}
 
Example #16
Source File: ExamplePaymentChannelServer.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    BriefLogFormatter.init();
    OptionParser parser = new OptionParser();
    OptionSpec<NetworkEnum> net = parser.accepts("net", "The network to run the examples on").withRequiredArg().ofType(NetworkEnum.class).defaultsTo(NetworkEnum.TEST);
    parser.accepts("help", "Displays program options");
    OptionSet opts = parser.parse(args);
    if (opts.has("help") || !opts.has(net)) {
        System.err.println("usage: ExamplePaymentChannelServer --net=MAIN/TEST/REGTEST");
        parser.printHelpOn(System.err);
        return;
    }
    NetworkParameters params = net.value(opts).get();
    new ExamplePaymentChannelServer().run(params);
}
 
Example #17
Source File: TestWithWallet.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
public void setUp() throws Exception {
    BriefLogFormatter.init();
    Context.propagate(new Context(PARAMS, 100, Coin.ZERO, false));
    wallet = new Wallet(PARAMS);
    myKey = wallet.currentReceiveKey();
    myAddress = myKey.toAddress(PARAMS);
    blockStore = new MemoryBlockStore(PARAMS);
    chain = new BlockChain(PARAMS, wallet, blockStore);
}
 
Example #18
Source File: ChainSplitTest.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    BriefLogFormatter.init();
    Utils.setMockClock(); // Use mock clock
    Context.propagate(new Context(PARAMS, 100, Coin.ZERO, false));
    MemoryBlockStore blockStore = new MemoryBlockStore(PARAMS);
    wallet = new Wallet(PARAMS);
    ECKey key1 = wallet.freshReceiveKey();
    ECKey key2 = wallet.freshReceiveKey();
    chain = new BlockChain(PARAMS, wallet, blockStore);
    coinsTo = key1.toAddress(PARAMS);
    coinsTo2 = key2.toAddress(PARAMS);
    someOtherGuy = new ECKey().toAddress(PARAMS);
}
 
Example #19
Source File: FetchTransactions.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    BriefLogFormatter.init();
    System.out.println("Connecting to node");
    final NetworkParameters params = TestNet3Params.get();

    BlockStore blockStore = new MemoryBlockStore(params);
    BlockChain chain = new BlockChain(params, blockStore);
    PeerGroup peerGroup = new PeerGroup(params, chain);
    peerGroup.start();
    peerGroup.addAddress(new PeerAddress(params, InetAddress.getLocalHost()));
    peerGroup.waitForPeers(1).get();
    Peer peer = peerGroup.getConnectedPeers().get(0);

    Sha256Hash txHash = Sha256Hash.wrap(args[0]);
    ListenableFuture<Transaction> future = peer.getPeerMempoolTransaction(txHash);
    System.out.println("Waiting for node to send us the requested transaction: " + txHash);
    Transaction tx = future.get();
    System.out.println(tx);

    System.out.println("Waiting for node to send us the dependencies ...");
    List<Transaction> deps = peer.downloadDependencies(tx).get();
    for (Transaction dep : deps) {
        System.out.println("Got dependency " + dep.getHashAsString());
    }

    System.out.println("Done.");
    peerGroup.stop();
}
 
Example #20
Source File: ECKeyTest.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    Protos.ScryptParameters.Builder scryptParametersBuilder = Protos.ScryptParameters.newBuilder().setSalt(ByteString.copyFrom(KeyCrypterScrypt.randomSalt()));
    ScryptParameters scryptParameters = scryptParametersBuilder.build();
    keyCrypter = new KeyCrypterScrypt(scryptParameters);

    BriefLogFormatter.init();
}
 
Example #21
Source File: ECKeyTest.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    Protos.ScryptParameters.Builder scryptParametersBuilder = Protos.ScryptParameters.newBuilder().setSalt(ByteString.copyFrom(KeyCrypterScrypt.randomSalt()));
    ScryptParameters scryptParameters = scryptParametersBuilder.build();
    keyCrypter = new KeyCrypterScrypt(scryptParameters);

    BriefLogFormatter.init();
}
 
Example #22
Source File: TestWithWallet.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
public void setUp() throws Exception {
    BriefLogFormatter.init();
    Context.propagate(new Context(PARAMS, 100, Coin.ZERO, false));
    wallet = new Wallet(PARAMS);
    myKey = wallet.currentReceiveKey();
    myAddress = myKey.toAddress(PARAMS);
    blockStore = new MemoryBlockStore(PARAMS);
    chain = new BlockChain(PARAMS, wallet, blockStore);
}
 
Example #23
Source File: KeyChainGroupTest.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setup() {
    BriefLogFormatter.init();
    Utils.setMockClock();
    group = new KeyChainGroup(PARAMS);
    group.setLookaheadSize(LOOKAHEAD_SIZE);   // Don't want slow tests.
    group.getActiveKeyChain();  // Force create a chain.

    watchingAccountKey = DeterministicKey.deserializeB58(null, XPUB, PARAMS);
}
 
Example #24
Source File: ChainSplitTest.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    BriefLogFormatter.init();
    Utils.setMockClock(); // Use mock clock
    Context.propagate(new Context(PARAMS, 100, Coin.ZERO, false));
    MemoryBlockStore blockStore = new MemoryBlockStore(PARAMS);
    wallet = new Wallet(PARAMS);
    ECKey key1 = wallet.freshReceiveKey();
    ECKey key2 = wallet.freshReceiveKey();
    chain = new BlockChain(PARAMS, wallet, blockStore);
    coinsTo = key1.toAddress(PARAMS);
    coinsTo2 = key2.toAddress(PARAMS);
    someOtherGuy = new ECKey().toAddress(PARAMS);
}
 
Example #25
Source File: DeterministicKeyChainTest.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setup() {
    BriefLogFormatter.init();
    // You should use a random seed instead. The secs constant comes from the unit test file, so we can compare
    // serialized data properly.
    long secs = 1389353062L;
    chain = new DeterministicKeyChain(ENTROPY, "", secs);
    chain.setLookaheadSize(10);
    assertEquals(secs, checkNotNull(chain.getSeed()).getCreationTimeSeconds());
}
 
Example #26
Source File: KeyCrypterScryptTest.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    Protos.ScryptParameters.Builder scryptParametersBuilder = Protos.ScryptParameters.newBuilder()
            .setSalt(ByteString.copyFrom(KeyCrypterScrypt.randomSalt()));
    scryptParameters = scryptParametersBuilder.build();

    BriefLogFormatter.init();
}
 
Example #27
Source File: KeyCrypterScryptTest.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    Protos.ScryptParameters.Builder scryptParametersBuilder = Protos.ScryptParameters.newBuilder()
            .setSalt(ByteString.copyFrom(KeyCrypterScrypt.randomSalt()));
    scryptParameters = scryptParametersBuilder.build();

    BriefLogFormatter.init();
}
 
Example #28
Source File: KeyChainGroupTest.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setup() {
    BriefLogFormatter.init();
    Utils.setMockClock();
    group = new KeyChainGroup(MAINNET);
    group.setLookaheadSize(LOOKAHEAD_SIZE);   // Don't want slow tests.
    group.getActiveKeyChain();  // Force create a chain.

    watchingAccountKey = DeterministicKey.deserializeB58(null, XPUB, MAINNET);
}
 
Example #29
Source File: ExamplePaymentChannelClient.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    BriefLogFormatter.init();
    OptionParser parser = new OptionParser();
    OptionSpec<NetworkEnum> net = parser.accepts("net", "The network to run the examples on").withRequiredArg().ofType(NetworkEnum.class).defaultsTo(NetworkEnum.TEST);
    OptionSpec<Integer> version = parser.accepts("version", "The payment channel protocol to use").withRequiredArg().ofType(Integer.class);
    parser.accepts("help", "Displays program options");
    OptionSet opts = parser.parse(args);
    if (opts.has("help") || !opts.has(net) || opts.nonOptionArguments().size() != 1) {
        System.err.println("usage: ExamplePaymentChannelClient --net=MAIN/TEST/REGTEST --version=1/2 host");
        parser.printHelpOn(System.err);
        return;
    }
    IPaymentChannelClient.ClientChannelProperties clientChannelProperties = new PaymentChannelClient.DefaultClientChannelProperties(){
        @Override
        public PaymentChannelClient.VersionSelector versionSelector() { return PaymentChannelClient.VersionSelector.VERSION_1; }
    };

    if (opts.has("version")) {
        switch (version.value(opts)) {
            case 1:
                // Keep the default
                break;
            case 2:
                clientChannelProperties = new PaymentChannelClient.DefaultClientChannelProperties(){
                    @Override
                    public PaymentChannelClient.VersionSelector versionSelector() { return PaymentChannelClient.VersionSelector.VERSION_2; }
                };
                break;
            default:
                System.err.println("Invalid version - valid versions are 1, 2");
                return;
        }
    }
    NetworkParameters params = net.value(opts).get();
    new ExamplePaymentChannelClient().run(opts.nonOptionArguments().get(0), clientChannelProperties, params);
}
 
Example #30
Source File: TestWithWallet.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
public void setUp() throws Exception {
    BriefLogFormatter.init();
    Context.propagate(new Context(UNITTEST, 100, Coin.ZERO, false));
    wallet = new Wallet(UNITTEST);
    myKey = wallet.currentReceiveKey();
    myAddress = LegacyAddress.fromKey(UNITTEST, myKey);
    blockStore = new MemoryBlockStore(UNITTEST);
    chain = new BlockChain(UNITTEST, wallet, blockStore);
}