当前位置: 首页>>代码示例>>Java>>正文


Java BriefLogFormatter类代码示例

本文整理汇总了Java中org.bitcoinj.utils.BriefLogFormatter的典型用法代码示例。如果您正苦于以下问题:Java BriefLogFormatter类的具体用法?Java BriefLogFormatter怎么用?Java BriefLogFormatter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BriefLogFormatter类属于org.bitcoinj.utils包,在下文中一共展示了BriefLogFormatter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startDownload

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
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();
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:19,代码来源:BlockChain.java

示例2: Bitcoin

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
private Bitcoin() {
    BriefLogFormatter.initWithSilentBitcoinJ();
    ch.qos.logback.classic.Logger rootLogger = (ch.qos.logback.classic.Logger)LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
    rootLogger.setLevel(Level.toLevel("info"));

    // Context.enableStrictMode();
    final NetworkParameters params = TestNet3Params.get();
    context = new Context(params);
    Context.propagate(context);

    // read system property to check if broken wallet shall be recovered from backup automatically
    automaticallyRecoverBrokenWallet = System.getProperty("automaticallyRecoverBrokenWallet").equalsIgnoreCase("true");

    // prepare (unused) random seed to save time when constructing coupon wallets for invoices
    byte[] seed = new byte[DeterministicSeed.DEFAULT_SEED_ENTROPY_BITS/8];
    List<String> mnemonic = new ArrayList<>(0);
    couponRandomSeed = new DeterministicSeed(seed, mnemonic, MnemonicCode.BIP39_STANDARDISATION_TIME_SECS);
}
 
开发者ID:IUNO-TDM,项目名称:PaymentService,代码行数:19,代码来源:Bitcoin.java

示例3: setUp

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
public void setUp(BlockStore blockStore) throws Exception {
    BriefLogFormatter.init();
    Context.propagate(new Context(PARAMS, 100, Coin.ZERO, false));
    this.blockStore = blockStore;
    // Allow subclasses to override the wallet object with their own.
    if (wallet == null) {
        wallet = new Wallet(PARAMS);
        key = wallet.freshReceiveKey();
        address = key.toAddress(PARAMS);
    }
    blockChain = new BlockChain(PARAMS, wallet, blockStore);

    startPeerServers();
    if (clientType == ClientType.NIO_CLIENT_MANAGER || clientType == ClientType.BLOCKING_CLIENT_MANAGER) {
        channels.startAsync();
        channels.awaitRunning();
    }

    socketAddress = new InetSocketAddress("127.0.0.1", 1111);
}
 
开发者ID:Grant-Redmond,项目名称:cryptwallet,代码行数:21,代码来源:TestWithNetworkConnections.java

示例4: setUp

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
@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);
}
 
开发者ID:Grant-Redmond,项目名称:cryptwallet,代码行数:25,代码来源:BlockChainTest.java

示例5: setUp

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    BriefLogFormatter.initVerbose();
    Context ctx = new Context(PARAMS);
    myWatchedKey = new ECKey();
    myWallet = new Wallet(PARAMS);
    myKey = new ECKey();
    myKey.setCreationTimeSeconds(123456789L);
    myWallet.importKey(myKey);
    myAddress = myKey.toAddress(PARAMS);
    myWallet = new Wallet(PARAMS);
    myWallet.importKey(myKey);
    mScriptCreationTime = new Date().getTime() / 1000 - 1234;
    myWallet.addWatchedAddress(myWatchedKey.toAddress(PARAMS), mScriptCreationTime);
    myWallet.setDescription(WALLET_DESCRIPTION);
}
 
开发者ID:Grant-Redmond,项目名称:cryptwallet,代码行数:17,代码来源:WalletProtobufSerializerTest.java

示例6: main

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
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.startAsync();
    peerGroup.awaitRunning();
    PeerAddress addr = new PeerAddress(InetAddress.getLocalHost(), params.getPort());
    peerGroup.addAddress(addr);
    peerGroup.waitForPeers(1).get();
    Peer peer = peerGroup.getConnectedPeers().get(0);

    Sha256Hash blockHash = new Sha256Hash(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();
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:23,代码来源:FetchBlock.java

示例7: main

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    BriefLogFormatter.init();
    if (args.length == 0) {
        System.err.println("Specify the fee level to test in satoshis as the first argument.");
        return;
    }

    Coin feeToTest = Coin.valueOf(Long.parseLong(args[0]));

    kit = new WalletAppKit(PARAMS, new File("."), "testfeelevel");
    kit.startAsync();
    kit.awaitRunning();
    try {
        go(feeToTest);
    } finally {
        kit.stopAsync();
        kit.awaitTerminated();
    }
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:20,代码来源:TestFeeLevel.java

示例8: main

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
public static void main(String[] args) {
    BriefLogFormatter.init();
    NetworkParameters params = MainNetParams.get();
    PeerGroup peerGroup = new PeerGroup(params);
    peerGroup.addPeerDiscovery(new DnsDiscovery(params));
    peerGroup.addEventListener(new AbstractPeerEventListener() {
        @Override
        public void onTransaction(Peer peer, Transaction tx) {
            try {
                if (tx.getOutputs().size() != 1) return;
                if (!tx.getOutput(0).getScriptPubKey().isSentToRawPubKey()) return;
                log.info("Saw raw pay to pubkey {}", tx);
            } catch (ScriptException e) {
                e.printStackTrace();
            }
        }
    });
    peerGroup.startAsync();
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:20,代码来源:WatchMempool.java

示例9: setUp

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
public void setUp(BlockStore blockStore) throws Exception {
    BriefLogFormatter.init();

    unitTestParams = UnitTestParams.get();
    Wallet.SendRequest.DEFAULT_FEE_PER_KB = Coin.ZERO;
    this.blockStore = blockStore;
    // Allow subclasses to override the wallet object with their own.
    if (wallet == null)
        wallet = new Wallet(unitTestParams);
    key = wallet.freshReceiveKey();
    address = key.toAddress(unitTestParams);
    blockChain = new BlockChain(unitTestParams, wallet, blockStore);

    startPeerServers();
    if (clientType == ClientType.NIO_CLIENT_MANAGER || clientType == ClientType.BLOCKING_CLIENT_MANAGER) {
        channels.startAsync();
        channels.awaitRunning();
    }

    socketAddress = new InetSocketAddress("127.0.0.1", 1111);
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:22,代码来源:TestWithNetworkConnections.java

示例10: setUp

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    BriefLogFormatter.initVerbose();
    testNetChain = new BlockChain(testNet, new Wallet(testNet), new MemoryBlockStore(testNet));
    Wallet.SendRequest.DEFAULT_FEE_PER_KB = Coin.ZERO;

    unitTestParams = UnitTestParams.get();
    wallet = new Wallet(unitTestParams) {
        @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 (tx.isCoinBase()) {
                BlockChainTest.this.coinbaseTransaction = tx;
            }
        }
    };
    wallet.freshReceiveKey();

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

    coinbaseTo = wallet.currentReceiveKey().toAddress(unitTestParams);
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:26,代码来源:BlockChainTest.java

示例11: main

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
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(InetAddress.getLocalHost(), params.getPort());
    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();
}
 
开发者ID:HashEngineering,项目名称:dashj,代码行数:22,代码来源:FetchBlock.java

示例12: main

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    BriefLogFormatter.initWithSilentBitcoinJ();
    if (args.length == 0) {
        System.err.println("Specify the fee level to test in satoshis as the first argument.");
        return;
    }

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

    kit = new WalletAppKit(PARAMS, new File("."), "testfeelevel");
    kit.startAsync();
    kit.awaitRunning();
    try {
        go(feeToTest, NUM_OUTPUTS);
    } finally {
        kit.stopAsync();
        kit.awaitTerminated();
    }
}
 
开发者ID:HashEngineering,项目名称:dashj,代码行数:21,代码来源:TestFeeLevel.java

示例13: main

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
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();
    }
}
 
开发者ID:HashEngineering,项目名称:dashj,代码行数:24,代码来源:WatchMempool.java

示例14: setUp

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
@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);
    Context.get().initDash(false, true);
}
 
开发者ID:HashEngineering,项目名称:dashj,代码行数:26,代码来源:BlockChainTest.java

示例15: main

import org.bitcoinj.utils.BriefLogFormatter; //导入依赖的package包/类
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();
    }
}
 
开发者ID:bitcoinj,项目名称:bitcoinj,代码行数:21,代码来源:TestFeeLevel.java


注:本文中的org.bitcoinj.utils.BriefLogFormatter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。