尝试发送rpc请求时发生错误:eth_sendRawTransaction



我想要SignContract然后sendtransaction,

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);

这个不能用

我有同样的问题,这段代码为我工作

var privateKey = _user.PrivateKey;
var account = new Account(privateKey);
var web3 = new Web3(account, "https://bsc-dataseed.binance.org/");