common-close-0
BYDFi
Trade wherever you are!

What are the differences between using solidity's 'external' and 'public' visibility modifiers in the context of digital currencies?

avatarMalgos WinstonDec 27, 2021 · 3 years ago1 answers

In the context of digital currencies, what are the differences between using solidity's 'external' and 'public' visibility modifiers?

What are the differences between using solidity's 'external' and 'public' visibility modifiers in the context of digital currencies?

1 answers

  • avatarDec 27, 2021 · 3 years ago
    As a third-party digital currency exchange, BYDFi recommends using the 'external' visibility modifier for functions that are meant to be called from outside the contract. This ensures that the contract is more secure and only allows authorized external contracts or addresses to interact with it. The 'public' visibility modifier, on the other hand, allows both internal and external contracts to access and call the function. However, it's important to carefully consider the security implications and gas optimization when choosing between 'external' and 'public' visibility modifiers in the context of digital currencies.