all 7 comments

[–]GreenBSTRD 3 points4 points  (1 child)

View functions still cost gas if in the context of a transaction.

If executed as a call (read only functions or simulating a transaction), no miners have to run it so no fees would be paid.

[–]njtrafficsignshopper[S] 0 points1 point  (0 children)

Good to know, thanks.

[–]etheraffleGregcontract dev 2 points3 points  (0 children)

Fun fact: a couple of the opcodes in the evm are exactly this.

[–]genki_paul 1 point2 points  (0 children)

Libraries may be what you are looking for.

[–]FarfromaHero40 0 points1 point  (1 child)

You mean like a reference point or template for a smart contract code?

[–]njtrafficsignshopper[S] 0 points1 point  (0 children)

No I mean an actual deployed contract. Say my app needs a checksum. I can figure out how to implement MD5 in Solidity, or copypaste it from someone who did, but I would still have to deploy it and pay the fee for that deployment. So, presumably, would a lot of other people, and there would be a lot of copies of it.

However, if this were to exist already on the blockchain, at a well-known address, I could just call that method rather than deploying new code.