I got a program that's already working.
Try
' Get the nonce for the sender address
Dim nonce = Await HelperNethereum.Polygon.Web3.Eth.Transactions.GetTransactionCount.SendRequestAsync(fromAddress)
' Convert the amount to Wei
Dim valueInWei = Web3.Convert.ToWei(amountToSend)
Dim gasPrice = Await HelperNethereum.Polygon.asyncGetGasPrice
Dim signer = New Nethereum.Signer.LegacyTransactionSigner()
Dim signedTransaction = signer.SignTransaction(
privateKey,
137,
toAddress,
valueInWei,
nonce.Value,
gasPrice,
New HexBigInteger(21000)
)
Dim jsonPayload = New With {
.jsonrpc = "2.0",
.method = "eth_sendRawTransaction",
.params = New String() {"0x" + signedTransaction},
.id = 1
}
' Serialize the payload to JSON
Dim jsonContent = JsonConvert.SerializeObject(jsonPayload)
Dim jsonresult = Await CookieAwareWebClient.downloadString1Async("https://polygon-rpc.com", jsonContent)
Now, it's a test program. I used it to get to know nethereum.
Now After I got signedTransaction, I want to test if signedTransaction is legit.
How do I do so?
ChatGPT keeps giving conflicting answer suggesting using functions that no longer work.
Even Juan Blanco's own answer no longer work
https://ethereum.stackexchange.com/questions/3823/how-can-i-sign-a-transaction-using-c
For example, as far as I know, method web3.OfflineTransactionSigning.GetSenderAddress(encoded);
doesn't work anymore because such functions do not exist.
[link] [comments]
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments