> {
@Override
diff --git a/core/src/main/java/com/cryptape/cita/protocol/core/methods/response/AppTransaction.java b/core/src/main/java/com/cryptape/cita/protocol/core/methods/response/AppTransaction.java
index 6da8856a..91e24df2 100644
--- a/core/src/main/java/com/cryptape/cita/protocol/core/methods/response/AppTransaction.java
+++ b/core/src/main/java/com/cryptape/cita/protocol/core/methods/response/AppTransaction.java
@@ -1,49 +1,11 @@
package com.cryptape.cita.protocol.core.methods.response;
-import java.io.IOException;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.ObjectReader;
-
-import com.cryptape.cita.protocol.ObjectMapperFactory;
import com.cryptape.cita.protocol.core.Response;
-/**
- * Transaction object returned by:
- *
- * - eth_getTransactionByHash
- * - eth_getTransactionByBlockHashAndIndex
- * - eth_getTransactionByBlockNumberAndIndex
- *
- *
- * This differs slightly from the request {@link AppSendTransaction} Transaction object.
- *
- * See
- * docs
- * for further details.
- */
public class AppTransaction extends Response {
public Transaction getTransaction() {
return getResult();
}
- public static class ResponseDeserialiser extends JsonDeserializer {
-
- private ObjectReader objectReader = ObjectMapperFactory.getObjectReader();
-
- @Override
- public Transaction deserialize(
- JsonParser jsonParser,
- DeserializationContext deserializationContext) throws IOException {
- if (jsonParser.getCurrentToken() != JsonToken.VALUE_NULL) {
- return objectReader.readValue(jsonParser, Transaction.class);
- } else {
- return null; // null is wrapped by Optional in above getter
- }
- }
- }
}
diff --git a/core/src/test/java/com/cryptape/cita/protocol/core/ResponseTest.java b/core/src/test/java/com/cryptape/cita/protocol/core/ResponseTest.java
index 9a28a353..212bcbe2 100644
--- a/core/src/test/java/com/cryptape/cita/protocol/core/ResponseTest.java
+++ b/core/src/test/java/com/cryptape/cita/protocol/core/ResponseTest.java
@@ -250,110 +250,6 @@ public void testEthCall() {
assertThat(appCall.getValue(), is("0x"));
}
- @Test
- public void testEthBlockTransactionHashes() {
- //CHECKSTYLE:OFF
- buildResponse(
- "{\n"
- + "\"jsonrpc\":\"2.0\",\n"
- + "\"id\":1,\n"
- + "\"result\":{\n"
- + " \"version\":0,"
- + " \"hash\":\"0xda9e8497221e9d18131292f8b459d62e03c882be4666d084c67b8dcebcce91d1\",\n"
- + " \"header\":{\n"
- + " \"timestamp\":1533101297835,\n"
- + " \"prevHash\":\"0x4391078f4c03c028178e8f1a9f25392a634b098d7737601f1679a8b197fafcf9\","
- + " \"number\":\"0x3ff59\","
- + " \"stateRoot\":\"0x60fb67e5ca3868d292ea44e2c28bb16d83d25793ed629b28f4c8d18de8742a72\","
- + " \"transactionsRoot\":\"0x62d54aa5b82a5813c87a3a4d1d2c3a02e6c88f037c8fb2461e5116e7a9dc2149\","
- + " \"receiptsRoot\":\"0x918334ef71e85bed370065d1f2758d1eb3f089f7e5323a78a633de7a5f07f371\","
- + " \"gasUsed\":\"0x132bd\","
- + " \"proof\":"
- + " {\"Bft\":{"
- + " \"proposal\":\"0xe1b9bba13cb64a920c04f3abc2ea0a98d2db4fb65d233df3afc31c5321bb6054\","
- + " \"height\":261976,"
- + " \"round\":0,"
- + " \"commits\":{"
- + " \"0x486bb688c8d29056bd7f87c26733048b0a6abda6\":\"0x0fc60edaff5f00329e088750119e92af8940e9612d1dbf3ce4158e721faaff592ab43f4bc3c24718631aa4140f8412cefb9086416ba2c280fa85ec83b511ed5f00\","
- + " \"0x31042d4f7662cddf8ded5229db3c5e7302875e10\":\"0x68e3701cec53f96e792ecb02eb390dad074eb26b0d5472be8804929e016cc99d647b9c40e30942270f1fed91f3fc14479c47de603a5de99735b3122b5d08e2c601\","
- + " \"0xee01b9ba97671e8a1891e85b206b499f106822a1\":\"0x34272376d15b8e0658efa8cce056f59d5054b5863a9945c5e8e232c65f2d434476833899912a871e58374c08da78e8279dc02c877221f6a880134ed050bae44700\","
- + " \"0x71b028e49c6f41aaa74932d703c707ecca6d732e\":\"0x7ed41b1ccf137a77eade8bbd4e348534dc26c45c7d8a547adc7286746497f6bf3587f886c87e97dbfadd8e2698827c53123a3fbfddb682c887509342ae030dec01\""
- + " }"
- + " }"
- + " },"
- + " \"proposer\":\"0xee01b9ba97671e8a1891e85b206b499f106822a1\""
- + " },"
- + " \"body\":{"
- + " \"transactions\":["
- + " {"
- + " \"hash\":\"0xab64a7be5f38ab8061419472402c52c9a26f5989b26da5eec4d59d7aa68348e1\","
- + " \"content\":\"0x0aad010a2839663864396337633336616632336561656230323032363938333135656163323334653334373039120f65333031643366313762346566393518c0843d20a6ff0f2a44a9059cbb000000000000000000000000bac68e5cb986ead0253e0632da1131a0a96efa1800000000000000000000000000000000000000000000000000000000000003e83220000000000000000000000000000000000000000000000000000000000000000038011241e1e76fe6f033db9527f0714ba81b4af1f26b9d70210acbf3cebcb916c2f4c7ae70c3fe80a2032d748caa0b90b70159263880ea6b230912f5bb5c62b234ed67a401\""
- + " },"
- + " {"
- + " \"hash\":\"0xcd7fc94a452d78b0041abac36de489c19432d3c208e795099ac13a6327bb4bd8\","
- + " \"content\":\"0x0aad010a2839663864396337633336616632336561656230323032363938333135656163323334653334373039120f65316239383236653737326132306518c0843d20a7ff0f2a44a9059cbb000000000000000000000000bac68e5cb986ead0253e0632da1131a0a96efa1800000000000000000000000000000000000000000000000000000000000003e83220000000000000000000000000000000000000000000000000000000000000000038011241d5c91c9e262c57fd79d6979f8b9205d7d49ed8918edaf8eb8b8e3bf5447b7d6745e57ebcb741486064758c0058750569c4e6a759de293563e9fa156172abcc3500\""
- + " }"
- + " ]"
- + " }"
- + " }"
- + "}");
-
-
- AppBlock.TendermintCommit[] tendermintCommits = {
- new AppBlock.TendermintCommit(
- "0x486bb688c8d29056bd7f87c26733048b0a6abda6",
- "0x0fc60edaff5f00329e088750119e92af8940e9612d1dbf3ce4158e721faaff592ab43f4bc3c24718631aa4140f8412cefb9086416ba2c280fa85ec83b511ed5f00"),
- new AppBlock.TendermintCommit(
- "0x31042d4f7662cddf8ded5229db3c5e7302875e10",
- "0x68e3701cec53f96e792ecb02eb390dad074eb26b0d5472be8804929e016cc99d647b9c40e30942270f1fed91f3fc14479c47de603a5de99735b3122b5d08e2c601"),
- new AppBlock.TendermintCommit(
- "0xee01b9ba97671e8a1891e85b206b499f106822a1",
- "0x34272376d15b8e0658efa8cce056f59d5054b5863a9945c5e8e232c65f2d434476833899912a871e58374c08da78e8279dc02c877221f6a880134ed050bae44700"),
- new AppBlock.TendermintCommit(
- "0x71b028e49c6f41aaa74932d703c707ecca6d732e",
- "0x7ed41b1ccf137a77eade8bbd4e348534dc26c45c7d8a547adc7286746497f6bf3587f886c87e97dbfadd8e2698827c53123a3fbfddb682c887509342ae030dec01"),
- };
- AppBlock.Tendermint tendermint = new AppBlock.Tendermint(
- "0xe1b9bba13cb64a920c04f3abc2ea0a98d2db4fb65d233df3afc31c5321bb6054",
- "261976", "0",tendermintCommits);
-
- AppBlock.Header header = new AppBlock.Header(
- 1533101297835L,
- "0x4391078f4c03c028178e8f1a9f25392a634b098d7737601f1679a8b197fafcf9",
- "0x3ff59",
- "0x60fb67e5ca3868d292ea44e2c28bb16d83d25793ed629b28f4c8d18de8742a72",
- "0x62d54aa5b82a5813c87a3a4d1d2c3a02e6c88f037c8fb2461e5116e7a9dc2149",
- "0x918334ef71e85bed370065d1f2758d1eb3f089f7e5323a78a633de7a5f07f371",
- "0x132bd",
- new AppBlock.Proof(tendermint),
- "0xee01b9ba97671e8a1891e85b206b499f106822a1"
- );
-
- List transactionObjects = new ArrayList<>();
- AppBlock.TransactionObject txObj1 = new AppBlock.TransactionObject();
- txObj1.setHash("0xab64a7be5f38ab8061419472402c52c9a26f5989b26da5eec4d59d7aa68348e1");
- txObj1.setContent("0x0aad010a2839663864396337633336616632336561656230323032363938333135656163323334653334373039120f65333031643366313762346566393518c0843d20a6ff0f2a44a9059cbb000000000000000000000000bac68e5cb986ead0253e0632da1131a0a96efa1800000000000000000000000000000000000000000000000000000000000003e83220000000000000000000000000000000000000000000000000000000000000000038011241e1e76fe6f033db9527f0714ba81b4af1f26b9d70210acbf3cebcb916c2f4c7ae70c3fe80a2032d748caa0b90b70159263880ea6b230912f5bb5c62b234ed67a401");
-
- AppBlock.TransactionObject txObj2 = new AppBlock.TransactionObject();
- txObj2.setHash("0xcd7fc94a452d78b0041abac36de489c19432d3c208e795099ac13a6327bb4bd8");
- txObj2.setContent("0x0aad010a2839663864396337633336616632336561656230323032363938333135656163323334653334373039120f65316239383236653737326132306518c0843d20a7ff0f2a44a9059cbb000000000000000000000000bac68e5cb986ead0253e0632da1131a0a96efa1800000000000000000000000000000000000000000000000000000000000003e83220000000000000000000000000000000000000000000000000000000000000000038011241d5c91c9e262c57fd79d6979f8b9205d7d49ed8918edaf8eb8b8e3bf5447b7d6745e57ebcb741486064758c0058750569c4e6a759de293563e9fa156172abcc3500");
-
- transactionObjects.add(txObj1);
- transactionObjects.add(txObj2);
- AppBlock.Body body = new AppBlock.Body(transactionObjects);
-
- String version = "0";
- String hash = "0xda9e8497221e9d18131292f8b459d62e03c882be4666d084c67b8dcebcce91d1";
- AppBlock.Block block = new AppBlock.Block(
- version,
- hash,
- header,
- body
- );
- //CHECKSTYLE:ON
- AppBlock appBlock = deserialiseResponse(AppBlock.class);
- assertThat(appBlock.getBlock(), equalTo(block));
- }
@Ignore //no support for parity
@Test
@@ -423,8 +319,7 @@ public void testEthBlockFullTransactionsParity() {
assertThat(appBlock.getBlock(), equalTo(block));
}
- // Remove once Geth & Parity return the same v value in transactions
- @Ignore //no support for geth
+ @Ignore
@Test
public void testEthBlockFullTransactionsGeth() {
//CHECKSTYLE:OFF
diff --git a/tests/src/main/java/com/cryptape/cita/tests/InterfaceTest.java b/tests/src/main/java/com/cryptape/cita/tests/InterfaceTest.java
index f69279ba..71862668 100644
--- a/tests/src/main/java/com/cryptape/cita/tests/InterfaceTest.java
+++ b/tests/src/main/java/com/cryptape/cita/tests/InterfaceTest.java
@@ -1,15 +1,14 @@
package com.cryptape.cita.tests;
+import java.io.IOException;
import java.math.BigInteger;
import java.util.Arrays;
-import java.util.Collections;
import com.cryptape.cita.abi.FunctionEncoder;
import com.cryptape.cita.abi.TypeReference;
import com.cryptape.cita.abi.datatypes.Address;
import com.cryptape.cita.abi.datatypes.Function;
import com.cryptape.cita.abi.datatypes.Uint;
-import com.cryptape.cita.abi.datatypes.generated.Uint256;
import com.cryptape.cita.crypto.Credentials;
import com.cryptape.cita.protocol.CITAj;
import com.cryptape.cita.protocol.core.DefaultBlockParameter;
@@ -30,6 +29,7 @@
import com.cryptape.cita.protocol.core.methods.response.AppTransaction;
import com.cryptape.cita.protocol.core.methods.response.NetPeerCount;
import com.cryptape.cita.protocol.core.methods.response.TransactionReceipt;
+import com.google.gson.Gson;
public class InterfaceTest {
@@ -39,7 +39,6 @@ public class InterfaceTest {
private static String value;
private static String privateKey;
private static long quotaToDeploy;
- private static String validTransactionHash;
private static Transaction.CryptoTx cryptoTx;
@@ -57,47 +56,24 @@ public class InterfaceTest {
public static void main(String[] args) throws Exception {
+ testGetBlockByNumber(BigInteger.valueOf(1));
- System.out.println("======================================");
- System.out.println("*** 0. getbalance ***");
testGetBalance();
- System.out.println("======================================");
- System.out.println("*** 1. getMetaData ***");
testMetaData();
- System.out.println("======================================");
- System.out.println("*** 2. net_peerCount ***");
testNetPeerCount();
- System.out.println("======================================");
- System.out.println("*** 3. blockNumber ***");
BigInteger validBlockNumber = testBlockNumber();
- System.out.println(validBlockNumber);
- System.out.println(validBlockNumber.toString(16));
- System.out.println(DefaultBlockParameter.valueOf(validBlockNumber).getValue());
+ System.out.println(validBlockNumber.toString(10));
- System.out.println("======================================");
- System.out.println("*** 4. getBlockByNumber ***");
- boolean returnFullTransactions = true;
String blockByNumberHash = testAppGetBlockByNumber(
- validBlockNumber, returnFullTransactions);
- String blockHash = "";
- if (blockByNumberHash != null) {
- blockHash = blockByNumberHash;
- } else {
- System.out.println("Failed to get block by number: " + validBlockNumber);
- System.exit(1);
- }
+ validBlockNumber, true);
- System.out.println("======================================");
- System.out.println("*** 5. getBlockByHash ***");
- testAppGetBlockByHash(blockHash, returnFullTransactions);
+ testAppGetBlockByHash(blockByNumberHash, true);
//because unsigned transaction is not supported in cita, there is no method sendTransaction.
- System.out.println("======================================");
- System.out.println("*** 6. sendRawTransaction ***");
String code = "6060604052341561000f57600080fd5b600160a060020"
+ "a033316600090815260208190526040902061271090556101"
+ "df8061003b6000396000f3006060604052600436106100565"
@@ -127,33 +103,20 @@ public static void main(String[] args) throws Exception {
Transaction rtx = Transaction.createContractTransaction(
nonce, quotaToDeploy, validUtil.longValue(),
version, chainId, value, code);
- String signedTx = rtx.sign(privateKey, cryptoTx, false);
- String optionTxHash = testAppSendRawTransaction(signedTx);
-
- if (optionTxHash != null) {
- validTransactionHash = optionTxHash;
- } else {
- System.out.println("Failed to get deployment tx hash, maybe it failed to be validated");
- System.exit(1);
- }
+ String signedTransaction = rtx.sign(privateKey, cryptoTx, false);
+ String transactionHash = testAppSendRawTransaction(signedTransaction);
System.out.println("waiting for tx into chain ...");
Thread.sleep(8000);
- System.out.println("======================================");
- System.out.println("*** 7. getTransactionByHash ***");
- testAppGetTransactionByHash(validTransactionHash);
+ testAppGetTransactionByHash(transactionHash);
- System.out.println("======================================");
- System.out.println("*** 8. getTransactionCount ***");
Credentials credentials = Credentials.create(privateKey);
String validAccount = credentials.getAddress();
testAppGetTransactionCount(validAccount, DefaultBlockParameterName.PENDING);
- System.out.println("======================================");
- System.out.println("*** 9. getTransactionReceipt ***");
String validContractAddress = "";
- String contractAddr = testAppGetTransactionReceipt(validTransactionHash);
+ String contractAddr = testAppGetTransactionReceipt(transactionHash);
if (contractAddr != null) {
validContractAddress = contractAddr;
} else {
@@ -161,26 +124,26 @@ public static void main(String[] args) throws Exception {
System.exit(1);
}
- System.out.println("======================================");
- System.out.println("*** 10. getCode ***");
testAppGetCode(validContractAddress, DefaultBlockParameterName.PENDING);
- System.out.println("======================================");
- System.out.println("*** 11. appCall ***");
- String fromAddr = Credentials.create(privateKey).getAddress();
+ String fromAddress = Credentials.create(privateKey).getAddress();
Function getBalanceFunc = new Function(
"getBalance",
- Arrays.asList(new Address(fromAddr)),
+ Arrays.asList(new Address(fromAddress)),
Arrays.asList(new TypeReference() {
})
);
String funcCallData = FunctionEncoder.encode(getBalanceFunc);
- testAppCall(fromAddr, validContractAddress, funcCallData, DefaultBlockParameterName.PENDING);
+ testAppCall(fromAddress, validContractAddress, funcCallData, DefaultBlockParameterName.PENDING);
}
- //0. getBalance
+ private static void testGetBlockByNumber(BigInteger number) throws IOException {
+ AppBlock.Block block = service.appGetBlockByNumber(DefaultBlockParameter.valueOf(number), true).send().getBlock();
+ System.out.println("block " + number.toString() + " is: " + new Gson().toJson(block));
+ }
+
private static void testGetBalance() throws Exception {
Credentials c = Credentials.create(privateKey);
String addr = c.getAddress();
@@ -190,54 +153,20 @@ private static void testGetBalance() throws Exception {
System.out.println("the result is null");
} else {
BigInteger balance = appGetbalance.getBalance();
- System.out.println("Balance for addr " + addr + "is " + balance);
+ System.out.println("Balance for address " + addr + "is " + balance);
}
}
- //1. getMetaData
private static void testMetaData() throws Exception {
AppMetaData appMetaData = service.appMetaData(DefaultBlockParameterName.PENDING).send();
- if (appMetaData == null) {
- System.out.println("the result is null");
- } else {
- System.out.println("Version: "
- + appMetaData.getAppMetaDataResult().getVersion());
- version = appMetaData.getAppMetaDataResult().getVersion();
- System.out.println("TokenName: "
- + appMetaData.getAppMetaDataResult().getTokenName());
- System.out.println("TokenSymbol: "
- + appMetaData.getAppMetaDataResult().getTokenSymbol());
- System.out.println("TokenAvator: "
- + appMetaData.getAppMetaDataResult().getTokenAvatar());
- System.out.println("ChainName: "
- + appMetaData.getAppMetaDataResult().getChainName());
- System.out.println("Genesis TS: "
- + appMetaData.getAppMetaDataResult().getGenesisTimestamp());
- System.out.println("Operator: "
- + appMetaData.getAppMetaDataResult().getOperator());
- System.out.println("Website: "
- + appMetaData.getAppMetaDataResult().getWebsite());
- System.out.println("Block Interval: "
- + appMetaData.getAppMetaDataResult().getBlockInterval());
- System.out.println("Chain Id: "
- + appMetaData.getAppMetaDataResult().getChainId());
- System.out.println("Validators: ");
- Arrays.asList(appMetaData.getAppMetaDataResult().getValidators())
- .forEach(x -> System.out.println("Address: " + x.toString()));
- System.out.println("Economical Model: "
- + appMetaData.getAppMetaDataResult().getEconomicalModel());
- System.out.println("Chain Id V1: "
- + appMetaData.getAppMetaDataResult().getChainIdV1());
- }
+ System.out.println("AppMetaData: " + new Gson().toJson(appMetaData));
}
- //1. net_peerCount
private static void testNetPeerCount() throws Exception {
NetPeerCount netPeerCount = service.netPeerCount().send();
System.out.println("net_peerCount:" + netPeerCount.getQuantity());
}
- //2. blockNumber
private static BigInteger testBlockNumber() throws Exception {
AppBlockNumber appBlockNumber = service.appBlockNumber().send();
@@ -253,7 +182,6 @@ private static BigInteger testBlockNumber() throws Exception {
return validBlockNumber;
}
- //3. getBlockByNumber
private static String testAppGetBlockByNumber(
BigInteger validBlockNumber, boolean isfullTranobj)
throws Exception {
@@ -265,12 +193,11 @@ private static String testAppGetBlockByNumber(
return null;
} else {
AppBlock.Block block = appBlock.getBlock();
- printBlock(block);
+ System.out.println("Block: " + new Gson().toJson(block));
return block.getHash();
}
}
- //4. cita_getBlockByHash
private static void testAppGetBlockByHash(
String validBlockHash, boolean isfullTran)
throws Exception {
@@ -281,12 +208,11 @@ private static void testAppGetBlockByHash(
System.out.println("the result is null");
} else {
AppBlock.Block block = appBlock.getBlock();
- printBlock(block);
+ System.out.println("Block: " + new Gson().toJson(block));
}
}
- //5. sendRawTransaction
private static String testAppSendRawTransaction(
String rawData) throws Exception {
AppSendTransaction appSendTx = service
@@ -305,7 +231,6 @@ private static String testAppSendRawTransaction(
}
- //6. getTransactionByHash
private static void testAppGetTransactionByHash(
String validTransactionHash) throws Exception {
AppTransaction appTransaction = service.appGetTransactionByHash(
@@ -316,16 +241,11 @@ private static void testAppGetTransactionByHash(
} else {
com.cryptape.cita.protocol.core.methods.response.Transaction transaction
= appTransaction.getTransaction();
- System.out.println("hash(Transaction):" + transaction.getHash());
- System.out.println("content:" + transaction.getContent());
- System.out.println("blockNumber(dec):" + transaction.getBlockNumber());
- System.out.println("blockHash:" + transaction.getBlockHash());
- System.out.println("index:" + transaction.getIndex());
+ System.out.println("Transaction: " + new Gson().toJson(transaction));
}
}
- //7. getTransactionCount
private static void testAppGetTransactionCount(
String validAccount, DefaultBlockParameter param) throws Exception {
AppGetTransactionCount appGetTransactionCount = service.appGetTransactionCount(
@@ -339,7 +259,6 @@ private static void testAppGetTransactionCount(
}
}
- //8. getTransactionReceipt
private static String testAppGetTransactionReceipt(
String validTransactionHash) throws Exception {
AppGetTransactionReceipt appGetTransactionReceipt = service.appGetTransactionReceipt(
@@ -376,7 +295,6 @@ private static void printTransactionReceiptInfo(
}
}
- //9. eth_getCode
private static void testAppGetCode(
String validContractAddress, DefaultBlockParameter param)
throws Exception {
@@ -386,71 +304,19 @@ private static void testAppGetCode(
if (appGetCode.isEmpty()) {
System.out.println("the result is null");
} else {
- System.out.println("contractcode:" + appGetCode.getCode());
+ System.out.println("contract code:" + appGetCode.getCode());
}
}
- public Function totalSupply() {
- return new Function(
- "get",
- Collections.emptyList(),
- Collections.singletonList(new TypeReference() {
- }));
- }
-
- //10. call
private static void testAppCall(
- String fromaddress, String contractAddress, String encodedFunction,
+ String fromAddress, String contractAddress, String encodedFunction,
DefaultBlockParameter param) throws Exception {
AppCall appCall = service.appCall(
- new Call(fromaddress, contractAddress, encodedFunction),
+ new Call(fromAddress, contractAddress, encodedFunction),
param).send();
System.out.println("call result:" + appCall.getValue());
}
- private static void printBlock(AppBlock.Block block) {
- System.out.println("hash(blockhash):"
- + block.getHash());
- System.out.println("version:"
- + block.getVersion());
- System.out.println("header.timestamp:"
- + block.getHeader().getTimestamp());
- System.out.println("header.prevHash:"
- + block.getHeader().getPrevHash());
- System.out.println("header.number(hex):"
- + block.getHeader().getNumber());
- System.out.println("header.number(dec):"
- + block.getHeader().getNumberDec());
- System.out.println("header.stateRoot:"
- + block.getHeader().getStateRoot());
- System.out.println("header.transactionsRoot:"
- + block.getHeader().getTransactionsRoot());
- System.out.println("header.receiptsRoot:"
- + block.getHeader().getReceiptsRoot());
- System.out.println("header.gasUsed:"
- + block.getHeader().getGasUsed());
- System.out.println("header.proof.proposal:"
- + block.getHeader().getProof().getTendermint().getProposal());
- System.out.println("header.proof.height:"
- + block.getHeader().getProof().getTendermint().getHeight());
- System.out.println("header.proof.round:"
- + block.getHeader().getProof().getTendermint().getRound());
-
- if (!block.getBody().getTransactions().isEmpty()) {
- System.out.println("number of transaction:"
- + block.getBody().getTransactions().size());
-
- for (int i = 0; i < block.getBody().getTransactions().size(); i++) {
- com.cryptape.cita.protocol.core.methods.response.Transaction tx =
- (com.cryptape.cita.protocol.core.methods.response.Transaction)
- block.getBody().getTransactions().get(i).get();
- System.out.println("body.transactions.tranhash:" + tx.getHash());
- System.out.println("body.transactions.content:" + tx.getContent());
- }
- } else {
- System.out.println("the block transactions is null");
- }
- }
}