This is the sample smart contract I am trying to run. All methods work, except, "payVendor" - it fails with gas required exceeds allowance or always failing transaction . I have tried increasing the gas, but doesn't help.

contract vendorContract {

    uint public vendorID;
    uint public ownerID;
    uint256 public contractValue;
    string public contractDescription;
    string public contractStatus;
    string public paymentStatus;
    address public contractOwner;
    address public contractVendor;
    string constant newcon = "New";
    string constant wipcon =  "WIP";
    string constant reqcon  = "Requested";
    string constant shipcon = "Shipped";
    string constant endcon = "Completed";
    string constant err = "Error";

    modifier isOwner()
        if (msg.sender != contractOwner) throw;
        _ ;

    modifier isVendor()
        if (msg.sender != contractVendor) throw;
        _ ;

    function vendorContract(uint _vid, string _desc) public {
        vendorID = _vid;
        contractDescription= _desc;


      function acceptContract(uint256 _cvalue, uint _vidd) public {
        if (vendorID !=  _vidd) {
            contractStatus = err;

        contractValue = _cvalue;
        contractVendor = msg.sender;

    function requestPayment() isVendor {

    function paymentStatus() returns (string) {
    return paymentStatus;

    function payVendor() payable isOwner {   
     if  (!contractVendor.send(contractValue))
    contractStatus = endcon;



It seems to work alright for me. There are a few things that may be causing this:

  1. You are sending less ETH than contractValue, and it is throwing because there is not enough ETH in the contract to send.

  2. Be sure you are initializing the contract correctly with the value. Each value you pass in is in WEI.

There are other things to note as suggestions in this contract:

  1. The way you called your constructor is deprecated in favor of the constructor function.

  2. throw is deprecated in favor of revert, require, and assert.

| improve this answer | |
  • 1
    Shane - thank you for your response! I am deploying the contract from Remix Solidity browser. To send ETH to the contract, I tried to enter a non-zero value into the "Value" field, and I get the same error "gas required exceeds...". Help! – Nagen Oct 9 '18 at 13:56
  • 1
    Looks like I had to add "payable" to the constructor - it is working now - thanks for your help. – Nagen Oct 9 '18 at 16:29

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.