Skip to content
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

Ridvan non changing wallet #64

Merged
merged 7 commits into from
Jun 9, 2021

Conversation

rozaydin
Copy link

@rozaydin rozaydin commented Jun 9, 2021

No description provided.

Signed-off-by: rozaydin <ridvan@namebase.io>
Signed-off-by: rozaydin <ridvan@namebase.io>
Signed-off-by: rozaydin <ridvan@namebase.io>
@rozaydin rozaydin self-assigned this Jun 9, 2021
Signed-off-by: rozaydin <ridvan@namebase.io>
Signed-off-by: rozaydin <ridvan@namebase.io>
@rozaydin
Copy link
Author

rozaydin commented Jun 9, 2021

This PR contains a new parameter for wallet creation staticAddress which controls change and receive address derivation of the default acccount. If this parameter is set to true. Account always uses same receive address and change addresses for it's transactions.

Below sample code shows how new param is used:

const fixedAddressWallet = await wdb.create({ staticAddress: true });

One important thing to note is, to store state (in leveldb) we are now using the last bit of flags byte in Account object.

let flags = 0;

    if (this.initialized)
      flags |= 1;
    if (this.staticAddress)
      flags |= 0x80;

PR modifies the wallet-http endpoints for wallet and account creation to pass new parameter. When interacting with HTTP interface.

@rozaydin rozaydin requested review from RevCBH and turbomaze June 9, 2021 14:31
let key;
if (this.staticAddress) {
// branch 1 -> changes
key = this.getSpecificKey(0, 1);

Choose a reason for hiding this comment

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

We want the change addr to be static too, I'll push a commit to replace this with 0, 0 if there's nothing else

Copy link
Author

@rozaydin rozaydin Jun 9, 2021

Choose a reason for hiding this comment

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

it's already static and we have tests for it to verify. The parameter 1 on the getSpecificKey is for branch (1 -> changes)
am i missing sth ?

@turbomaze turbomaze merged commit 8db8650 into production-namebase Jun 9, 2021
@turbomaze turbomaze deleted the ridvan-non-changing-wallet branch June 9, 2021 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants