Contract Address Predicting
whynotmarc opened this issue · 6 comments
Hey there, I will start off by saying sorry for creating an issue in here, but I am unsure where else to go.
I am struggling to find any method of predicting future contract addresses.
Does TronWeb have a method for this, or is there any other way to accomplish this with Tron?
@whynotmarc What are you trying to do ?
Trying to predict a future deployed contract address (the next contract I deploy specifically)
Please using TronWeb latest version or beta version. By using transactionBuilder.createSmartContract()
method, you'll get the future deployed contract address before broadcasting.
Please using TronWeb latest version or beta version. By using
transactionBuilder.createSmartContract()
method, you'll get the future deployed contract address before broadcasting.
Hmm okay, but what if the contract is deployed through another contract.
So calling Contract A's function deployContract
, deploys Contract B.
How would I predict the address of Contract B?
You can use the salt option of solidity. See more here.
You can use the salt option of solidity. See more here.
But if the contract is already live?
To be more specific.
If I am calling this function on Contract A and the contract is already deployed and doesn't have verified code. Meaning I'm unsure if it uses salt to create and what salt is next.
I know the internal logs of the tx returns the address as well as an event emitted.
But the main issue is getting/predicting the address of the contract deployed by Contract A.
Ended up making changes to the client for the best method.