本文环境:
区块链版本:以太坊POA联盟链
节点版本: geth 1.9.19
操作系统:windows 64
合约源码:https://github.com/BugrahanOzturk/Ethereum-Payment-Channel-Implementation-for-IoT-Devices
本文介绍一种基于以太坊、使用智能合约建立通道,从而实现可信支付的方法;
此种方法可以广泛应用于各类支付或物联网应用场景;
一、合约源码
// author : Bugrahan OZTURK
// date : 15.08.2021
pragma solidity >=0.4.25 <0.7.0;
contract Channel{
address payable public sender; // IoT Device that is sending data
address payable public recipient; // Smart Home User
uint256 public expiration; // Timeout in case the recipient never closes the channel
// MODIFIER DECLARAT