-
Notifications
You must be signed in to change notification settings - Fork 113
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
NEP: URI Standard for Native Asset Transfer #25
Conversation
nep-7.mediawiki
Outdated
|
||
===Native Asset Transfer URI=== | ||
|
||
A Native asset transfer would have the following URI. It describes the reciever address, assetID, and additional attributes that will be sent with the transaction. The attributes are presented in raw hex data. |
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.
Native asset or Native Asset or native asset?
receiver spelling error
nep-7.mediawiki
Outdated
|
||
A Native asset transfer would have the following URI. It describes the reciever address, assetID, and additional attributes that will be sent with the transaction. The attributes are presented in raw hex data. | ||
|
||
<code>NEO:<address>[?assetID=<assetID>][?amount=<amount>][?attributes=<key>=<value>]</code> |
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 would prefer that the key/value pair be separated by another symbol. I think its good to follow querystring conventions, not sure if the decimal point in the amount will screw things up
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 believe this follows query string convention. the decimal point will not screw things up. Please see sample implementation.
nep-7.mediawiki
Outdated
|
||
<code>NEO:AeNkbJdiMx49kBStQdDih7BzfDwyTNVRfb?assetID=c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b&amount=1.0</code> | ||
|
||
Begin transaction to specified address of 1 NEO with transaction attribute Remark = "Hello" |
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.
Can we have another example with 2 attributes? It is currently not clear if i can attach 2 or more attributes and how to do it.
One way we can do it is to just attach the entire attribute serialized string in. So a tx with 3 Hello remarks will be:
attributes=f00548656c6c6ff00548656c6c6ff00548656c6c6f
Whether we want to include the array length byte would be up to the standard.
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 do.
Here is the example of attaching more than one attributes. Implemented using standard URL package in Go.
nep-7.mediawiki
Outdated
| Script | ||
| Additional validation of transactions | ||
|- | ||
| 0x30 |
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.
This would be pretty cool and useful to implement a vote for me button
nep-7.mediawiki
Outdated
@@ -0,0 +1,117 @@ | |||
<pre> | |||
NEP: 7.0 |
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.
The number 7
has been alloced for NEP: Triggers for NeoContract.
After a proposal being accepted, I will alloc a number for it.
As a URI standard for transfer, do we really need complete support for transaction attributes? Or do we just support some of the attributes associated with the transfer?
|
Transaction attributes are optional. I believe putting a list of supported attribute keys in the proposal can benefit developers who are reading it. It's just reflecting the NEO document right now. An application might choose to support only one attribute key. e.g. I totally agree that the more human-readable URI, the better. I was thinking about the case which an application can let user generate a QR code and pass one's public key for ECDH in e.g. what if we have a map table of transaction attribute and URI key? e.g.
note: not a complete list. then it would be something like
|
If we have a map table of transaction attribute and URI key, can we use the keys in URI directly?
By the way, the scheme name of URI is usually lowercase. |
Added URI key to NEO transaction attribute
A thorough reference implementation can be found here |
@erikzhang What Needs to be done to push this to Final? |
I think we can support NEP-5 assets in this standard as well.
If we want to transfer native asset, we put the AssetID to the If we want to transfer NEP-5 asset, we put the ScriptHash of the contract to the |
I have the implementation of NEP-5 asset transfer and smart contract invocation. I'll update the proposal tomorrow to get some feedback. |
Won't this interfere with generic smart contract execution URI's in the future? If we do this then we'll have a specific format for a small subset of invoke transactions (NEP-5 token transfer) and another format for everything else? Or is NEP-5 token transfer URI important enough such that it deserves it's own URI scheme? |
If we have the generic smart contract execution URI's, we do not need a small subset of NEP-5 token transfer. |
It is very easy to make two different hash values with same first few bytes. |
But the asset must be registered in the main net, required to pay all fees... and if this happens, people could simply start using more bytes in uri. But I get your point, for security purposes it's safer to use the complete id. In fact, that just gave me another idea, do you think it is useful to have some sort of checksum in the uri? That would help avoiding small fraudulent changes on uri, and it could consider the whole assetid in the count, even if only the first bytes are present... so a few extra space in the checksum (that would also check the whole uri) would be compensated by shorter assetid. Perhaps I'm overcomplicating things, but some thoughts may be useful :) |
So what if the checksum itself be replaced? |
- Removed `from` field in NEP5 Transfer URI - Added URI Keys for NEP5 Transfer - Added sample implementation
Then we will need a checksum of the checksum :D hahah just kidding. I mean Erik, the current URI has no checksum, so data can be manipulated anyway (but I agree that's not in the scope of the NEP). I'm just saying that perhaps those middle bytes of the assetid could be replaced by something that represents all transfer information (including the whole assetid), and an extra checksum, with fewer space. But theoretically speaking, I agree with you that there may exist another checksum that is coeherent with the manipulated assetid (not the original one, missing pieces), and also coherent with the rest of the data.. but I don't imagine how to generate it, really. In another way, perhaps it's just easier to allow "asset=NEO" or "asset=GAS", that will achieve the same effect with less complication than my proposal. The checksum can be optional anyway, as everything else I'm saying :D If anyone is interested I can create some practical examples to put here, but like I said, just a thought. ;) |
Is this a valid query parameter string? i.e. multiple equal signs without the embedded equals sign being escaped?
...I can't find definitive reference for this but there it is a common convention for the |
@mwherman2000 You might saw the old one. It's already updated to use Transaction attribute name as a query key. I have updated the proposal to include detail on endianness and optional fields for NEP5. We have a simple implementation in JS of embedding a QR code generated with this NEP9 spec here |
This script for generating the QR Code is really nice, showing that my previous comments on compressing the URI (just for QR code usage) were actually not necessary :) |
Can we handle the transfer of global assets and the transfer of NEP assets in a unified way?
For NEP-5 tokens:
|
yeah that looks better. @erikzhang updated. Please have a look. |
Unified native asset transfer and NEP-5 transfer
Two suggestions:
|
- Reorganized the page. - Allowing using `neo` and `gas` as an alias in native asset transfer.
Now we need to update the implementations. |
I updated the implementations. https://github.com/O3Labs/NEP9-go |
One last question, should we mark it as |
I've updated the sample QR code creation page to conform to the latest updates:
This can be used as an example for QR code creation in accordance with NEP9. |
@erikzhang I voted it to be |
👍 for final |
+1 to finalize! 💯 |
Congratulations, that's nice! Seems final to me as well :) +1 |
No description provided.