1

I am aware that a solidity library function marked as external will be deployed separately and called with delegatecall from the calling contract. Whereas a function marked as internal will just be inlined into the calling contract with no need to deploy the library separately. What happens if it is marked public?

2 Answers 2

0

public and external behave the same as each other in solidity library. you could the bytecode of two contracts that the only difference are one is used public another one is used external visibility in the library function. or even you could check the gas cost of each one by a function call, the result is the same. i mean the gas costs don't have any differences.

Note: i didn't find any official documents which is related to this comparison, by testing and experimenting, i got these results.

Please vote up if it helps you :)

0

In your "callling contract" you can have internal/public/external, In the case that are internal, only other functions inside the contract can call them. If they are public or external can also be called externally, this is how your users interact with the contract. Hope it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.