How to choose the SPDX license of your smart contract in Solidity

In this tutorial, we are going to learn how to choose which SPDX license to use in your Solidity smart contract and we're going to see the options you have an how it works.

In this tutorial, we are going to learn how to choose which SPDX license to use in your Solidity smart contract and we're going to see the options you have an how it works.

At the top of your smart contract, it is recommended that you specify the license that the smart contract's code uses.

That way, you protect yourself against people who want to steal your code (if you don't want to share it). It also gives confidence to people who copy your code to know that they are not doing something illegal (if you accept to share it).

More importantly, in the crypto world, people will trust you if the code of your smart contract is visible and free.

The licenses you can use are the licenses of an international standard called SPDX (Software Package Data Exchange). To see the full list of licenses available, you can go to their website here:

SPDX License List | Software Package Data Exchange (SPDX)

To specify the version in your smart contract, you simply add a comment at the top saying which license you want to use. You need to put the abbreviation of the license:

// SPDX-License-Identifier: MIT

MIT is the most popular license in smart contracts because that license says that the code is visible and can be replicated and used by anybody and that it gives no warranty of any kind to people who use this code.

You can also use // SPDX-License-Identifier: UNLICENSED for non-open-source code or use any other license that protects your code.

And that's it 🎉

Thank you for reading this article