Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
CHIP-0002: Add dApp protocol #9
CHIP-0002: Add dApp protocol #9
Changes from 3 commits
55a14ce
21db5ff
01b4ffc
d0ea2b9
b4dad7c
c8b9e60
8543505
d3026ea
fc9140d
2868c7d
53f5763
5f7a07d
ea6d43f
36b488f
39fec69
c18a8dd
67731b5
47b542b
aaa1c61
7d8ff8d
20c9980
1953e38
71820aa
fc8be6a
eef816d
c9f162f
c75136c
1a67cbf
061de4c
5fae81d
73061c3
35e9f82
7434568
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
We should make it clear that any request might take a while (Several minutes) because the user has to approve manually. Is this true?
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 define standard puzzle hash? If the wallet wants to use a different type of puzzle than another wallet, that's fine right?
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.
We should just say: XCH address. XCH will be sent directly to this address, so this should not be a wrapper CAT address, for example
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'm guessing all the other methods should also return promises.
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.
All the functions discussed here will be wrapped by
window.chia.request(args: RequestArguments): Promise<any>;
. So we needn't add thePromise
for this function.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.
Ok. In that case maybe the
Promise<any>
could be changed to use a generic to make it more type safe.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.
we might want to specify "Chia Mainnet" on the left
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.
What does connect imply? Does this give read access to all the users data? It definitely does not give write access, correct?
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.
rename to
include_coin_name
?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.
do we need the timestamp?
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 is just a convenience method, because we can call selectAssetCoins and add up the amount right?
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.
Maybe prefix and postfix every message with some fixed value in the wallet?
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.
We're considering
sha256("\x18Chia Signed Message:\n" + len(message) + message)
.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.
If we want to prefix something, we should use the
network_id
orgenesis_challenge
to prevent replay attacks between mainnet, testnet, and forks.Also, aren't there usecases where we need the actual signature of some object without a prefix, or are these all handled by
signTx
?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.
We considered adding networkIds but eventually removed them because this function is essentially a proof of identity for the user's public key. The dApp verifies the identity by the public key. We will highlight in the documentation that dApp can prevent replay attacks by adding information such as timestamp and network id into the message. For some dApps, they don't care which chain they are on, they just need to include the timestamp in the message.
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.
What's the rationale for the
\x18
byte? If it's an homage to\x18Bitcoin Signed Message:\n
, then my understanding is that the 0x18 represents the length of the string"Bitcoin Signed Message:\n"
(24 in decimal). So I would expect the Chia prefix to be"\x15Chia Signed Message:\n"
to properly encode the length of the"Chia Signed Message:\n"
string.I found the details mentioned at: https://blockforums.org/topic/98-signed-message-verification-library/?do=findComment&comment=1872
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.
Hey Jeff.
Yes. You’re right. Thanks for pointing this out. The magic number in BTC/ETH is the length of the network name.
Actually, at the first beginning, we chose
0x18
because of RFC 4880. And the number doesn't affect the security.After consideration, we decide to change to
shatree(("Chia Signed Message" . message))
.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.
Maybe add a list of statuses, because it's possible the wallet might be connected to multiple nodes in the future.
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.
What does this mean? Does it mean a new address was created? or the active key was changed?