我想广播一个原始的ETH事务并在web3j中支付它的费用,我使用以下代码来获取事务的十六进制值
EthGetTransactionCount ethGetTransactionCount = web3j.ethGetTransactionCount(credentials.getAddress(), DefaultBlockParameterName.PENDING).send();
BigInteger nonce = ethGetTransactionCount.getTransactionCount();
RawTransaction rawTransaction = RawTransaction.createEtherTransaction(nonce, gasPrice, gasLimit, to, value);
// Sign the Transaction
byte[] signedMessage = TransactionEncoder.signMessage(rawTransaction, credentials);
String hexValue = Numeric.toHexString(signedMessage);
System.out.println(hexValue);我如何用钱包转播并支付十六进制价值的交易费?
发布于 2021-11-10 14:22:19
简单地做这样的事情:
EthSendTransaction result = web3j.ethSendRawTransaction(hexValue).send();
String hash = result.getTransactionHash();https://stackoverflow.com/questions/66205188
复制相似问题