0

I am trying to deploy contract (available at Etherscan.io ). I proceed following steps: copy its contract creation code and save them in crCode variable. Then i tried to to run following code;

 async function deployWithCreationCode(){

    var myTrx = await web3.eth.sendTransaction({
      from: account1,
      data: crCode 
  });
  console.log(myTrx)
}

Here is my output.

UnhandledPromiseRejectionWarning: Error: Returned error: base fee exceeds gas limit

How to resolve it ?

0

In your crCode variable, after Contract Creation Code, you need to append Constructor Arguments.

Both pieces of byte-code are available to you at the URL which you have linked in your question.

Alternatively, since the Contract Source Code is also available at that link, you can compile it and then deploy it in the "standard way" (using web3.js deploy function).

In fact, this is definitely the recommend way, because the Constructor Arguments given in that link may include addresses of accounts or contracts which are not "yours".

  • but they look like as they might already appended in creation code ... , however, i have done the same as you suggested... but still same error... BTW. when i copy contract creation code , in VS code and assign to crCode, it not showing completely (due to very large string). l means if i press 'end' button of keyboard , i could not see its last char ... i think it existed.. Secondly, if i use alternatively through .deploy (as per my previous question)- if "standard way is not feasible me, then I HOW could i give those arguments... please update your answer. – Amir Ali Nov 21 '19 at 13:51
  • @AmirAli: 1. I recommend that you copy the long creation code into a file, and in your deployment code, read it from the file (instead of embedding into your program). 2. What do you mean by "the standard way is not feasible me"? Please elaborate about what exactly is not feasible, because you generally need to solve that issue rather than looking for other ways. In any case, in order to know what arguments you should pass in the "standard way" (using web3.js deploy function), you should search for the constructor function in the source code, and figure out what's required for construction. – goodvibration Nov 21 '19 at 14:08
  • not feasible for me.. means i have to deploy lot of contract through program, there i could not customize my program to save and assigned constructor parameters for each contract separately. and then deploy. In standard way i know , i to give , arguments, how to compile , how to deploy... ... 2. yes, you are right, sometime, i am not looking other ways.. because current is looking easy for my scenario... .. OK i will try to find which is is better in my case ... thank a lot – Amir Ali Nov 21 '19 at 14:15
  • @AmirAli: Like I said. This method of copying someone else's construction arguments is prone to a miserable failure! Any argument which is an address of an account or a contract, will potentially make the deployed contract unusable for you, if you even manage to deploy it without reverting (due to various checks or calls that the constructor might be making to any of those addresses). So I understand that you're looking for the"short way", but beware that this attempt will likely end for a much longer way than the one that you're trying to avoid. – goodvibration Nov 21 '19 at 14:29
  • thanks, i will follow your suggestion... – Amir Ali Nov 22 '19 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.