0

I am trying to call a function from my contract using Netherums "SendTransactionAsync", however, it only works when the source is a public key rather than a private key.

I am using Ganache GUI private network to test my contract.

The following is the error that I get when I use a private key

Error: One or more errors occurred. (sender account not recognized: eth_sendTransaction)

This is my C# Code

HexBigInteger gas = new HexBigInteger(new BigInteger(400000));
HexBigInteger value = new HexBigInteger(new BigInteger(0));
myContract.GetFunction("giveFruit").SendTransactionAsync("b6558007a470f0593a35be45926342e92942fa3d7d00fc357c104fcc428f0cee", gas, value, "apple");

The first parameter of the function is the address that is supposed to call this function and the last parameter is an item passed to the contracts function?

The contract is working fine however the code above doesn't work if I use the private key as shown, on the other hand, if I replace the private key with a public key it works just fine. This doesn't make any sense, as you shouldn't be allowed to send transactions using public keys.

Anyone can help me please ? Thanks in advance

0

Your Answer

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

Browse other questions tagged or ask your own question.