0

Can I just change 1 bit of data in a smart contract? More specifically would this allow me to make a smart contract where it is really cheap just to flip specific bits.

This would be like setting header flags in a IP packet. Initially I want to deploy a contact with a set of 1s and 0s then flip some later on. I want to just be-able to flip different bits in a contract that is as cheap as possible.

-Thanks

1

The smallest chunk of state you can update is a 32-byte word. You can create cheaper immutable records using event logs and stateless design. There would be tradeoffs.

Alternatives might exist depending on the use case and constraints.

Hope it helps.

  • 1
    Please note that you can pack bits to words yourself. 256-bit word is the smallest unit you can allocate from EVM storage. – Mikko Ohtamaa Feb 5 at 9:13
  • Exactly. I think the OP wants a way around it. – Rob Hitchens Feb 5 at 15:00

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.