-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add support for Nimiq Albatross PoS transaction serialization #4110
Add support for Nimiq Albatross PoS transaction serialization #4110
Conversation
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'll add the required changes in a separate PR, thank you!
@@ -42,6 +43,7 @@ std::vector<uint8_t> Transaction::getPreImage() const { | |||
encode32BE(vsh, data); | |||
data.push_back(NETWORK_ID); | |||
data.push_back(EMPTY_FLAGS); | |||
data.push_back(0x00); // Sender Data size (+ 0 bytes of 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.
Could you please add a link to the source code somewhere at the beginning of the function?
https://github.com/nimiq/core-rs-albatross/blame/b8ed402c9096ffb54afea52347b91ab7831e75de/primitives/transaction/src/lib.rs#L582
@@ -9,13 +9,14 @@ | |||
|
|||
namespace TW::Nimiq { | |||
|
|||
const uint8_t NETWORK_ID = 42; | |||
const uint8_t NETWORK_ID = 24; | |||
const uint8_t EMPTY_FLAGS = 0; | |||
|
|||
std::vector<uint8_t> Transaction::serialize() const { |
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.
Could you please add a link to the source code somewhere at the beginning of the function?
https://github.com/nimiq/core-rs-albatross/blame/b8ed402c9096ffb54afea52347b91ab7831e75de/primitives/transaction/src/lib.rs#L699
const uint8_t EMPTY_FLAGS = 0; | ||
|
||
std::vector<uint8_t> Transaction::serialize() const { | ||
std::vector<uint8_t> data; | ||
|
||
data.push_back(0x00); // Basic TX type | ||
data.push_back(0x00); // Signature Proof type and flags (Ed25519 type and no flags) |
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 add an if statement here to avoid breaking changes
5cc17bb
into
trustwallet:s/nimiq-albatross
* Add support for Nimiq Albatross PoS transaction serialization (#4110) * Update Nimiq Transaction encoding for Albatross PoS * Update tests * [Nimiq]: Add networkId parameter to SigningInput * [Nimiq]: Fix iOS test * [Nimiq]: Fix invalid integer type cast * [Nimiq]: Fix iOS test --------- Co-authored-by: Sören Schwert <[email protected]>
Description
The transaction format for both signing and sending changed slightly for Nimiq Albatross PoS, to encode optional sender data and support more signature methods (now also supports ECDSA and WebAuthn).
How to test
To test, connect your wallet to a Nimiq PoS testnet node (provided in our joined Telegram channel). To be valid in the testnet, the
NETWORK_ID
has to be set to5
.Types of changes
Checklist
If you're adding a new blockchain