调用方法流程
- 方法包括方法名,参数 返回值 (Function)
- 对方法进行编码(FunctionEncoder.encode)
- 根据none pirce limit address 方法编码 创建交易信息(RawTransaction.createTransaction)
- 签名交易信息 (TransactionEncoder.signMessage)
- 并转成16进制数据 (Numeric.toHexString)
- 发送交易
- 通过交易原数据和签名拿到hash(TransactionUtils.generateTransactionHashHexEncoded)
Function
public Function(String name, List<Type> inputParameters, List<TypeReference<?>> outputParameters) {
this.name = name;
this.inputParameters = inputParameters;
this.outputParameters = Utils.convert(outputParameters);
}
RawTransaction
protected RawTransaction(BigInteger nonce, BigInteger gasPrice, BigInteger gasLimit, String to, BigInteger value, String data, BigInteger gasPremium, BigInteger feeCap) {
this.nonce = nonce;
this.gasPrice = gasPrice;
this.gasLimit = gasLimit;
this.to = to;
this.value = value;
this.data = data != null ? Numeric.cleanHexPrefix(data) : null;
this.gasPremium = gasPremium;
this.feeCap = feeCap;
}
Credentials
public static Credentials create(ECKeyPair ecKeyPair) {
String address = Numeric.prependHexPrefix(Keys.getAddress(ecKeyPair));
return new Credentials(ecKeyPair, address);
}
signMessage
public static byte[