Post
Share your knowledge.
Deployments on Layer 1
I have learnt to deploy a simple smart contract on a testnet using Remix.
What is the best practice procedure for deplying a DeFi protocol into any layer 1 or 2 network?
Do you use Remix, do you use any CLI or any other alternative? Is any of them safer than the other? and why is chosen that procedure against the other 2?
For example, when the Uniswap team deployed Uniswap code into Ethereum layer 1, how did they deploy the code?
Thanks
- Cyfrin Updraft
- Blockchain
- Smart Contract
Answers
1There are several ways to deploy smart contracts, like a lot. It all depends on an individual's preference. Let's talk about the top 2-3 approaches that most developers like to adopt as far as I am concerned:
-
Hardat - It's a development environment built specifically for Ethereum. One can do various stuff with Smart contracts, like debugging, testing, and deployments. It is simple to use, has its own CLI, and uses Javascript which is quite a common language and is known by almost everyone in the space.
-
Foundry - It's another popular weapon that developers usually prefer for their smart contract development. It got popular recently, because it uses Solidity for everything, which means no need to hop to various languages for the development part, you know Solidity, you got it all. And yes, it comes with CLI too, and could be quite difficult as compared to Hardhat. However, that pain is worth it.
-
Remix (No need to paste its link) - You know Remix, the first tool that we get introduced with. Well, yes it's the easiest one but doing stuff other than deployments could be hard enough. Still, never saw devs using it much for serious development purposes. Even I used it for testing very basic things sometimes, where I need to deploy a contract for testing some of its parts rather than writing a whole script for that.
Along with that, you can find some other tools that have become quite old-fashioned nowadays. I remember when starting at the end of 2023, there were tools like Truffle which I didn't like honestly (just a personal opinion).
There's another tool that I know personally, not known much by others because it's kind of a starter for now, created by a small team and I know the founder (I was one of the first people with whom he shared his idea). It's AnyFlow. This project was actually built to avoid the pain that sticks with developers sometimes during Smart Contract Development. Some of its features are:
- No need to care for testnet tokens
- Amazing UI
- No cli
The only prerequisite of AnyFlow is that your project must be a hardhat project (which gets created using just one single command). Then all you need to do is connect your GitHub, pull up your repo, select the chains, and deploy. I tried it personally, was absolutely good especially when you are low on testnet tokens.
Now let's answer some of your specific questions:
What is the best practice procedure for deploying a DeFi protocol into any layer 1 or 2 network?
Whether it's a DeFi protocol or a bunch of smart contracts linked with each other, the procedure always stays the same most of the time. Test the contract, deploy them, and protect your private keys (try to find a better way rather than storing your keys in a .env
file. Moreover, it's a good practice to keep your developer wallets and the wallets with actual funds separate. Why so? Due to many hacks that have been happening these days and targets are us, we devs. I already faced an attack but got saved somehow (you know the reason), but many aren't always that lucky.
Do you use Remix, do you use any CLI or any other alternative? Is any of them safer than the other? and why is chosen that procedure against the other 2?
I have answered its first part already. Talking about safety, never exactly heard of any breach or vulnerability when it comes to deployment (unless there's a developer fault itself, for example, he mistakenly pushed his private key to Github, etc.). Hence, most of them are safe. Choosing any of them is your personal preference, why not try all and just pick the one you are comfortable with?
For example, when the Uniswap team deployed Uniswap code into Ethereum layer 1, how did they deploy the code?
I don't exactly know what the Uniswap team used to deploy Uniswap, probably can be searched right away through Google or a little bit of digging within various articles, or Uniswap's GitHub itself. Honestly, it doesn't matter much. Once you will exactly know the things around deploying smart contracts, you will probably guess how they have done it (if not exactly). The point to focus on here is, how they wrote and tested it, but that's on you. However, I am definitely sure that they didn't use Remix.
Good Luck!
Do you know the answer?
Please log in and share it.
Cyfrin Updraft is an education platform specializing on teaching the next generation of smart contract developers