Hey buddy love your videos, I'm having trouble connecting my contract to the front end using Tron link on the Tron blockchain, can you make a video on a Tron Dapp?
Hey, slight confusion there. You said there are creation and runtime bytecode, but then what type of bytecode we are returning from getByteCode function,
Sorry, if you get a bit cringe in seeing this question haha. But I have 2 really burning questions (Since Im super new to Solidity) 1. Why would we ever need to compute an address before even deploy? Like if the deploy process is gonna happen for sure, couldnt we get the address after deploy or something? 2. I for all these months thought deploying a smart contract was as easy as ‘new TestContract(address, foo)’, and getting its address. So what exactly is the difference between the new keyword and this complicated version? But overall, I thoroughly understood it thanks to your explanation. Its just that, I was curious about these 2 questions :)
That's a good question Useful cases to know the contract address in advance * contract requires the same unique address given constructor inputs. For example Uniswap pair contract. You don't want to have multiple contracts, for an pair of tokens, like DAI / ETH. * situation where contract can be deployed at any time, but isn't. Example: resolving a dispute between parties. If there is no dispute, no need to ever deploy the contract.
@@smartcontractprogrammer Ahhh, I see. So essentially, if a Uniswap Pair of ETH/DAI is already present, but not knowing the address of it, then this would be super useful eh? Wow. Never thought in that perspective. Also, could you please help me understand my 2nd doubt?
While demo When you are deploying the byte code and salt then it should supposed to be the whole byte code and not only creation code ? In normal contract deployment the whole bytecode is deployed Correct?
I dont get what the salt is ? Also if I independently deploy a contract through Remix, will I simply input the value of nonce for my next transaction as salt ?
hi man! great vids as always. I've been learning for a while. can you make a tutorial on metaTxs using GSN, i am unable to find simple resources for that. You're explanation is best! looking forward!
nice, so we know at what address our contract is going to be deployed to. but is there a way we can deploy at a specific address then? I see some protocols have their protocols deployed at unique addresses, and also I think uniswap deploys pair addresses at pre-determined address, can you shed some light on that sir!
In theory unique address of your choice can be computed. Loop through the salt (0 to 2^256 -1) until the desired create2 address is obtained Uniswap pair addresses are determined by the address of the pairs (example DAI, ETH pair is determined by address of DAI + WETH)
Code - 0:56
Contract bytecode 1:52
How to compute contract address for create2 3:05
Deploy with create2 4:46
Remix demo 7:04
How to get in touch with you
Hey buddy love your videos, I'm having trouble connecting my contract to the front end using Tron link on the Tron blockchain, can you make a video on a Tron Dapp?
Tron is centralized?
You're the best solidity resource on the internet! Thank you for what you do :)
i love you man, you really putting great efforts into this, arigato gozaymasti
Great video! May i ask what are the 0x94, 0xd6 and 0x80 hex codes representing?
very nice solidity videos..thanks a lot.
Awesome video! Can you create a video on how to deploy to other chains using the same contract address? ropsten, rinkeby, polygon, bsc. Thanks!
Hey, slight confusion there. You said there are creation and runtime bytecode, but then what type of bytecode we are returning from getByteCode function,
I believe it us returning only creation code
Sorry, if you get a bit cringe in seeing this question haha. But I have 2 really burning questions (Since Im super new to Solidity)
1. Why would we ever need to compute an address before even deploy? Like if the deploy process is gonna happen for sure, couldnt we get the address after deploy or something?
2. I for all these months thought deploying a smart contract was as easy as ‘new TestContract(address, foo)’, and getting its address.
So what exactly is the difference between the new keyword and this complicated version?
But overall, I thoroughly understood it thanks to your explanation. Its just that, I was curious about these 2 questions :)
That's a good question
Useful cases to know the contract address in advance
* contract requires the same unique address given constructor inputs. For example Uniswap pair contract.
You don't want to have multiple contracts, for an pair of tokens, like DAI / ETH.
* situation where contract can be deployed at any time, but isn't. Example: resolving a dispute between parties. If there is no dispute, no need to ever deploy the contract.
@@smartcontractprogrammer Ahhh, I see. So essentially, if a Uniswap Pair of ETH/DAI is already present, but not knowing the address of it, then this would be super useful eh? Wow. Never thought in that perspective. Also, could you please help me understand my 2nd doubt?
2. Use new if you don't need to know the address before deploy. Use create2 if you need to know the address before the contract is deployed.
@@smartcontractprogrammer awesomeeee. Thank you so much brother :) Much appreciated
While demo When you are deploying the byte code and salt then it should supposed to be the whole byte code and not only creation code ?
In normal contract deployment the whole bytecode is deployed Correct?
creation code is the whole bytecode
code from constructor + runtime code = creation code
both create (normal) and create2 deploy the runtime code
Is salt basically the nonce ?
I dont get what the salt is ? Also if I independently deploy a contract through Remix, will I simply input the value of nonce for my next transaction as salt ?
hi man! great vids as always. I've been learning for a while. can you make a tutorial on metaTxs using GSN, i am unable to find simple resources for that. You're explanation is best! looking forward!
Maybe later. I haven't had the opportunity to use it
nice, so we know at what address our contract is going to be deployed to. but is there a way we can deploy at a specific address then? I see some protocols have their protocols deployed at unique addresses, and also I think uniswap deploys pair addresses at pre-determined address, can you shed some light on that sir!
In theory unique address of your choice can be computed.
Loop through the salt (0 to 2^256 -1) until the desired create2 address is obtained
Uniswap pair addresses are determined by the address of the pairs (example DAI, ETH pair is determined by address of DAI + WETH)
@@smartcontractprogrammer I see thanks!
Awesome, thanks!
awesome videio ! Thanks 😍
Super !!
💙
@smart contract programer how to get in touch with you
contact@smartcontractprogrammer.com