0

I'm working on Layer 2 so gas/efficiency aren't primary concerns, assuming the function can be executed by the EVM

  • Hmmmm... how about a... string? – goodvibration Sep 23 at 21:42
  • I would zip the article first, but that's typically something you'd do off-chain (i.e., before sending it to the contract). Note that from a certain size, the gas required will exceed the network's block-gas-limit. So compressing your data sounds like the correct thing to do. And of course, even with that, you'd be limited at a certain point, so you'd need to write a function which concatenates, and then pass your data in chunks (i.e., execute the "data upload" in several transactions). – goodvibration Sep 23 at 21:45
1

Saving long strings could be very expensive operation in smart contracts. I see 2 solutions and they both require offchain actions:

  1. Save each article in IPFS and then save the returned hash into blockchain.
  2. Save each article in database and then save the record ID into blockchain.

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.