4

I deploy a smart contract and it shows this error after I see it is created on testnet:

Warning! Error encountered during contract execution [Bad instruction] 

When I go to contract code tab, it is empty and just has a 0x there.

Almost like contract created but not completely.

Here is the transaction that created the contract:

https://testnet.etherscan.io/tx/0xaf1adfc8a995068e0f8eb02ad5fa4582244997e4d8b8284165bd18937d6371b9

Here is the constructor piece of the contract:

pragma solidity ^0.4.8;

contract RouteCoin {

    string public parentContracts;

    address private buyer;   

    address private seller;

    uint private contractStartTime;

    address private finalDestination;  

    uint private contractGracePeriod;

    function RouteCoin(address _finalDestination, uint _contractGracePeriod, string _parentContracts) {
        buyer = msg.sender;
        contractStartTime = now;        
        finalDestination = _finalDestination;
        contractGracePeriod = _contractGracePeriod;
        parentContracts = _parentContracts;
    }

Also when I use the Ethereum wallet i get this error: enter image description here

No data is deployed on the contract address!

And when i go to Etherscan i see this:

Warning! Error encountered during contract execution [Bad jump destination] 

https://testnet.etherscan.io/tx/0xadd8d2807cc9405ef317f664d86195464afcd62471dc890c9de69ac3a122f31d

Any ideas?

enter image description here

  • Possible to post your contract code? Likely either constructor error or insufficient gas. – Rob Hitchens - B9lab Feb 23 '17 at 19:05
  • @RobHitchens updated the question with the top section of the contract – Aram Feb 23 '17 at 19:09
  • Contract is valid. I would focus on the deployment method. There are multiple ways to do it, so hard to be specific. Recently, people have been having issues like this and they are getting good results by updating their wallets and/or Geth. For example, here: ethereum.stackexchange.com/questions/12386/… – Rob Hitchens - B9lab Feb 23 '17 at 19:26
  • Thanks @RobHitchens .Yeah, I'm using Nethereum (.net) to deploy. and when I update the Geth version to latest it doesn't deploy at all. Also getting a different error trying to deploy with ethereum wallet 0.8.9 win 64. – Aram Feb 23 '17 at 19:35
  • @RobHitchens I get that "No data is deployed on this contract address" from the link you sent when using Ethereum wallet – Aram Feb 23 '17 at 19:40
1

So with the help of @RobHitchens, turns out now after sol 4.x, if i want to send Ethers to a contract at the time of creating the contract, I should put payable to the constructor method (Just like any normal functions in the contract that transfers ethers)

So changed the contract constructor to look like this and works fine now:

function RouteCoin(address _finalDestination, uint _contractGracePeriod) 
payable
{
    buyer = msg.sender;
    contractStartTime = now;        
    finalDestination = _finalDestination;
    contractGracePeriod = _contractGracePeriod;
}

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.