README ¶
MicroPay: a micro payment POC
The package implements hardcoded ISC contract for continuos micro payment protocol.
The final implementation will be in Rust.
Use case
Party P
(the provider) provides services to party C
(the consumer).
Services are provided in small pieces, permanently, for example every several minutes. Telecom services would be an
example. Upon delivery of a piece of services, P
expects a payment from C
according of the service contract. If C
doesn't pay as expected, P
may stop providing services. The payment usually very small, normally no more that some
thousands of iotas per piece, a micro payment. Due to continuous flow of micro payments and micro services, the parties
has limited financial risk.
Due to the confirmation latencies it is not practical to settle each micro payment into the DLT, IOTA Tangle in this
case. Therefore, the approach in the MicroPay is for P
to collect many payments into a batch and then settle it all
into DLT at once: the off-ledger (a.k.a. off-chain, off_tangle) approach.
Requirements/assumptions
- the off-ledger payments bear risk of not being able to settle them later due to shortage of funds
- to eliminate that risk the
P
require a sum fromC
to be locked at third trusted part, a smart contract. ThispaymentWarrant
(another word?) is used to settle the payments, - The contract guarantees settlement of off-ledger payments up to the amount left in the
paymentWarrant
account. C
can top up thepaymentWarrant
, however it is out of reach forC
while the contract is in effectC
may announce it stops using the services at any time.P
has incloseTimeout
must settle all of pending off-ledger payments. It means closing the contract and releasing what has left inpaymentWarrant
back toC
.- If
P
fails to close the contract from its side incloseTimeout
, thepaymentWarrant
it release automatically and claims for payments are not accepted. It means, if not settled in time, the paymenst may be lost forP
Documentation ¶
Index ¶
Constants ¶
const ( ParamPublicKey = "pk" ParamPayerAddress = "pa" ParamServiceAddress = "sa" ParamPayments = "m" ParamWarrant = "wa" ParamRevoked = "re" ParamLastOrd = "lo" StateVarPublicKeys = "k" WarrantRevokePeriod = 1 * time.Hour )
const MinimumWarrantBaseTokens = 500
Variables ¶
var ( FuncPublicKey = coreutil.Func("publicKey") FuncAddWarrant = coreutil.Func("addWarrant") FuncRevokeWarrant = coreutil.Func("revokeWarrant") FuncCloseWarrant = coreutil.Func("closeWarrant") FuncSettle = coreutil.Func("settle") FuncGetChannelInfo = coreutil.ViewFunc("getWarrantInfo") )
var Contract = coreutil.NewContract("micropay", "Micro payment PoC smart contract")
Functions ¶
This section is empty.