Skip to content

Instantly share code, notes, and snippets.

@rjl493456442
Created December 4, 2019 11:44
Show Gist options
  • Select an option

  • Save rjl493456442/a94d769ac12abb211c6c80da4c317198 to your computer and use it in GitHub Desktop.

Select an option

Save rjl493456442/a94d769ac12abb211c6c80da4c317198 to your computer and use it in GitHub Desktop.

P2P payment network setup strategies

Client pays first

  • Light client gets a slot for 3 minute free trial
  • Light client choose to pay, make the deposit and then send the first payment
  • Whenever the light client is almost out of balance, server will send him a message to get the second payment in order to keep the slot!
    • If light client rejects to pay, it will lose the slot very soon since there is already negative balance accumulated, then it basically has to wait a few hours to get another connection slot
    • If light client accepts to pay, it will reown the slot for the next a few hours based on the amount it pays.
  • All in all, it's Pay before delivery business model

Advantages

  • We can use the current implementation

Disadvantages

  • Client needs to make the deposit after 3 minute free trial, based on the estimation(assuming 4 gwei gas price and 150$ ETH price):
    • Deposit costs 2.6cent
    • Withdraw costs 2.7 cent
    • Claim costs 1.8 cent
    • 3 minute free trial is too short to build such a big trust

Server serves first

  • Light client gets a slot for 3 minute free trial
  • Light client has the willing to make the payment, ask 1 hour stable connection time with minimal capacity assigned
  • Server choose to add service token, TRUST the client will pay back
  • Whenever the light client is almost out of balance, server will send him a message to require the payment
    • If client refuses to pay which he promises, drop the connection
    • If client agree to pay which he promises, then we can extend the connection time gradually
  • All in all, it's Pay after delivery business model, it's more friendly to client but totally acceptable for server.

Advantages

  • It's much easier for client to build the trust. For the client, the risk factor is that he needs to pay the on-chain fee to establish the trust. For the server, the risk factor is that he needs to provide a period of free services to establish the trust. The latter one is much easier to accpet.
  • As the number of successful payments increases, the connection time used by the client in advance which promised by server increase gradually

Questions

(1)The amount of first payment should larger than 4 cent which is the transaction cost of CASH?

Actually I think it's unnecessary for client to make the first payment larger than 4 cent in order to cover the transaction cost of CASH. There is still in the process of building trust, small amount is acceptable for the first a few payments. But later, all the following payment should larger than 4 cent since trust is already built.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment