-
Notifications
You must be signed in to change notification settings - Fork 17
Payment
This page is only a draft of very early ideas and should only be used as summary of a ongoing discussion
L = List of servers (recipients)
L[i]_deposit = deposit of i th server
Client pays deposit D into client-contract and starts a lottery (with a fixed regular payout-date, where the serverlist can not be changed)
Each server has a max probability of L[i]_deposit / total deposit to win the lottery.
Each time a server answers with a response, he gets a signed ticket with the nonce as data. The nonce represents the number of responses from the server. A ticket is defined as
msgHash = keccak256( nonce, serverAddress )
The real likelihood of winning the lottery is: (nonce_signed / nonce_max) * (L[i]_deposit / total deposit).
On the payout-day, the winner is determined (by a seed-function based on the blockhash for every client). Servers collect their tickets and can then check which one of those tickets is valid and call the payout-function.
function payout(address clientAddress, uint nonce, uint8 r, bytes32 s, bytes32 v) {
uint clientDeposit = deposit[clientAddress];
}
If none, the money goes back to the client, or is used for a new lottery. No double-spend possible.
The fact that the list of servers is dynamic can be fixed: https://github.com/Giveth/minime
Also the client has a fixed amount he pays for a certain amount of time, and can also roughly calculate how much responses he is getting for that. To use all of his money, he needs to use all servers.