tronlink-extension icon indicating copy to clipboard operation
tronlink-extension copied to clipboard

Failed to deploy smart contract

Open gauravsquadx opened this issue 5 years ago • 9 comments

I am trying to deploy a smart contract as follows.

var address = "" //dummy;

var abi = [] // dummy;

var bytecode = "" //dummy;

var contract = tronWeb.contract().new(
      {
        address,
        abi,
        bytecode
      }
    )

It's throwing the following error

Unhandled Promise rejection: Invalid issuer address provided ; Zone: ; Task: Promise.then ; Value: Invalid issuer address provided undefined

gauravsquadx avatar Oct 24 '19 09:10 gauravsquadx

I've tried both formats (base58 and hex)

gauravsquadx avatar Oct 26 '19 03:10 gauravsquadx

I have compiled a smart contract on Remix. Now i want to deploy the contract(abi and bytecode) using Tronlink (version 3.1.0 on chrome) .

What's the proper way of deploying smart contracts ?

I've tried the mentioned method and getting Invalid issuer address provided error

gauravsquadx avatar Oct 29 '19 03:10 gauravsquadx

@gauravsquadx please try to delete address parameter as follows: `var abi = [] // dummy;

var bytecode = "" //dummy;

var contract = tronWeb.contract().new( { abi, bytecode } )` And this is the tronWeb docs link: https://developers.tron.network/reference#tronwebcontractnew

unicornonea avatar Oct 29 '19 06:10 unicornonea

Using Remix to deploy a contract is a big risk because the compilers used by Remix are for Ethereum and they are not compatible with Tron. Use TronIDE (or TronBox) instead.

sullof avatar Oct 29 '19 22:10 sullof

@summertanh It still gives the same error even after removing the address property.

Invalid issuer address error is thrown when you don't provide private key while instantiating tronWeb and try to deploy the bytecode.

But tronLink injects the tronWeb object. Could you try to deploy any contract using tronLink

gauravsquadx avatar Oct 30 '19 06:10 gauravsquadx

@sullof true. I think the issue is with the injected tronWeb, as it doesn't throw abi or bytecode related exception.

gauravsquadx avatar Oct 30 '19 06:10 gauravsquadx

@gauravsquadx , Please use TRON solidity compiler to compile and deploy smart contracts. Just as sullof said, Ethereum's solidity compilers are not compatible with TRON.

If u want to deploy contract with tronlink, please use this repo (https://github.com/tronprotocol/solidity) to compile ur solidity contracts.

BlueHoopor avatar Nov 04 '19 09:11 BlueHoopor

Hi @gauravsquadx,

I was having the same problem I fixed it by using the tronWeb.transactionBuilder.createSmartContract function as the TronLink extention doesn't pass the privateKey into the browser (to avoid leaking it) the signing needs to be approved by the user this function will trigger the request.

Example:

const abi = {Your abi.json}
const bytecode = {Your bytecode.json}

const transaction = await tronWeb.transactionBuilder.createSmartContract({
      abi: abi,
      bytecode: bytecode,
      feeLimit: 1e9,
      callValue: 0, 
      userFeePercentage: 30,
      originEnergyLimit: 1e7,
      parameters: ['<param1>', '<param2>']
    }, tronWeb.defaultAddress.hex);

const signedTransaction = await tronWeb.trx.sign(transaction);
const contract_instance = await tronWeb.trx.sendRawTransaction(signedTransaction); 

I hope this helps.

shaneBen23 avatar Dec 05 '20 10:12 shaneBen23

Hi @gauravsquadx,

I was having the same problem I fixed it by using the tronWeb.transactionBuilder.createSmartContract function as the TronLink extention doesn't pass the privateKey into the browser (to avoid leaking it) the signing needs to be approved by the user this function will trigger the request.

Example:

const abi = {Your abi.json}
const bytecode = {Your bytecode.json}

const transaction = await tronWeb.transactionBuilder.createSmartContract({
      abi: abi,
      bytecode: bytecode,
      feeLimit: 1e9,
      callValue: 0, 
      userFeePercentage: 30,
      originEnergyLimit: 1e7,
      parameters: ['<param1>', '<param2>']
    }, tronWeb.defaultAddress.hex);

const signedTransaction = await tronWeb.trx.sign(transaction);
const contract_instance = await tronWeb.trx.sendRawTransaction(signedTransaction); 

I hope this helps.

hey bro,may i ask how to get the bytecode of the contract,i've tried to copy the bytecode fron the tron-ide,but it shows error of "Uncaught (in promise) Invalid bytecode provided"

Francisundermoon avatar Dec 20 '22 14:12 Francisundermoon