2

According to this, web3 should contain the function soliditySha3. It can take an object (JSON), serialize it, and use the result as input to Keccak256. According to the documentation, the arguments are ABI converted and tightly packed before being hashed. How do I get this function using Nethereum?

soliditySha3

Will calculate the sha3 of given input parameters in the same way solidity would. This means arguments will be ABI converted and tightly packed before being hashed.

  • 1
    Hi. I tried to get this question to the guy that developed netethereum. He may know the answer and help us. Let´s wait. tks – Luiz Soares Dec 11 '18 at 12:26
3

Using the GitHub master branch of Nethereum (this is not available yet in nuget), you are able to do the following:

Automatically guessing the types, as per web3js.

var abiEncode = new ABIEncode();
var result = abiEncode.GetSha3ABIEncodedPacked(234564535,
                "0xfff23243".HexToByteArray(), true, -10);

Or using specific types:

var result =
                abiEncode.GetSha3ABIEncodedPacked(
                    new ABIValue("string", "Hello!%"), new ABIValue("int8", -23),
                    new ABIValue("address", "0x85F43D8a49eeB85d32Cf465507DD71d507100C1d"));
  • This is excellent. Thank you. Do you have any idea when it will be available in nuget? – Thorkil Værge Dec 12 '18 at 23:06
  • Next week should be out, finishing other things. I am fixing the CI build so you should be able to grab the bits from there too, if you are in a hurry. – Juan Blanco Dec 13 '18 at 9:25

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.