-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EIP 808 - ERC for a Standard Decentralized Booking Protocol #808
Changes from 5 commits
adcffef
4a35d70
fdcd1ab
4e19775
e5902ad
8c82970
71fde33
0948db2
cd37376
ccc5d64
dd1870d
8912d4b
8f65a41
1406005
c19a4d0
3dd779d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
## Preamble | ||
|
||
EIP: 770 <or to be assigned by an editor> | ||
Title: Decentralized Booking Protocol Standard | ||
Author: Vidal Chriqui <[email protected]> | ||
Type: Standard | ||
Category : ERC | ||
Status: Draft | ||
Created: 2017-12-26 | ||
Requires : ERC 20 | ||
|
||
## Abstract | ||
|
||
The following describes standard functions for a decentralized booking protocol that can be used to reserve any kind of resource (Hotel, concert ticket, restaurant table). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, hotel room |
||
The protocol involves the following participants : | ||
|
||
- Provider : an entity providing its own resource or a third-party party resource to be booked | ||
- Booker : an entity that books the resource for itself or a third party | ||
- Booking infrastructure : a public "location" where providers can "post" resource availability data and where these resources can be searched by bookers. The booking infrastructure facilitates signaling between providers and bookers by aggregating a high volume of resource type and availabilities. | ||
- RES smart contract : A booking smart contract implementation of the decentralized standardized BTU protocol. | ||
|
||
## Motivation | ||
|
||
The Booking Token Unit (BTU) protocol is a building block for any decentralized application (dApp) or web site willing to implement booking features for their end-users. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the name of the protocol
If these two are different protocols, where is the Booking Token Unit protocol described? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is only one protocol, the "Booking Token Unit protocol" that is the subject of this ERC There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The title reads differently. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Title was not meant to name the protocol, but thanks for this valuable feedback, I adjusting the title accordingly |
||
This standard also brings interoperability among decentralized applications that incorporate it. | ||
We strongly believe that a transparent and public inventory enabled by an open-source standardized protocol would considerably lower the entry barriers to many Internet booking markets. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An extra space after There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will be fixed in next submission |
||
|
||
## Specification | ||
|
||
The BTU protocol involves potentially ten steps and our standardized decentralized reservation contract (RES). Some of following steps can be relayed off-chain, but are always settled on-chain. | ||
|
||
<img src="./eip-770/protocol-steps.png"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The image contains an Ethereum logo. Ethereum logos are distributed under Creative Commons Attribution 3.0. Please follow the term of the license. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for this reminder that will be taken into account in next submission |
||
|
||
Hereafter the general sequence : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An extra space before There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will be fixed in next submission |
||
|
||
(Step 1.1) Provider is creating an “availability offer” (OFFER) specifying : | ||
|
||
* resource id OR bundle id. A bundle is a group of resources. | ||
* resource name OR bundle name | ||
* resource category | ||
* deposit amount in BTU : amount requested for escrow in order to allow a reservation request | ||
* commission amount in BTU : amount paid to booker | ||
* availability start date, | ||
* availability end date | ||
* limit date and time for a free reservation cancellation | ||
* signed (r,s,v) hash of previous information. This signed hash serves as a signed identifier of the resource to be reserved. | ||
* Metadatas : daily price of the resource (fiat amount to be paid at resource “delivery”), links to images, long description, key-values that can be used as search criteria, etc... | ||
The availability data is broadcasted over any communication channel, ideally a decentralized off-chain solution. | ||
|
||
(Step 1.2) At any moment, the provider can update the resource metadata by broadcasting a new message. | ||
It is very common that yield management requires many prices (fiat price of the resource) update during the same day. This update only impacts the off-chain components. | ||
|
||
(Step 2) Booker is looking for a resource is querying all resources matching is criteria and is selecting a resource he is willing to reserve | ||
|
||
(Step 3.1) In the same operation : | ||
Booker is approving to RES smart contract the required amount of BTU to make the booking (amount defined in step 1.1 by the provider) | ||
A booking entry is registered into the smart contract with following information | ||
|
||
* Signed hash of resource | ||
* Signed pointer to all full offer information (datas + metadatas) at the moment of the reservation request. Those information are stored in the offchain booking infrastructure. | ||
* Public address matching the hash signature | ||
* desired reservation start date | ||
* desired reservation end date | ||
* status : RESERVATION_REQUESTED | ||
|
||
(Step 3.2) Booker broadcasts the resource reservation request to the Booking infrastructure adding all end-user profile information off-chain that may be necessary for the reservation approval. This would help comply with privacy protection requirements. | ||
It is the responsibility of the Booker to notify its end user customer of the full resource information and the provider signature (Availability “snapshot” data). This can be used as proof of reservation details in (the extreme) case resource information at reservation time is deleted from off-chain infrastructure. | ||
|
||
(Step 4) Provider is validating the reservation request and broadcasts the new status to “RESERVATION_CONFIRMED”. | ||
|
||
(Step 5) RES smart contract is updating the reservation status to “RESERVATION_CONFIRMED” | ||
|
||
(Step 6.1 - Optional) Booker cancels the reservation by broadcasting a cancellation request. This triggers a submission to the RES smart contract that empties the registries for this resource. | ||
Depending on the conditions and cancellation date, the BTU escrowed into the RES smart contract are affected back to the user or to the provider | ||
|
||
(Step 6.2 - Optional) Provider cancels the reservation by broadcasting a cancellation request. This triggers a submission to the RES smart contract that empties the registries for this resource. RES smart contract is releasing the escrowed amount to booker. | ||
|
||
(Step 7.1 & 7.2) Booker is notifying that the resource has been paid (presumably at resource check-out). RES smart contract is releasing the escrowed BTU back to user in addition to a BTU agreed commision. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spelling: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be fixed in next submission |
||
|
||
## Implementation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The implementation section is supposed to contain links to testable code. |
||
|
||
The implementation involves following functions : | ||
|
||
- publishAvailabilities (likely off-chain) : Publishes one or multiple available resources for reservations and for being “searchable”. | ||
- listAvailabilities (likely off-chain) : List all available resources matching a search criteria | ||
- requestReservation : Request for a reservation. The function can be used for initial reservation request OR updating | ||
- getReservationStatus : Read reservation status. Following values are possible : REQUESTED, REJECTED, CONFIRMED | ||
|
||
|
||
``` | ||
contract ERC770 is ERC20 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this need to be an ERC20? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because during the process (step 3.1 or6.1 for instance), the allowance & approve may be called by the RES smart contract There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The RES contract doesn't need to be an ERC20 contract for calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for my quick reply. |
||
// Availability structure | ||
enum BookingStatus { REQUESTED, REJECTED, CONFIRMED, CANCELLED } | ||
struct availability { | ||
address _contractAdress; | ||
uint _resourceId ; // resource id OR bundle id | ||
uint _type; // Type of Availability | ||
uint _minDeposit ; // minimum BTU deposit for booking this resource | ||
uint _commission ; // commission amount paid to booker in BTU | ||
uint _freeCancelDateTs; // Limit date for a reservation cancellation | ||
uint _statDateTs; //availability start date timestamps | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo |
||
uint _endDateTs; //availability end date timestamps | ||
BookingStatus _bookingStatus ; // reservation status | ||
string _metaDataLink // Link to Meta Data of the bookable resource (desc, image links, etc…) | ||
} | ||
//Submit one or multiple availability - implementation will be off-chain | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does an offchain functionality appear in the interface of an Ethereum contract? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We did this for pedagogical reasons (easier to understand). |
||
function publishAvailabilities (address _owner, availability[] _availability, bytes32 signatureProof ) constant returns (uint status); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct |
||
//Query Availabilities - implementation will be off-chain | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does an offchain functionality appear in the interface of an Ethereum contract? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We did this for pedagogical reasons (easier to understand). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If an implementation has this function on-chain, is the implementation still compliant to this ERC? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Because the ERC specified "eventually" off-chain (not mandatory to be off-chain) |
||
function ListAvailabilities(address _requester, string _criterias) constant returns (availability[] a); | ||
//Request reservation | ||
function requestReservation(address _requester, availability _availability) constant returns (uint status); | ||
//Check booking status | ||
function getReservationStatus(address _requester, availability _availability) constant returns (BookingStatus status); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for this relevent remark. The correct type is BookingStatus and this mistake came from a bad copy and paste (from a previous code base) |
||
} | ||
``` | ||
|
||
## Additional References | ||
|
||
[BTU website](http://www.btuprotocol.com) | ||
|
||
|
||
## Copyright | ||
|
||
All contributions are made under the [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.en.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An extra space before
:
.Requires: 20
should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be done in next submission