web3j GasUsed GasPrice Transaction Input

web3j  GasUsed  GasPrice Transaction Input
1 Star2 Stars3 Stars4 Stars5 Stars 給文章打分!
Loading...
//        EthGetTransactionReceipt send = Web3JClient.getWeb3j().ethGetTransactionReceipt(txhash).send();
//        EthTransaction send1 = Web3JClient.getWeb3j().ethGetTransactionByHash(txhash).send();
//        BigInteger transactionReceipt = send1.getTransaction().get().getGasPrice();
//        BigInteger gasUsed = send.getTransactionReceipt().get().getGasUsed();
 public void parseInput(){
String inputData = "0xa9059cbb0000000000000000000000006a2972e43f38f0b8217c119394d9b5a4cd116e9c000000000000000000000000000000000000000000000001bc16d674ec800000";
String method = inputData.substring(0,10);
String to = inputData.substring(10,74);
String value = inputData.substring(74);
Method refMethod = null;
try {
refMethod = TypeDecoder.class.getDeclaredMethod("decode",String.class,int.class,Class.class);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
refMethod.setAccessible(true);
Address address = null;
try {
address = (Address)refMethod.invoke(null,to,0,Address.class);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
Uint256 amount = null;
try {
amount = (Uint256) refMethod.invoke(null,value,0,Uint256.class);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
System.out.println("method=" method "\nto=" to "\nvalue=" value "\naddress=" address.getValue() "\namount=" amount.getValue());
}

相關文章

程式語言 最新文章