Skip to main content
added 76 characters in body
Source Link

This is the contract:

pragma solidity ^0.4.15;

contract Test {
    
    address public owner = msg.sender;
    
    function sendWeis(address _receiver, uint256 _amount) returns (bool) {
        
        _receiver.transfer(_amount);
        return true;

    }
    
    function getBalance(address _owner) constant returns (uint256) {
        
        return _owner.balance;
    }
}

I'm trying to send ether from account A(owner of the contract) to B.

I get this error in solidity browser:

Exception during execution. (invalid opcode). Please debug the transaction for more information.

If I use send() instead of transfer() I don't get any errors, but ethers are not transferred, even though the transaction is executed successfully.

What am ISeems that I'm doing something fundamentally wrong? since it doesn't work either in testrpc or geth. Thanks.

This is the contract:

pragma solidity ^0.4.15;

contract Test {
    
    address public owner = msg.sender;
    
    function sendWeis(address _receiver, uint256 _amount) returns (bool) {
        
        _receiver.transfer(_amount);
        return true;

    }
    
    function getBalance(address _owner) constant returns (uint256) {
        
        return _owner.balance;
    }
}

I'm trying to send ether from account A(owner of the contract) to B.

I get this error in solidity browser:

Exception during execution. (invalid opcode). Please debug the transaction for more information.

If I use send() instead of transfer() I don't get any errors, but ethers are not transferred.

What am I doing wrong? Thanks.

This is the contract:

pragma solidity ^0.4.15;

contract Test {
    
    address public owner = msg.sender;
    
    function sendWeis(address _receiver, uint256 _amount) returns (bool) {
        
        _receiver.transfer(_amount);
        return true;

    }
    
    function getBalance(address _owner) constant returns (uint256) {
        
        return _owner.balance;
    }
}

I'm trying to send ether from account A(owner of the contract) to B.

I get this error in solidity browser:

Exception during execution. (invalid opcode). Please debug the transaction for more information.

If I use send() instead of transfer() I don't get any errors, but ethers are not transferred, even though the transaction is executed successfully.

Seems that I'm doing something fundamentally wrong since it doesn't work either in testrpc or geth. Thanks.

Source Link

Getting Opcode error in remix using transfer method

This is the contract:

pragma solidity ^0.4.15;

contract Test {
    
    address public owner = msg.sender;
    
    function sendWeis(address _receiver, uint256 _amount) returns (bool) {
        
        _receiver.transfer(_amount);
        return true;

    }
    
    function getBalance(address _owner) constant returns (uint256) {
        
        return _owner.balance;
    }
}

I'm trying to send ether from account A(owner of the contract) to B.

I get this error in solidity browser:

Exception during execution. (invalid opcode). Please debug the transaction for more information.

If I use send() instead of transfer() I don't get any errors, but ethers are not transferred.

What am I doing wrong? Thanks.