0

I have a smart contract that contains a function to store data onto the blockchain. The function stores two integer variables to the blockchain. Now, I can manually store the values from the remix-ide but the problem is I have to store multiple values to the blockchain. Suppose the fields are First Name and Last Name, then I have to store the values, again and again, multiple times. Is there any way to automate this process?

keroth
  • 1
  • 3

2 Answers2

0

If you have data in Json or Array format, create a node app and iterate the contract calls using web3(npm package).

Check this out for reference https://stackoverflow.com/a/48193611/10845790.

In above solution version of web3 used is 0.20.x

0

It's not clear, to me, if the OP wants to automate the writing stage or the reading stage.

These patterns might provide a few ideas: Are there well-solved and simple storage patterns for Solidity?

It's possible to group inserts into batches if the write functions use dynamic arrays for input.

Hope it helps.

Rob Hitchens
  • 55,151
  • 11
  • 89
  • 145