本文整理汇总了Java中org.bitcoinj.utils.BriefLogFormatter.init方法的典型用法代码示例。如果您正苦于以下问题:Java BriefLogFormatter.init方法的具体用法?Java BriefLogFormatter.init怎么用?Java BriefLogFormatter.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bitcoinj.utils.BriefLogFormatter
的用法示例。
在下文中一共展示了BriefLogFormatter.init方法的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();
}
示例2: 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);
}
示例3: 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);
}
示例4: 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();
}
示例5: 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();
}
示例6: 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();
}
}
示例7: 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();
}
示例8: 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();
}
}
示例9: main
import org.bitcoinj.utils.BriefLogFormatter; //导入方法依赖的package包/类
/** Main method.
* @param args Argument stating "testnet" will use Bitcoin Test network. */
public static void main(String[] args) {
BriefLogFormatter.init(); // Sets logging format, default for now
ignoreSELF4JErrors();
if (args.length > 0 && args[0].equals("testnet"))
Utils.setTestNetwork(CustomKit.TESTNET);
File tmpFile = new File(Utils.getSystemPath());
if(!tmpFile.exists())
tmpFile.mkdirs();
new LoginGUI();
}
示例10: setUp
import org.bitcoinj.utils.BriefLogFormatter; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
Protos.ScryptParameters.Builder scryptParametersBuilder = Protos.ScryptParameters.newBuilder()
.setSalt(ByteString.copyFrom(KeyCrypterScrypt.randomSalt()));
scryptParameters = scryptParametersBuilder.build();
BriefLogFormatter.init();
}
示例11: setup
import org.bitcoinj.utils.BriefLogFormatter; //导入方法依赖的package包/类
@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());
}
示例12: setup
import org.bitcoinj.utils.BriefLogFormatter; //导入方法依赖的package包/类
@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);
}
示例13: setUp
import org.bitcoinj.utils.BriefLogFormatter; //导入方法依赖的package包/类
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);
}
示例14: setUp
import org.bitcoinj.utils.BriefLogFormatter; //导入方法依赖的package包/类
@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);
}
示例15: setUp
import org.bitcoinj.utils.BriefLogFormatter; //导入方法依赖的package包/类
@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();
}