Smart contract developers can optimize their gas usage by limiting storage use, using events instead of storage, packing variables, using constants and immutable variables, and minimizing direct access to storage variables.
Single-line swaps, loops, and unnecessary computation should be eliminated, and efficient algorithms should be used instead. Compressible datum structures and bitmaps can help reduce the amount of data that needs to be stored.
Zk-SNARKs can also be used to compute onchain, while avoiding the need to store a lot of data.
















