尝试发送RPC请求时发生错误
我想签名然后进行sendtracsaction,
var mintMsg = new TransferFunction()
{
TokenAmount = 1,
To = "0x6f78e96E4cDeca2F1e121f23Bc2effBaaea05E8f",
Nonce = 57,
GasPrice = 5,
Gas = 70000
};
var txHandler = web3.Eth.GetContractTransactionHandler<TransferFunction>();
var signedTx = await txHandler.SignTransactionAsync(contractAddress, mintMsg);
// Attempt #1
var txReceipt = await web3.Eth.Transactions.SendRawTransaction.SendRequestAsync(signedTx);
// Attempt #2
TransactionInput transactionInput = new TransactionInput()
{
ChainId = new HexBigInteger(Web3.Convert.ToWei(56, UnitConversion.EthUnit.Wei)),
Gas = new HexBigInteger(Web3.Convert.ToWei(70000, UnitConversion.EthUnit.Wei)),
GasPrice = new HexBigInteger(Web3.Convert.ToWei(5, UnitConversion.EthUnit.Wei)),
Nonce = new HexBigInteger(await GetTransactionCount()),
To = "0x6f78e96E4cDeca2F1e121f23Bc2effBaaea05E8f",
Data = signedTx,
Value = new HexBigInteger(100),
};
var txReceipt2 = await web3.Eth.Transactions.SendTransaction.SendRequestAsync(transactionInput);
这是不起作用的。
I want to SignContract and then SendTracsaction,
var mintMsg = new TransferFunction()
{
TokenAmount = 1,
To = "0x6f78e96E4cDeca2F1e121f23Bc2effBaaea05E8f",
Nonce = 57,
GasPrice = 5,
Gas = 70000
};
var txHandler = web3.Eth.GetContractTransactionHandler<TransferFunction>();
var signedTx = await txHandler.SignTransactionAsync(contractAddress, mintMsg);
// Attempt #1
var txReceipt = await web3.Eth.Transactions.SendRawTransaction.SendRequestAsync(signedTx);
// Attempt #2
TransactionInput transactionInput = new TransactionInput()
{
ChainId = new HexBigInteger(Web3.Convert.ToWei(56, UnitConversion.EthUnit.Wei)),
Gas = new HexBigInteger(Web3.Convert.ToWei(70000, UnitConversion.EthUnit.Wei)),
GasPrice = new HexBigInteger(Web3.Convert.ToWei(5, UnitConversion.EthUnit.Wei)),
Nonce = new HexBigInteger(await GetTransactionCount()),
To = "0x6f78e96E4cDeca2F1e121f23Bc2effBaaea05E8f",
Data = signedTx,
Value = new HexBigInteger(100),
};
var txReceipt2 = await web3.Eth.Transactions.SendTransaction.SendRequestAsync(transactionInput);
This is not working.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也有同样的问题,此代码对我有用
I have the same issue, and this code working for me