use of com.jd.blockchain.transaction.TxContentBlob in project jdchain-core by blockchain-jd-com.
the class TransactionDecorator method initTxContent.
private TransactionContent initTxContent(TransactionContent txContent) {
TxContentBlob txContentBlob = new TxContentBlob(txContent.getLedgerHash());
txContentBlob.setTime(txContent.getTimestamp());
Operation[] operations = txContent.getOperations();
if (operations != null && operations.length > 0) {
for (Operation op : operations) {
Operation opDecorator = initOperation(op);
if (opDecorator != null) {
txContentBlob.addOperation(opDecorator);
}
}
}
return txContentBlob;
}
use of com.jd.blockchain.transaction.TxContentBlob in project jdchain-core by blockchain-jd-com.
the class LedgerTransactionDataTest method initTransactionContent.
private TransactionContent initTransactionContent() throws Exception {
TxContentBlob contentBlob = null;
BlockchainKeypair id = BlockchainKeyGenerator.getInstance().generate(ClassicAlgorithm.ED25519);
HashDigest ledgerHash = Crypto.getHashFunction("SHA256").hash(UUID.randomUUID().toString().getBytes("UTF-8"));
BlockchainOperationFactory opFactory = new BlockchainOperationFactory();
contentBlob = new TxContentBlob(ledgerHash);
// contentBlob.setSubjectAccount(id.getAddress());
// contentBlob.setSequenceNumber(1);
DataAccountKVSetOperation kvsetOP = opFactory.dataAccount(id.getAddress()).setText("Name", "AAA", -1).getOperation();
contentBlob.addOperation(kvsetOP);
return contentBlob;
}
Aggregations