Nethereum: Unable to pass BigInteger value to contract as ParamArray

Given a contract as below:

contract testing {
    uint256 storeuint256;
    
    function returnuint256() public view returns (uint256) {
        return storeuint256;
    }
    
    function enteruint256(uint256 _storeuint256) public {
        storeuint256 = _storeuint256;
    }
}

Attempted to pass (2^256) - 1 (115792089237316195423570985008687907853269984665640564039457584007913129553535) with the below code:

Dim SuperBigUint As BigInteger = BigInteger.Parse("115792089237316195423570985008687907853269984665640564039457584007913129639935")
Dim storeSomeStuff = tokencontract.GetFunction("enteruint256")
Dim transactionHash = Await storeSomeStuff.SendTransactionAndWaitForReceiptAsync(account.Address, gas, value, , SuperBigUint)

Error “System.ArgumentOutOfRangeException: 'Number was less than the array’s lower bound in the first dimension.” is thrown. Did a SuperBigUint.ToByteArray and noticed array length was 33.

Works fine on Remix. Current workaround through Nethereum is to sign and send a raw transaction (e.g. data: 0xa3eafc88ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff).

Maybe I am doing something wrong? Thanks in advance. 😃

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 25 (25 by maintainers)

Most upvoted comments

Oh Just to be clear, I was not referring to yours, I was referring to the old one that introduce the bug. It was my fault not checking it further. Yours was great, just changed it on the way with the research.