Skip to content

docs: Interoperable Address Serialization Guide #37

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

0xteddybear
Copy link
Collaborator

No description provided.

7. Serialize the address, in this case 20 raw bytes: `[D8DA6BF26964AF9D7EED9E03E53415D37AA96045]`.
8. Compute the length of the above, in this case `20 == 0x14`
9. Append the length as a single byte: `[0001 03 000001 14]`
10. Append the address from step 7: `[0001 03 000001 D8DA6BF26964AF9D7EED9E03E53415D37AA96045]`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
10. Append the address from step 7: `[0001 03 000001 D8DA6BF26964AF9D7EED9E03E53415D37AA96045]`
10. Append the address from step 7: `[0001 03 000001 14 D8DA6BF26964AF9D7EED9E03E53415D37AA96045]`

missing address length

```

1. Take the first two bytes and interpret them as a big-endian integer: `0x0001 == 1`. We know how to parse version 1, so we can proceed. Remaining payload: `[22000245296998a6f8e2a784db5d9f95e18fc23f70441a1039446801089879b08c7ef0205333498d5aea4ae009585c43f7b8c30df8e70187d4a713d134f977fc8dfe0b5]`
2. Take the next byte, `0x22 == 34`. This is the length of the chainid. Remaining payload: `[205333498d5aea4ae009585c43f7b8c30df8e70187d4a713d134f977fc8dfe0b5]`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. Take the next byte, `0x22 == 34`. This is the length of the chainid. Remaining payload: `[205333498d5aea4ae009585c43f7b8c30df8e70187d4a713d134f977fc8dfe0b5]`
2. Take the next byte, `0x22 == 34`. This is the length of the chainid. Remaining payload: `[000245296998a6f8e2a784db5d9f95e18fc23f70441a1039446801089879b08c7ef0205333498d5aea4ae009585c43f7b8c30df8e70187d4a713d134f977fc8dfe0b5]`

remaining payload fix

@0xteddybear 0xteddybear marked this pull request as ready for review April 9, 2025 12:56
- Interoperable Address sans the 'version' field is `000122000245296998a6f8e2a784db5d9f95e18fc23f70441a1039446801089879b08c7ef0205333498d5aea4ae009585c43f7b8c30df8e70187d4a713d134f977fc8dfe0b5`.
- The keccak256 of the above is `0xaa7e9354e0bdd58d51688fdbcba0e4a77efe398198e1683752f1c1188e44d90d`
- First 4 bytes, in uppercase base16: `AA7E9354`
4. Tying it all together: `5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d@solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d#AA7E9354`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
4. Tying it all together: `5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d@solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d#AA7E9354`
4. Tying it all together: `MJKqp326RZCHnAAbew9MDdui3iCKWco7fsK9sVuZTX2@solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d#AA7E9354`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants