swarmcity / SwarmCityConcept

This is the high level description of what needs to be built
9 stars 1 forks source link

As a Seeker, I choose one of the Repliers to become my Provider so we can enter into a deal. #13

Open kikipluche opened 6 years ago

kikipluche commented 6 years ago

Abstract:

In Swarm City, Seekers choose their own Provider. Providers indicate their interest in fulfilling a request by replying to it.

The Seeker has the ability to examine the reputation of anyone replying to their request.

The Seeker selects one of the Repliers to become the Provider.

How it could work:

On the detail view of an item, a list of replies is shown. The Seeker chooses a Replier to become a Provider by tapping the "Select" button.

It's important that only the selected Replier can fund the deal, so a secret is exchanged between the Seeker and the Replier.

The secret is the dealId, encrypted with the public key of the selected Replier.

The Seeker's public key is stored in the hashtagItem.

The client sends this information to the API.

The hashtagItem is updated to this:

"selectee": { 
  "encryptedDealId": "<String>", // the ID of the deal ( not the hash ) encrypted with the public key of the selected provider (see documentation below on how to encrypt data with a public key)
  "address": "<String>" // the ETH address of the selected provider
}

After the update the API emits a hashtagItemChanged event.

The updated hashtagItem on the API has this format:

hastagItem Key : 123abc // the dealHash Value:

{
    "itemHash": "123abc", // the sha3 hash of the unique ID held by seeker
    "dateTime": "1519846041301", // dateTime when included in a block 
    "description": "Translate my 1 page manifesto from English to Dutch",
    "value": "15000000000000000000", // Seeker's offer in SWT Wei
    "hashtagFee": "500000000000000000", // Hashtag fee in SWT Wei
    "location": "sp3n", // geohash
    "seeker": {
        "address": "0x42004cae3169A3CDa36c0fb32CAB78B1bb4CE87F", // Seeker's ethereum address
        "username": "Xardas",
        "avatarHash": "QmTKMG3aYCKnabDX3LKrYzLFPaCLoWEmXdGTR2CZjUEfZS", // IPFS hash of avatar
        "rep": "0", // Seeker rep on this hashtag of this seeker
    },
    "replies": [{
        "dateTime": 12345, 
        "username": "Tester Y",
        "avatarHash": "<base64>",
        "publicKey": "abc1234...", // the full Ethereum public key
        "address": "0x123...abc",  // the ETH address
        "reputation": "<String>",  // the ProviderRep balance on this hashtag
        "description": "<String>",  // the reply msg
    }],
    "selectee": {
        "encryptedDealId": "<String>", // the ID of the deal (not the hash) encrypted with the publicKey of the selected provider
        "address": "0x123...abc",  // the ETH address
    },
}

How the API could work:

function selectProvider

parameters

{
 "hashTag": "0x123...abc",
 "dealHash" : "0x123abc....34",
 "address": "0x123...acb",
 "encryptedDealId": ""
}

returns

{
 status : 200 // OK
}

What it looks like:

Userflow: https://invis.io/ABGM89SX3V5#/293990495_-Hashtag--contractadress---dealhash-_PROVSELECT_I ( > in Invision, hold shift to see clickable areas)


route: /hashtag/[contractadress]/[dealhash]

On the detail-page of myItem (= I am the seeker of this item), each reply is fully clickable, and consist of:

By tapping one of the replies, the Seeker selects one, bringing it in the reply-detail-view (1).

The reply-detail-view (1) consists of:

Tapping the small white button with blue previous-icon will make the area change back to its default state, showing all the replies.

By tapping the big white txt-button with copy "Select (name)", the user selects this Replier to become the Provider for this deal. The area will change to the provider-selected-view (2).

The provider-selected-view (2) consists of:


Desktop view:


Invisionlinks with login (for inspect mode!): mobile: https://projects.invisionapp.com/d/main#/console/13838256/293990495/inspect desktop: https://projects.invisionapp.com/d/main#/console/14147648/294447345/inspect

Documentation / references

With ♡ from Swarm City

xardass commented 6 years ago

We might not need to listen to hashtagItemChanged event from the API, since we already have a subscription open on item detail for real-time updates anyway. To be discussed further...