Search in sources :

Example 1 with DataAccountKVSetOperation

use of com.jd.blockchain.ledger.DataAccountKVSetOperation 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;
}
Also used : DataAccountKVSetOperation(com.jd.blockchain.ledger.DataAccountKVSetOperation) TxContentBlob(com.jd.blockchain.transaction.TxContentBlob) HashDigest(com.jd.blockchain.crypto.HashDigest) BlockchainKeypair(com.jd.blockchain.ledger.BlockchainKeypair) BlockchainOperationFactory(com.jd.blockchain.transaction.BlockchainOperationFactory)

Aggregations

HashDigest (com.jd.blockchain.crypto.HashDigest)1 BlockchainKeypair (com.jd.blockchain.ledger.BlockchainKeypair)1 DataAccountKVSetOperation (com.jd.blockchain.ledger.DataAccountKVSetOperation)1 BlockchainOperationFactory (com.jd.blockchain.transaction.BlockchainOperationFactory)1 TxContentBlob (com.jd.blockchain.transaction.TxContentBlob)1