'm trying to make a simple transaction between two parts (Supplier and Producer). First I make the contract deploy, then I defined the amount (that will be 1) and I make the transaction ->Amount transaction that works . Before I execute the payable function and I change the Remix account, defining 1 ether in the value. Inputs for teh payable function

When I execute the payable function and the appears an error: Transaction error

My code is below and I'm looking for an alternative to finalize the transaction between the two different accountS, any help is very welcome.

pragma solidity ^0.5.0; 

contract supply {

    address payable Supplier;
    address payable Producer;
    uint constant payment_unit = 1 ether;
    uint public price_feature1_wei = 0;
    string public features_product1;
    bool public SellSuplier = true;
    bool public contract_terminated = false;

    constructor () public payable {
        Supplier = msg.sender;
        features_product1 = "product description...";


    function PriceFeature1 (uint amount) public {
        require (SellSuplier == true);
        require (Supplier == msg.sender);
        price_feature1_wei = amount * payment_unit;

    function PurchaseFeature1() public payable {
        require (price_feature1_wei > 0);
        require (msg.value == price_feature1_wei);
        require (SellSuplier == true);
        require (Producer == msg.sender);
        require (Supplier.send(msg.value));
        SellSuplier = false;

1 Answer 1


You didn't set Producer, but checking:

require (Producer == msg.sender);

Obviously Producer not equal to msg.sender. And Solidity reverting it. It is better to using require with error messages like:

require (Producer == msg.sender, "You are not the Producer!");

So you can see where is the error.

  • Ok! When I try again, I see the error "You are not the producer". But how I set the Producer? I want to make this transaction with another account, that would be the Producer.
    – LuCast
    Aug 23, 2021 at 13:20
  • It is totally up to your strategy. But maybe you can take an address as a parameter on PriceFeature and then assign it to Producer. Aug 23, 2021 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.