I understand web3 can be basically used for every existing task, however, is there anything we can use for C? My C program is communicating with the RPC server using the curl library, by posting JSON data to the server via HTTP. However, the data of a transaction part, currently, I have to get the hex code from somewhere else(web3.js Remix etc.). Is it possible for me to construct the hex code of a function call in C directly without relying on calling a javacript program using system(node ...)? I understand SHA3-256 is used for hashing a function call using the abi information and parameter information, however, the sha3-256 generator that I have used do not produce the same result as web3. Calling system(node ...) is too slow. I want to use C because C is often faster... And my project requirement, it has to be C.
1 Answer
Yes, you can do it without going through javascript. Calling a function in a smart contract is just inputing the correct value in the data
field of your transaction.
Basically, an input is made of the 4 first bytes of the hash of the function's signature and following it, every value of the arguments padded to 32 bytes (if the arguments are of "simple" types).
You can read more here.