本文整理汇总了Java中org.hyperledger.common.BID类的典型用法代码示例。如果您正苦于以下问题:Java BID类的具体用法?Java BID怎么用?Java BID使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BID类属于org.hyperledger.common包,在下文中一共展示了BID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BlockRepresentation
import org.hyperledger.common.BID; //导入依赖的package包/类
public BlockRepresentation(BID id,
BID previousID,
int height,
LocalTime localCreateTime,
int nonce,
int version,
Hash merkleRoot,
int difficultyTarget,
List<TID> transactions) {
this.id = id;
this.previousID = previousID;
this.height = height;
this.localCreateTime = localCreateTime;
this.nonce = nonce;
this.version = version;
this.merkleRoot = merkleRoot;
this.difficultyTarget = difficultyTarget;
this.transactions = transactions;
}
示例2: setup
import org.hyperledger.common.BID; //导入依赖的package包/类
@Override
public void setup() throws Exception {
PrivateKey key = PrivateKey.parseWIF("Kxj5wXRXPxVZScsHkK6Dwo2k7enphcW9wWidvZ93wTALHDXjDo2U");
KeyListChain keyChain = new KeyListChain(key);
BaseAccount account = new BaseAccount(keyChain);
api.mine(keyChain.getNextReceiverAddress());
BID topBlockId = api.getBlockIds(null, 1).idList.get(0);
APIBlock topBlock = api.getBlock(topBlockId);
account.sync(api);
Transaction tx = topBlock.getTransaction(0);
txs = new ArrayList<>(getRounds());
for (int j = 0; j < getRounds(); j++) {
System.out.println("Preparing round " + j);
ArrayList<Transaction> txsForOneRound = new ArrayList<>(getCount());
txs.add(txsForOneRound);
for (int i = 0; i < getCount(); i++) {
TransactionFactory tf = new BaseTransactionFactory(account);
tx = tf.propose(key.getAddress(), 5000000000L - BaseTransactionFactory.MINIMUM_FEE).sign(keyChain);
txsForOneRound.add(tx);
}
}
}
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:26,代码来源:SendTransactionThroughputMeasure.java
示例3: TransactionRepresentation
import org.hyperledger.common.BID; //导入依赖的package包/类
public TransactionRepresentation(TID id, BID blockID, int version, List<OutputRepresentation> outputs, List<InputRepresentation> inputs) {
this.id = id;
this.blockID = blockID;
this.version = version;
this.outputs = outputs;
this.inputs = inputs;
}
示例4: init
import org.hyperledger.common.BID; //导入依赖的package包/类
public synchronized void init(BCSAPI api, int trunkLength, List<BID> inventory) throws BCSAPIException {
trunk.clear();
if (inventory != null) {
Collections.copy(trunk, inventory);
}
api.catchUp(trunk, trunkLength, true, this);
APIHeader highest = api.getBlockHeader(trunk.getFirst());
height = highest.getHeight();
api.registerTrunkListener(this);
}
示例5: deserialize
import org.hyperledger.common.BID; //导入依赖的package包/类
@Override
public BID deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
JsonToken t = jp.getCurrentToken();
if (t == JsonToken.VALUE_STRING) {
String hashString = jp.getText().trim();
if (hashString.length() == 0) {
return null;
}
return new BID(hashString);
}
throw ctxt.mappingException(handledType());
}
示例6: checkMerkleRoot
import org.hyperledger.common.BID; //导入依赖的package包/类
private static void checkMerkleRoot(Validator validator) throws HyperLedgerException {
StopWatch.start(0);
Set<BID> violators = validator.checkMerkleRoot();
StopWatch.stop(0);
if (merkleTreeValidationBlockLimit > 0) {
System.out.println("[" + StopWatch.getEllapsedTime(0) + " ms] " + "Merkle tree problem count for the first " + merkleTreeValidationBlockLimit + " blocks: " + violators.size());
} else {
System.out.println("[" + StopWatch.getEllapsedTime(0) + " ms] " + "Merkle tree problem count: " + violators.size());
}
printItems(violators);
}
示例7: checkDifficultyIncrease
import org.hyperledger.common.BID; //导入依赖的package包/类
private static void checkDifficultyIncrease(Validator validator) {
StopWatch.start(0);
Set<BID> headersWithInvalidDifficultyIncrease = validator.checkDifficultyIncrease();
StopWatch.stop(0);
System.out.println("[" + StopWatch.getEllapsedTime(0) + " ms] " + "Header count with invalid difficulty increase: " + headersWithInvalidDifficultyIncrease.size());
printItems(headersWithInvalidDifficultyIncrease);
}
示例8: readHeaders
import org.hyperledger.common.BID; //导入依赖的package包/类
public static Map<BID, StoredHeader> readHeaders(String pathToDataFiles) throws HyperLedgerException {
System.out.println("Creating block store...");
persistentBlocks = new BitcoinPersistentBlocks(new LevelDBStore(pathToDataFiles, 100 * 1048576));
System.out.println(" ...completed");
System.out.println("Starting block store...");
persistentBlocks.start();
System.out.println(" ...completed");
System.out.println("Reading headers...");
Map<BID, StoredHeader> headers = new HashMap<>();
persistentBlocks.readHeaders(headers);
System.out.println(" ...completed");
return headers;
}
示例9: getBlockIdOrInvalidId
import org.hyperledger.common.BID; //导入依赖的package包/类
private BID getBlockIdOrInvalidId(StoredHeader header) {
if (header != null) {
return header.getID();
} else {
return BID.INVALID;
}
}
示例10: latestBlocks
import org.hyperledger.common.BID; //导入依赖的package包/类
@GET
@Path("block/{blockId}")
public BlockRepresentation latestBlocks(@PathParam("blockId") BID blockId) throws BCSAPIException {
return BlockRepresentation.create(api.getBlock(blockId));
}
示例11: BlockIdsRepresentation
import org.hyperledger.common.BID; //导入依赖的package包/类
public BlockIdsRepresentation(List<BID> blockIds, int height, BID previousBlockId) {
this.blockIds = blockIds;
this.height = height;
this.previousBlockId = previousBlockId;
}
示例12: APIBlockIdList
import org.hyperledger.common.BID; //导入依赖的package包/类
public APIBlockIdList(List<BID> idList, int height, BID previousBlockId) {
this.idList = idList;
this.height = height;
this.previousBlockId = previousBlockId;
}
示例13: getBlockHeight
import org.hyperledger.common.BID; //导入依赖的package包/类
/**
* The height of the block, or -1 if we have not seen it
*/
public synchronized int getBlockHeight(BID bid) {
int i = trunk.indexOf(bid);
if (i < 0) return -1;
return height - i;
}
示例14: BIDDeserializer
import org.hyperledger.common.BID; //导入依赖的package包/类
protected BIDDeserializer() {
super(BID.class);
}
示例15: BIDSerializer
import org.hyperledger.common.BID; //导入依赖的package包/类
public BIDSerializer() {
super(BID.class);
}