-
Notifications
You must be signed in to change notification settings - Fork 8
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
FATIP-2 Pegged Asset Token Standard #25
base: master
Are you sure you want to change the base?
Conversation
Not currently defined in the standard, or not in detail are the following:
|
The FCT burn to pFCT is missing from the documentation but discussed in the discord and implemented in pegnet/pegnet#86 Sh
|
Thanks Paul. I can make changes to the effect of adding replay protection to OPRs and integrate a link to identity which will be DID forwards compatible as well as support server identity. FAT has an awesome well established supporting standard FAT-103 (#24) written by @AdamSLevy that prevents replay attacks and is implemented in FAT-0 and FAT-1. This will explicitly define a |
@PaulSnow As for I think that the Factom network that Pegnet operates on should define the sole decider of the "value" of the assets and artificiality of the version of the software. Testnet assets are always worthless, and everyone knows this across all Blockchain ecosystems. We can break them, and were definitely going to be having a lot of breaking changes. We can't have illusions about that. I can't also downplay the impact breaking Pegnet changes may have on existing mainnet FAT assets, as we're creating a protocol level change to FAT here that taps into how balances are calculated, and the consequences of a mistake on a mainnet release could be disastrous. I understand the motivation to get Pegnet up and generating EC usage on the mainnet, and so far it's been crazy exciting seeing Pegnet entries almost every explorer page and the enthusiasm from all parties. We can use that enthusiasm to push Pegnet towards production readiness ASAP and get it on the mainnet, but I strongly think we need to conduct our primary development and testing on the Factom testnet for so many more reasons that I'm happy to elaborate further on. This is the responsible choice and is how blockchain software is developed. In the mean time, people are free to run experimental Pegnet software on the mainnet for whatever reason they like, understanding the consequences, and I'm sure some will continue regardless of breaking changes. |
Move POW answer to 4th external ID, add identity field
@drkatz Well, one of the principle aspects of the Factom Protocol is that projects can make their own decisions about how and when to do things, and I guess that also applies to how they run TestNets vs MainNets. The reason to run the TestNet on the Factom MainNet include:
Running a PegNet testnet on the Factom TestNet is just fine, but makes more sense once the MainNet is live and active. |
Also the testnet tokens are different tokens. Not all tokens on FAT are going to have real value, so I am not sure how having FAT handling the test tokens breaks FAT. |
Actually about the OPRChainID, I was confused. It is needed to prevent moving the OPR record to other chains. However, if we hashed the entry hash rather than just the content of the entry, that would do the same thing (because the ChainID is in the header of the entry). Versioning is something else. We do need versioning of what OPR record type we are using, assuming that we may add other OPR record formats (adding and removing assets and other changes) in the future. |
Luckily
So if the entry is replayed onto another chain the signature will fail verification |
@drkatz We don't sign OPR records as they are not validated by the identity, but by PoW. The PoW ensures you haven't modified the OPR record. On more deep reflection, an OPR record references the entry hashes of the previous 10 winners in the prior block. So actually we can remove the dbht and OPRChainID. The entry hashes do hash the headers of the entries and thus cannot match entries in another chain. Also, all OPR records have unique entry hashes (as they hold references to hashes with references to hashes ... etc ... to the genesis OPR), so they cannot be replayed on the same chain. |
…Identity dependencies for replay (not needed)
Thanks for the response @PaulSnow, makes sense |
@PaulSnow Is it cool to change the spec to specify a single OPR chain for Pegnet per Factom network after our conversation yesterday? I do think this is the way to go in terms of design and follow best & existing practices. Miners can still choose to run the same software on the Mainnet if they wish and if the economics are correct I believe they will. The alternative is that FAT would specify that it only honors the "Mainnet" pegnet OPR chain in the future when we integrate. Otherwise this creates a fork for FAT on each Factom network it exists on, where on the there is an internal mainnet and testnet fork of FAT. This isn't available as an option to us at this point in FAT. What do you think? |
I know there are good reasons not to run the Pegnet TestNet on the Factom MainNet. The thing is, we do have some reasonably wide spread assumptions built up that a number of early miners intend to run on the "TestNet" then transition to the MainNet. If you think of it not as a TestNet but a PR-Net, you can kinda see where this is at. Let's live with it until we get the MainNet running, then move the TestNet to the Factom TestNet. |
Thanks. I think that's acceptable for FAT as long as we can get social consensus on the drop |
Personally, I think we can save a lot of bytes in the OPR by replacing the list of winners with a hash of the list of winners. That will also get rid of the "short hash" which I'm not a fan of. into The drawback is that it reduces human readability of the OPR. The grader isn't impacted by this change (since the grader will have to get the list of previous winners anyway, the data to calculate the hash exists already). |
Something for conversions: we have two different types of transactions, one that converts X asset1 to asset2, and one that converts asset1 to Y asset2: also question: why the metadata in the conversion? is that something inherited from FAT? what kinda of metadata do you expect people to publicize on chain? |
Interesting idea @WhoSoup, I had assumed that the calculation in the second case would be handled by those submitting conversions from current witnessed rates to guarantee an output amount, but what you propose is cleaner and avoids some issues 👍 Let's put it in if everyone agrees! The allowance of metadata is useful to allow construction of applications & sub-protocols on top of FAT. For example, a payment processor could specify a receipt ID be placed in the metadata that it can use to detect a deposit, or trigger some other event. This specific use case of course this makes more sense if conversion also is a transaction in Pegnet, which is likely to be the case. (Just messaged on discord to explain the current motivation for the current conversion model & how we can move forward) |
If we were to change the |
the winners are already sorted by the grading algorithm, with winner[0] setting the conversion rates for that block |
The FATIP currently just mentions Conversions. Would it be a good idea to just have all transactions and conversions have the same format? ie
What exactly you want the receiver to get would then be specified by "amount_asset". If the "amount_asset" is the same as "from_asset", then it means that you want to convert X asset to Y asset at whatever the going rate is. If "amount_asset" is the same as "to_asset" then it means that you want the recipient to get exactly Y asset. It's a bit clunky and since amount_asset can only be to/from_asset, it could be just a boolean if you come up with a good name. (something like "type"?) A conversion would be: A simple transaction would be: A send+convert would be: ... each of which has two types for "amount_asset" except for simple transactions, giving us a total of 5 transaction types. Then we can lock down the types that we don't want to allow during validation (or activate them at specific heights) but still futureproof the format with the same code. |
…ard_updates FATIP-2 Update to Pegged Asset Token Standard
…arify some language Remove old example
* Fixed some minor grammatical issues * the section on "Implicit conversions" was wrong, it doesn't happen this way * updated the chain names to align with pegnet/pegnet#116
Ok so I spent more time thinking this over and talking with a co worker. I was going to type up an explanation on how you can make a limit buy or limit sell based on the After that discussions though, it was apparent that things get a bit complicated pretty quick, and thought is needed to construct it properly. What if we didn't care about the exch rates, and instead set an acceptable range of the opposite currency chosen. Eg Going from PNT to USD. (In my mind, you could argue the opposite)
Therefore:
If all that is true, we can include an Making those limits amounts and not exchrates feels easier to implement on the validation side of things. I inherently distrust float operations in a distributed system, and ratios (exchrates) feel inherently floaty. On the client side, the math about rates/amounts needs to be done anyway, so I think saying exchrate/amt doesn't affect the client. Only the validation in the FAT daemon. |
FATIP-2 Grammar and Clarification: Correct Implicit Conversions, POW, Chain IDs
Required field
Fix validation description
The above group of commits reflect the OPR changes discussed our call today and some quick discussion with @sambarnes in pegnet/pegnet#137 @Emyrk I'm going to think more about the |
@WhoSoup had brought up the idea of using a hash of the array of winners to save space a few days ago in #25 (comment) and @sambarnes followed up on this in pegnet/pegnet#137 (comment) a few moments ago. I think it's a great idea, but want to make absolutely sure this doesn't open us up to any issues. What are peoples thoughts? |
I definitely like the direction the OPR structure is heading, seems a lot more consistent and with readable names. I agree it makes a lot more sense to save the space and only have a double-sha of the winners entry-hash list. Sure, it decreases readability to see what a miner claimed the winners to be. But if we really really want human readability, maybe instead of just hashing the list, we make a deterministic entry out of the winner list? Almost like a coinbase transaction that everyone who grades a block will know the entry hash for:
|
I think we need to finalize the OPR record. A hash of the 10 winners, i.e. hash(1+2+3+4+5+6+7+8+9+10) is enough, because the 10 can be reconstructed via grading, and only 8 bytes of the has are really needed to validate the grading algo you applied is the right algo. We have the dbht in the OPR per this morning's standup. I think we have the names of the entries in the OPR I have to change the name of the Address to the FAxxxx address. Let's finalize this and do it. Is that possible? I wish we were using google docs to collaborate because Git is pretty awkward, but meh. I really spoke out of turn here. We need to discuss design in the Channels set up for that for the PegNet project. We also decided a few days ago that the deadline for new features and new designs was closed. We can talk about what we might want to do in the future, but we need to stop designing and finish what we have. |
From @PaulSnow in discord:
Could you explain the motivation behind using the short hash and concatenation of the first byte of the first hash of 10? I can see how the concatenation of the first byte would help the efficiency of telling which hash to start validating at in most cases, but is still not immune from collision and it's in fact likely to happen... Why aren't we using the full length of the hash output? If this is really that secure why doesn't everyone just use short hashes everywhere? We're talking 64 characters here and that's really not much in terms of payload to ask for the best possible security. |
Discussions of design and engineering of PegNet should be in the design channel on PegNet. When we have a design, we can work on a specification. This process is so backwards. |
New features and new designs were closed days ago by Carl. So changing the winning addresses is not on the table, but I'm happy to discuss. |
- `from` is converted to PNT (interim) at the OPR exchange rate | ||
- Interim PNT is expended to create `to` via coinbase transaction to `output` at the current OPR exchange rate | ||
|
||
The conversion is complete. |
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.
why is "pnt" used as interim? all the values in the opr are expressed as relative to USD, so we should use USD as the base
let's say we have X pFCT and want to convert it to pEUR::
X pFCT = X * pFCT_Rate pUSD
= X * pFCT_Rate / PNT_Rate PNT
= X * pFCT_Rate / PNT_Rate * PNT_Rate pUSD
= X * pFCT_Rate / PNT_Rate * PNT_Rate / pEUR_Rate pEUR
as you can see you're multiplying and then immediately dividing by PNT_Rate, meaning it's an entirely unnecessary step when we can just do X pFCT = ((X * pFCT_Rate) / pEUR_Rate) pEUR
where X*pFCT_rate is pUSD
* clarification of burn mechanics * renaming PNT to PEG * OPR extids * PoW calculation * opr version distinction
FATIP-2 Updates to burns, opr, pow, pnt, opr version
This PR and standard lays out the base data structures and cryptography for the Pegged Asset Token Standard (Pegnet).
Pegnet Whitepaper
Pegnet Mining Paper
Pegnet Project
Pegnet Discord
FAT-2 Describes a pegged token system allowing atomic conversions between a specialized type of
FAT-0 token issuancefungible token controlled autonomously by the pegged asset token protocol, giving the protocol the authority to mint and burn tokens without an issuer according to the OPR grading algorithm and conversion protocol(s).A simplified OPR data structure is proposed with the following improvements over the existing Existing OPR Entry Structure From The Mainnet:
OPRChainID
removed, as this can be inferred directly from the OPR chain the OPR entry was found onDbht
removed, as this can be inferred directly from the OPR entry as it is scanned from the blockchainWinningPreviousOPR
shortened toprevious
CoinbasePNTAddress
changed toreward
FactomDigitalID
removed, as I can't find any functionality that requires itrates
to avoid ambiguity with other keys used for system operations. If pegnet is to eventually support dynamic (new and deprecating old) currency symbols there is not necessarily a guarantee that whatever new symbol is decided, wouldn't collide with an existing key cause issues. We may expect this set of symbols to grow so It makes sense to give it it's own namespace in the JSON.An initial conversion data structure is proposed that supports single conversion of assets inside an address. For example, if
FA1zT4aFpEvcnPqPCigB3fvGu4Q4mTXY22iiuV69DqE1pNhdF2MC
contains a nonzero balance pegged FAT-0 tokens PNT and USD, a conversion entry converts PNT to USD atomically at that address. Conversions do not transact tokens between addresses or parties.