Curently minimal transaction cost is around 0.1$. And it's VERY high for most of IoT applications, where service price is less than 0,1$.

Is there any solutions, works, startups anything about it?

  • 1
    A minimum transaction would be 21,000 gas, and looking at ethgasstation.info/minerTable.php currently you could get down to 0.5 Gwei gas price and still have your transaction confirmed relatively quickly. That's 10,500 Gwei or 0.0000105 ether. With ether at ~$300 each, that's $0.00315 transaction cost (less than a third of a penny). If you're paying $0.10 per transaction, you either have a gas-guzzling function, or are paying too much for gas. Jun 29, 2017 at 13:51

1 Answer 1


You want payment channels or state channels in general (payment channel is a type of state channel).

Payment channels

A payment channel works like in roughly three phases (see this post for more details/context):

  1. Open a new channel with a sender and a recipient

    function OpenChannel(address token, address to, uint amount) {
      if (amount == 0) { throw; }
      if (to == msg.sender) { throw; }
      if (active_ids[msg.sender][to] != bytes32(0)) { throw; }
      bytes32 id = sha3(msg.sender, to, now);
      Channel memory _channel;
      _channel.deposit = amount;
      _channel.sender = msg.sender;
      _channel.recipient = to;
      _channel.token = token;
      ERC20 t = ERC20(token);
      if (!t.transferFrom(msg.sender, address(this), amount)) { throw; }
      channels[id] = _channel;
      active_ids[msg.sender][to] = id;
  2. Sign messages from sender to recipient. These messages contain a value, which can be verifiably sent to the recipient at any time.

    var sha3 = require('solidity-sha3').default;
    var _value = 0.01*Math.pow(10, 18)    
    var value = _value.toString(16)    
    let _msg_hash = sha3(`0x${channel_id}`, _value);    
    let msg_hash = Buffer.from(_msg_hash.substr(2, 64), 'hex');     
    let sig = util.ecsign(msg_hash, keys.test.privateKey);    
    let parsed_sig = {      
      v: sig.v.toString(16),      
      r: sig.r.toString('hex'),      
      s: sig.s.toString('hex')    
    latest_value = value;    
    latest_sig = parsed_sig;    
    latest_msg_hash = msg_hash.toString('hex')
  3. Close the channel. This is a transaction that takes one of the above signed messages and plays it on chain. This will transfer that messages funds to the recipient and delete the channel.

    function CloseChannel(bytes32[4] h, uint8 v, uint256 value) {
      // h[0]    Channel id
      // h[1]    Hash of (id, value)
      // h[2]    r of signature
      // h[3]    s of signature
      // Grab the channel in question
      if (channels[h[0]].deposit == 0) { throw; }
      Channel memory _channel;
      _channel = channels[h[0]];
      if (msg.sender != _channel.sender && msg.sender != _channel.recipient) { throw; }
      address signer = ecrecover(h[1], v, h[2], h[3]);
      if (signer != _channel.sender) { throw; }
      // Make sure the hash provided is of the channel id and the amount sent
      bytes32 proof = sha3(h[0], value);
      // Ensure the proof matches, send the value, send the remainder, and delete the channel
      if (proof != h[1]) { throw; }
      else if (value > _channel.deposit) { throw; }
      // Pay recipient and refund sender the remainder
      ERC20 t = ERC20(_channel.token);
      if (!t.transfer(_channel.recipient, value)) { throw; }
      else if (!t.transfer(_channel.sender, _channel.deposit-value)) { throw; }
      // Close the channel
      delete channels[h[0]];
      delete active_ids[_channel.sender][_channel.recipient];

Gas Considerations

Note that a single token transfer costs 50,000 gas. As you have pointed out, this is cost prohibitive for a microtransaction context (although the exact dollar amount depends on the gasPrice used). A payment channel costs roughly 250,000 gas to open and 250,000 gas to close, depending on the implementation.

This means that a payment channel's overhead is roughly 10 transactions, but if you expect 10,000 micropayments per deposit, that's a cost savings of 1000x.

Your Answer

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

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