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


Java BriefLogFormatter类代码示例

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


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

示例1: main

import com.google.bitcoin.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.startAndWait();
    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.stop();
}
 
开发者ID:HashEngineering,项目名称:megacoinj,代码行数:22,代码来源:FetchBlock.java

示例2: main

import com.google.bitcoin.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.start();
}
 
开发者ID:HashEngineering,项目名称:megacoinj,代码行数:20,代码来源:WatchMempool.java

示例3: setUp

import com.google.bitcoin.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 = BigInteger.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.addKey(new ECKey());

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

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

示例4: setUp

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

    unitTestParams = UnitTestParams.get();
    Wallet.SendRequest.DEFAULT_FEE_PER_KB = BigInteger.ZERO;
    this.blockStore = blockStore;
    wallet = new Wallet(unitTestParams);
    key = new ECKey();
    address = key.toAddress(unitTestParams);
    wallet.addKey(key);
    blockChain = new BlockChain(unitTestParams, wallet, blockStore);

    startPeerServers();
    if (clientType == ClientType.NIO_CLIENT_MANAGER || clientType == ClientType.BLOCKING_CLIENT_MANAGER)
        channels.startAndWait();

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

示例5: initializeKit

import com.google.bitcoin.utils.BriefLogFormatter; //导入依赖的package包/类
private WalletAppKit initializeKit() {

        BriefLogFormatter.init();

        final NetworkParameters params = getNetworkParameters();
        final String filePrefix = getFilePrefix();

        // Start up a basic app using a class that automates some boilerplate.
        final WalletAppKit tmpKit = new WalletAppKit(params, new File(config.getInstallDirectory()), filePrefix);
        tmpKit.setAutoSave(true);
        tmpKit.setUserAgent("killbill", "1.0");

        if (params == RegTestParams.get()) {
            // Regression test mode is designed for testing and development only, so there's no public network for it.
            // If you pick this mode, you're expected to be running a local "bitcoind -regtest" instance.
            tmpKit.connectToLocalHost();
        }
        return tmpKit;
    }
 
开发者ID:killbill,项目名称:killbill-bitcoin-plugin,代码行数:20,代码来源:BitcoinManager.java

示例6: main

import com.google.bitcoin.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,项目名称:quarkcoinj,代码行数:20,代码来源:WatchMempool.java

示例7: setUp

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

    unitTestParams = UnitTestParams.get();
    Wallet.SendRequest.DEFAULT_FEE_PER_KB = BigInteger.ZERO;
    this.blockStore = blockStore;
    wallet = new Wallet(unitTestParams);
    key = new ECKey();
    address = key.toAddress(unitTestParams);
    wallet.addKey(key);
    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,项目名称:quarkcoinj,代码行数:21,代码来源:TestWithNetworkConnections.java

示例8: main

import com.google.bitcoin.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:testzcrypto,项目名称:animecoinj,代码行数:23,代码来源:FetchBlock.java

示例9: main

import com.google.bitcoin.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.startAndWait();
    peerGroup.addAddress(new PeerAddress(InetAddress.getLocalHost(), params.getPort()));
    peerGroup.waitForPeers(1).get();
    Peer peer = peerGroup.getConnectedPeers().get(0);

    Sha256Hash txHash = new Sha256Hash(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.stopAndWait();
}
 
开发者ID:HashEngineering,项目名称:megacoinj,代码行数:29,代码来源:FetchTransactions.java

示例10: setUp

import com.google.bitcoin.utils.BriefLogFormatter; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    BriefLogFormatter.init();
    params = new UnitTestParams() {
        @Override public int getInterval() {
            return 10000;
        }
    };
}
 
开发者ID:keremhd,项目名称:mintcoinj,代码行数:10,代码来源:AbstractFullPrunedBlockChainTest.java

示例11: setup

import com.google.bitcoin.utils.BriefLogFormatter; //导入依赖的package包/类
@Before
public void setup() throws Exception {
    BriefLogFormatter.init();
    tx1 = TestUtils.createFakeTx(params, Utils.toNanoCoins(1, 0), new ECKey().toAddress(params));
    tx2 = new Transaction(params, tx1.bitcoinSerialize());

    address1 = new PeerAddress(InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
    address2 = new PeerAddress(InetAddress.getByAddress(new byte[] { 127, 0, 0, 2 }));
    address3 = new PeerAddress(InetAddress.getByAddress(new byte[] { 127, 0, 0, 3 }));
}
 
开发者ID:keremhd,项目名称:mintcoinj,代码行数:11,代码来源:MemoryPoolTest.java

示例12: setUp

import com.google.bitcoin.utils.BriefLogFormatter; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    byte[] salt = new byte[KeyCrypterScrypt.SALT_LENGTH];
    new SecureRandom().nextBytes(salt);
    Protos.ScryptParameters.Builder scryptParametersBuilder = Protos.ScryptParameters.newBuilder().setSalt(ByteString.copyFrom(salt));
    scryptParameters = scryptParametersBuilder.build();

    BriefLogFormatter.init();
}
 
开发者ID:HashEngineering,项目名称:megacoinj,代码行数:10,代码来源:KeyCrypterScryptTest.java

示例13: setUp

import com.google.bitcoin.utils.BriefLogFormatter; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    BriefLogFormatter.init();
    Wallet.SendRequest.DEFAULT_FEE_PER_KB = BigInteger.ZERO;
    unitTestParams = UnitTestParams.get();
    wallet = new Wallet(unitTestParams);
    wallet.addKey(new ECKey());
    wallet.addKey(new ECKey());
    blockStore = new MemoryBlockStore(unitTestParams);
    chain = new BlockChain(unitTestParams, wallet, blockStore);
    coinsTo = wallet.getKeys().get(0).toAddress(unitTestParams);
    coinsTo2 = wallet.getKeys().get(1).toAddress(unitTestParams);
    someOtherGuy = new ECKey().toAddress(unitTestParams);
}
 
开发者ID:HashEngineering,项目名称:megacoinj,代码行数:15,代码来源:ChainSplitTest.java

示例14: setUp

import com.google.bitcoin.utils.BriefLogFormatter; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    secureRandom = new SecureRandom();

    byte[] salt = new byte[KeyCrypterScrypt.SALT_LENGTH];
    secureRandom.nextBytes(salt);
    Protos.ScryptParameters.Builder scryptParametersBuilder = Protos.ScryptParameters.newBuilder().setSalt(ByteString.copyFrom(salt));
    ScryptParameters scryptParameters = scryptParametersBuilder.build();
    keyCrypter = new KeyCrypterScrypt(scryptParameters);

    BriefLogFormatter.init();
}
 
开发者ID:HashEngineering,项目名称:megacoinj,代码行数:13,代码来源:ECKeyTest.java

示例15: setUp

import com.google.bitcoin.utils.BriefLogFormatter; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    BriefLogFormatter.initVerbose();
    myWatchedKey = new ECKey();
    myKey = new ECKey();
    myKey.setCreationTimeSeconds(123456789L);
    myAddress = myKey.toAddress(params);
    myWallet = new Wallet(params);
    myWallet.addKey(myKey);
    mScriptCreationTime = new Date().getTime() / 1000 - 1234;
    myWallet.addWatchedAddress(myWatchedKey.toAddress(params), mScriptCreationTime);
    myWallet.setDescription(WALLET_DESCRIPTION);
}
 
开发者ID:HashEngineering,项目名称:megacoinj,代码行数:14,代码来源:WalletProtobufSerializerTest.java


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