0

I am trying to send an array of object (tuple) to smart contract.

function addManyUsers (User [] memory _users) public {

        for (uint i = 0; i < _users.length; i++) {

           bytes32 hash = keccak256(abi.encode(_users[i].name));
           users[hash] = _users[i];

        }
    }

I have web3js v1.0.0-beta.37, I tried with websocket provider:

I got this error:

Error: CONNECTION ERROR: Couldn't connect to node on WS.

Then I tried with http provider, I got this error:

Error: Returned error: oversized data

I think there a data size limit, but can we upgrade that limit?

0

Indeed there is a data size limit. you can check it in geth code https://github.com/ethereum/go-ethereum/blob/master/rpc/http.go

you'll find :

const (
    maxRequestContentLength = 1024 * 512
    contentType             = "application/json"
)

I think to rise it and recompile or better in https://github.com/ethereum/go-ethereum/blob/master/core/tx_pool.go try to rise the transaction size

if tx.Size() > 32*1024 {
    return ErrOversizedData
}
  • is this the best solution ?, there no way to solve the problem without changing the code source ? – maroodb Jul 9 at 11:22
  • 1
    @maroodb AFAIK this is the only way (suitable for private chains) as this measure intends to protect the network against Dos attakcs – Badr Bellaj Jul 9 at 11:41

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.