Java Code Examples for org.bitcoinj.utils.BriefLogFormatter

The following examples show how to use org.bitcoinj.utils.BriefLogFormatter. These examples are extracted from open source projects. 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 Project: bcm-android   Source File: BlockChainTest.java    License: 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 2
Source Project: green_android   Source File: FetchBlock.java    License: 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 Project: green_android   Source File: TestFeeLevel.java    License: 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 4
Source Project: green_android   Source File: WatchMempool.java    License: 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 Project: green_android   Source File: BlockChainTest.java    License: 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 6
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 7
Source Project: GreenBits   Source File: FetchBlock.java    License: 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 8
Source Project: GreenBits   Source File: TestFeeLevel.java    License: 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 9
Source Project: GreenBits   Source File: WatchMempool.java    License: 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 10
Source Project: GreenBits   Source File: BlockChainTest.java    License: 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
@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
@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 13
@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 14
Source Project: bcm-android   Source File: TestWithWallet.java    License: 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);
}
 
Example 15
Source Project: bcm-android   Source File: ChainSplitTest.java    License: 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(UNITTEST, 100, Coin.ZERO, false));
    MemoryBlockStore blockStore = new MemoryBlockStore(UNITTEST);
    wallet = new Wallet(UNITTEST);
    ECKey key1 = wallet.freshReceiveKey();
    ECKey key2 = wallet.freshReceiveKey();
    chain = new BlockChain(UNITTEST, wallet, blockStore);
    coinsTo = LegacyAddress.fromKey(UNITTEST, key1);
    coinsTo2 = LegacyAddress.fromKey(UNITTEST, key2);
    someOtherGuy = LegacyAddress.fromKey(UNITTEST, new ECKey());
}
 
Example 16
Source Project: bcm-android   Source File: ECKeyTest.java    License: 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 17
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 18
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 19
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 20
@Before
public void setUp() throws Exception {
    Protos.ScryptParameters.Builder scryptParametersBuilder = Protos.ScryptParameters.newBuilder()
            .setSalt(ByteString.copyFrom(KeyCrypterScrypt.randomSalt()));
    scryptParameters = scryptParametersBuilder.build();

    BriefLogFormatter.init();
}
 
Example 21
@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 22
@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 23
Source Project: green_android   Source File: TestWithWallet.java    License: 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 24
Source Project: green_android   Source File: ChainSplitTest.java    License: 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 Project: green_android   Source File: ECKeyTest.java    License: 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 26
Source Project: GreenBits   Source File: FetchTransactions.java    License: 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 27
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 28
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 29
@Before
public void setUp() throws Exception {
    Protos.ScryptParameters.Builder scryptParametersBuilder = Protos.ScryptParameters.newBuilder()
            .setSalt(ByteString.copyFrom(KeyCrypterScrypt.randomSalt()));
    scryptParameters = scryptParametersBuilder.build();

    BriefLogFormatter.init();
}
 
Example 30
@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());
}