MallCloud / contracts-api

API for communicating with Ethereum Contracts
0 stars 0 forks source link

The flow to buy and download files via Django API and Contracts API #8

Open markpyzhov opened 7 years ago

markpyzhov commented 7 years ago

As I see the flow is:

  1. Owner uploads something into file-server.
  2. D-API sends to C-API data with secret string (and other info), which can be used for retrieving file. After that D-API saves DIN in PostgreSQL. Furthermore the DIN is visible for owner.
  3. Buyer sees in UI data-set.
  4. Buyer clicks «Buy»
  5. D-API sends to C-API userID, token and DIN. The response contrains DIN.
  6. Buyer gets DIN from message and saves somewhere.
  7. Buyer checks blockchain to see secret string to retrieve file by DIN

Can you update the flow to be matched with your vision?

kgupta15 commented 7 years ago

The creation of notebook is something like this

  1. User asks UI to create a notebook and enters details.
  2. UI sends required details to the place where all notebooks live.
  3. The notebook is created. The response is an access URL/token to the notebook.
  4. The UI sends all details with access URL/token to c-api.
  5. c-api enters record for created notebook. The access url is encrypted.

The blockchain is uneditable. Its not possible to first enter a value and then remove it because the whole process didn't work out.So entering any details to blockchain should always be last part of any transaction.

In order to buy notebook,

  1. User sends request via UI to c-api.
  2. c-api does the work of buying, checking fund availability etc and sends back the access details.
  3. The UI can now access the notebook.
  4. UI extracts details from notebook.
  5. UI follows all steps for notebook creation

This allows UI to create a copy of the notebook that was bought. User can make changes in their own copy as much as they like. Original and bought copies aren't connected. Connecting the copies requires the original author to provide permission that will just provide access to the real notebook and wont create a copy.

markpyzhov commented 7 years ago

The blockchain is uneditable. Its not possible to first enter a value and then remove it because the whole process didn't work out.

How then Update and Delete endpoints work (https://github.com/MallCloud/contracts-api/wiki/API-Access)?

The creation of notebook is something like this

In order to buy notebook

I think the process will be similar if it will be as I described by me, except the way from what C-API will be triggered.

Connecting the copies requires the original author to provide permission that will just provide access to the real notebook and wont create a copy.

These methods will come later right?

kgupta15 commented 7 years ago

The update functionality is done using specific functions that are made for it. Blockchain still remembers previous values. Delete doesn't actually delete anything. We just make a notebook unavailable. Its still present on blockchain, but if someone wants to get the access authorization or buy it, we simply tell them its unavailable.

These methods will come later right?

Yes, it will be added into system.