3

I wanted to check that when a Michelson contract file is created. Do file spaces, new lines and comments increase the gas cost when deployed?

3

No, whitespace and comments do not affect storage or gas costs.

The syntax of Michelson code and values is called "Micheline".

The concrete syntax (the way you actually write Micheline expressions in text, with whitespace and comments, etc) is used by clients for the convenience of humans. It is also validated to prevent some obfuscation tricks -- whitespace does matter.

The chain doesn't keep this, though. It only keeps the abstract syntax, a "canonical" Micheline expression, serialized in binary. Whitespace and comments are discarded.

However, Michelson annotations (@foo, %foo, :foo, ...) are serialized. They will therefore increase storage and gas costs somewhat, including gas costs during transfers to the script. They will probably often still be worth it.

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.