-
Notifications
You must be signed in to change notification settings - Fork 39
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
docs(ertp): ERTP walk-thru: Alice buys a ticket from Bob #1257
base: main
Are you sure you want to change the base?
Changes from 5 commits
8f2dfd1
53ff2d2
448982d
a4ed4ef
b605cd1
c55d3c6
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 | ||||
---|---|---|---|---|---|---|
@@ -1,7 +1,134 @@ | ||||||
# ERTP Overview | ||||||
|
||||||
ERTP (_Electronic Rights Transfer Protocol_) | ||||||
is Agoric's token standard for transferring tokens and other digital assets in | ||||||
ERTP (_Electronic Rights Transfer Protocol_) is Agoric's digital asset standard. | ||||||
|
||||||
ERTP is a uniform way of transferring tokens and other digital assets in JavaScript. All kinds of digital assets can be easily created, but importantly, they can be transferred in exactly the same ways, with exactly the same security properties. | ||||||
|
||||||
For example, let's suppose Alice wants to buy a concert ticket from Bob for 10 bucks. | ||||||
|
||||||
::: tip Watch: erights -- credibly transferable ownership (Oct 2024) | ||||||
_25 minutes on ERTP at a conceptual level._ | ||||||
<br /> | ||||||
|
||||||
[<img src="./assets/alice-bob-ticket.png" alt="diagram of Alice, Bob, Ticket objects" />](https://www.youtube.com/watch?v=O8Bx_Abj9Qc&list=PLzDw4TTug5O1A-tkPJe4HVq0VBPcNOMHm) | ||||||
|
||||||
::: | ||||||
|
||||||
## Issuer, Brand, and Mint | ||||||
|
||||||
We start by using `makeIssuerKit` to make a `Mint`, `Brand`, and `Issuer` for **Bucks**. | ||||||
|
||||||
<<< @/../snippets/ertp/guide/test-readme.js#importErtp | ||||||
<<< @/../snippets/ertp/guide/test-readme.js#declareShared | ||||||
<<< @/../snippets/ertp/guide/test-readme.js#makeBucks | ||||||
|
||||||
The `bucks.brand` and `bucks.issuer` don't let anyone mint new assets, so sharing | ||||||
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.
Suggested change
"anyone" here triggers thoughts about existential quantifiers. "people", at least to me, ties the abilities more closely to those holding the objects. 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. as if people hold objects? that hurts my brain. I'll have to think it over. |
||||||
them widely is normal. We must be careful to guard the`bucksMint`, so we keep it separate. | ||||||
|
||||||
::: tip see also ZCFMint (TODO) | ||||||
|
||||||
... | ||||||
|
||||||
::: | ||||||
|
||||||
## Amount: Asset Descriptions | ||||||
|
||||||
Next we combine the Bucks brand with a value to make an `Amount`: | ||||||
|
||||||
<<< @/../snippets/ertp/guide/test-readme.js#bucksAmount | ||||||
|
||||||
An Amount is a value labeled with a brand. | ||||||
Amounts are descriptions of digital assets, | ||||||
answering the questions "how much" and "of what kind". | ||||||
|
||||||
Amounts have no economic scarcity or intrinsic value. | ||||||
|
||||||
:::tip More on Asset Use versus Mention | ||||||
_See also [The Settlers of Blockchain](https://agoric.com/blog/technology/the-settlers-of-blockchain) by Chris Hibbert, Jun 2021_ | ||||||
::: | ||||||
|
||||||
## Minting Payments | ||||||
|
||||||
Next we use the mint to make a `Payment` of 100 bucks for Alice: | ||||||
|
||||||
<<< @/../snippets/ertp/guide/test-readme.js#bucksPayment100 | ||||||
|
||||||
Likewise, we make a **Tickets** issuer kit make payments of 10 **Tickets** and 100 **Bucks** | ||||||
for Bob. | ||||||
|
||||||
<<< @/../snippets/ertp/guide/test-readme.js#amountMathProps | ||||||
<<< @/../snippets/ertp/guide/test-readme.js#bobPayments | ||||||
|
||||||
Where Amounts only describe assets, Payments actually convey digital assets/rights. | ||||||
Sending Payments must be done very carefully. | ||||||
|
||||||
## Making Purses | ||||||
|
||||||
Alice is acting as a buyer. | ||||||
She can make her own empty purses using the shared issuers, which she relies on. | ||||||
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. "relies on" only makes sense here as ocap terminology. I didn't find anything helpful at cap-lore.com. Do you have a better link? I don't know whether it's helpful to bring this up here. 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. rely as in "reliance set" comes from Concurrency Among Strangers. I'll think about where to work that in. |
||||||
She depsits some **Bucks** that she is given into her Bucks purse. | ||||||
|
||||||
<<< @/../snippets/ertp/guide/test-readme.js#aliceBuyer1 | ||||||
|
||||||
Purses also hold digital assets/rights. | ||||||
**Purses are normally not sent betwen parties.** | ||||||
|
||||||
## Credible Asset Transfer | ||||||
|
||||||
To buy a ticket, she withdraws a payment of 10 bucks and make a `buy` request | ||||||
to some vendor she was given. | ||||||
|
||||||
<<< @/../snippets/ertp/guide/test-readme.js#aliceBuyer2 | ||||||
|
||||||
The seller has likewise created purses for **Bucks** and **Tickets** and made deposits. | ||||||
When they get a `buy` request, the argument may be anything, so it's called `allegedPayment`. | ||||||
But once they deposit it into their Bucks purse, they know it was | ||||||
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.
Suggested change
|
||||||
a valid Bucks payment, and they know the amount. | ||||||
Provided the amount is sufficient, they withdraw a ticket (payment) and return it. | ||||||
|
||||||
<<< @/../snippets/ertp/guide/test-readme.js#bobSeller | ||||||
|
||||||
Now our buyer has an `allegedTicket`. | ||||||
Once she deposits it in her **Tickets** purse, she knows it was | ||||||
a valid payment and she knows its value. She can check that she | ||||||
got at least 1 ticket. | ||||||
|
||||||
<<< @/../snippets/ertp/guide/test-readme.js#aliceBuyer3 | ||||||
|
||||||
To put it all together: | ||||||
|
||||||
<<< @/../snippets/ertp/guide/test-readme.js#aliceBuysFromBob | ||||||
|
||||||
## Non-Fungible and Semi-Fungible Assets | ||||||
|
||||||
::: tip: TODO: Non-Fungible and Semi-Fungible Assets | ||||||
|
||||||
... | ||||||
|
||||||
::: | ||||||
|
||||||
## ERTP Concepts Overview | ||||||
|
||||||
Each digital asset has Mint, Issuer, and Brand facets: | ||||||
|
||||||
![ERTP Interfaces 1](./assets/ertp-interfaces-1.svg){ width=200 height=200 } | ||||||
|
||||||
Use brands to make amounts. | ||||||
|
||||||
Use a Mint to create Payments. Use an Issuer to make Purses. | ||||||
Deposit payments into purses and withdraw them back out. | ||||||
|
||||||
![ERTP makeIssuerKit API](./assets/ertp-interfaces-2.svg) | ||||||
|
||||||
Fungible and non-fungible kinds of assets are handled uniformly. | ||||||
|
||||||
![ERTP object relationships](./assets/ertp-interfaces-3.svg) | ||||||
|
||||||
# Obsolete material | ||||||
|
||||||
_aside from TODOs above_ | ||||||
|
||||||
token standard for transferring tokens and other digital assets in | ||||||
JavaScript. Using the [ERTP API](/reference/ertp-api/), | ||||||
you can easily create and use digital assets, all of which are | ||||||
transferred exactly the same way and with exactly the same security properties. | ||||||
|
@@ -12,8 +139,6 @@ object, it can call methods on that object. If it doesn't have a | |||||
reference, it can't. For more on object capabilities, see | ||||||
[Chip Morningstar's post](http://habitatchronicles.com/2017/05/what-are-capabilities/). | ||||||
|
||||||
## ERTP Concepts Overview | ||||||
|
||||||
### Asset | ||||||
|
||||||
There are three kinds of assets: | ||||||
|
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.
Was this sampled from the video? I think sampling this during the fade while the top layer is translucent is visually annoying. At 23:54 you could sample the following. Or, if you want better resolution, I'll find the actual slides. Please let me know.
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.
I prefer SVG from slides, if that's handy...
but this is a substantial improvement. I couldn't figure out how to hide the youtube controls in a screenshot.