Paratii-Video / wiki

Wiki for Paratii.
15 stars 4 forks source link

Define protocol for paying for transcoding #21

Closed jellegerbrandy closed 6 years ago

jellegerbrandy commented 6 years ago

Roughly, we need a little "protocol" that we can use immediatly that does the following:

aeftimia commented 6 years ago

Side note: Would the price more closely match the amount of computational work to transcode a video if the user paid in PTI/kB? If so, would it make sense to use this metric instead?

So for this protocol, would it make sense to identify the video by its initial IPFS hash. Perhaps a protocol could be: 1a. Server initiates an escrow with a smart contract with a rate for transcoding videos. The escrow has a time limit, after which the funds will be returned to the sender if they have not been successfully claimed by the transcoder. 1b. Server sends escrow address to client. 1c. Server sends the rate (e.g. PTI/minute) to the client. 2a. Client sends funds to the escrow address and the hash of the video. 2b. Escrow address logs an event, to which the server is subscribed, that details the deposited funds and hash. 3a. Client uploads video to server. 3b. Server checks hash matches that referenced in the escrow and that the funds are sufficient. 3c. If funds are sufficient, move to 4, otherwise, report insufficient funds. 4a. Server transcodes video and uploads each format to IPFS. 4b. Server sends the IPFS hashes of each transcoded segment to the escrow. 4c. Since we can trust the server, there is no challenge step and the funds are released to the transcoder.

jellegerbrandy commented 6 years ago

Hi Alex,

Actually, this protocol was already partly specifed and discussed on gitter soem 10 days ago. I should have linked to the wiki entry here, which already described a protocol, and which i just updated ( (also with staking, @felipegaucho !) https://github.com/Paratii-Video/wiki/wiki/Protocol-Description:-Upload-Video

Just 2 remarks:

ya7ya commented 6 years ago

Hey @jellegerbrandy

the cost of transcoding is probably based on both the size and the length of the video.

It's based on the length and the number of downsamples, for example a 1 minute 1080p video would cost more than 1 minute 480p video.