tronlink-extension
tronlink-extension copied to clipboard
Failed to deploy smart contract
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:
I've tried both formats (base58 and hex)
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 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
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.
@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
@sullof true. I think the issue is with the injected tronWeb, as it doesn't throw abi or bytecode related exception.
@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.
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.
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"