1

My IoT device connects to another computer via Wi-Fi on which Ethereum (Truffle/Ganache) is running which receive a RPC from the IoT.
My task is to create raw transaction data on this IoT Device, so that I can use the eth_sendRawTransaction function (https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendrawtransaction) via RPC. I have to create this raw transaction data in C# language.

But for creating this raw transaction data, I have to create ECDSA privat key, public key, derive address from public key, create the transaction (including: nonce, gasPrice, gasLimit, to, value, data), encode this data (RLP), hash the encoded data and last but nor least sign the hashed data with ECDSA private key. So in short --> How to create and sign a transaction locally using Go, just in C# ^^

There are exist a library ethereumjs-tx or web3 where I easy execute but ethereumjs-tx is for JavaScript and web3 don't exist for C#. Is there a similar library for C#?

Or do I have to look at the exact function of the individual functions (in https://github.com/ethereum/go-ethereum or rather https://github.com/ethereumjs/ethereumjs-tx) and translate this manual in C#?

I found this https://goethereumbook.org/transaction-raw-create/ but everything is in GO.^^

Thanks a lot for your help/advice :)

0

I think you could do what you need without building a raw transaction by yourself.

Take a look at Nethereum and the Getting Started page.

You can connect to a local node with something like
var web3 = new Web3("http://localhost:8545").
You would replace this with your node's IP and port.

And here is how to send a transaction using Nethereum, to the node that you previously connected (this would be your IoT device's node).

  • 1
    Thanks for your fast answer :) I found this: github.com/Nethereum/Nethereum So I can just download it and integrate it as a library in my C# code? That would make it much easier^^ – Steve Martin May 27 at 22:55
  • Yes, that is correct. If you found the answer useful consider marking it as the accepted answer :) – Carlos Fuentes May 27 at 23:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.