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

Spacemesh wallet address format #38

Closed
lrettig opened this issue Apr 27, 2023 · 3 comments · Fixed by #67
Closed

Spacemesh wallet address format #38

lrettig opened this issue Apr 27, 2023 · 3 comments · Fixed by #67
Assignees
Labels
help wanted Extra attention is needed pause Don't work on this issue without prior approval

Comments

@lrettig
Copy link
Member

lrettig commented Apr 27, 2023

This tool currently allows generation and display of public keys, but not Spacemesh account addresses in the bech32 format that can, e.g., be used as a coinbase address for receiving rewards in the protocol. Add this conversion:

  • smcli wallet read should print pubkeys in this format
  • we should add a new smcli address command that allows conversion between the two formats

See the addressgen tool added here: spacemeshos/go-spacemesh#4276

@0xjac
Copy link

0xjac commented Jul 12, 2023

Happy to tackle this to.
Looking at spacemeshos/spacemesh-sdk#10 and spacemeshos/address, I'm not sure where the address logic should be located. Should it be left in spacemeshos/address and the having smcli and the sdk use it, or should the address logic be moved into the sdk and then have smcli use the sdk directly?

@lrettig
Copy link
Member Author

lrettig commented Jul 12, 2023

This isn't as simple as it looks. https://github.com/spacemeshos/address contains some basic utilities but the core logic to calculate addresses lives here: https://github.com/spacemeshos/go-spacemesh/blob/a49921453d7ab7a4672194e98a41b58f17900d8c/genvm/core/hash.go#L18

It'd be nice to have this in Rust in the SDK, but at the moment it's pretty tightly coupled to go-spacemesh (CC @dshulyak). I definitely see value in having a Rust version of this and making it available over the CFFI. Note that it will require bringing in the SCALE codec -- https://github.com/paritytech/parity-scale-codec will likely work.

I don't think we should add this to the SDK until we've figured out, e.g., spacemeshos/go-spacemesh#3984. For now let's just bring in this logic from the existing Go code (linked above).

I may need to do this today anyway as I'm adding some stuff here, give me a day or two.

@lrettig lrettig added the pause Don't work on this issue without prior approval label Jul 12, 2023
@0xjac
Copy link

0xjac commented Jul 12, 2023

For now let's just bring in this logic from the existing Go code (linked above).

I may need to do this today anyway as I'm adding some stuff here, give me a day or two.

I'm happy to just port that logic here and now. You're then free to use it or not. 😉

0xjac added a commit to 0xjac/smcli that referenced this issue Jul 13, 2023
The `wallet address` cmd lists all the addresses of a given wallet.

Related to spacemeshos#38
0xjac added a commit to 0xjac/smcli that referenced this issue Jul 13, 2023
- Public keys are displayed in the bech32 format by default.
- The old hex format is still available with the `--hex` flag.

Related to spacemeshos#38
0xjac added a commit to 0xjac/smcli that referenced this issue Jul 13, 2023
The addresses associated with a wallet file are now displayed when the
file is read.

The flag `--no-address` hides the address, similar to the old behavior.

Related to spacemeshos#38
0xjac added a commit to 0xjac/smcli that referenced this issue Jul 13, 2023
The `wallet address` cmd lists all the addresses of a given wallet.

Related to spacemeshos#38
0xjac added a commit to 0xjac/smcli that referenced this issue Jul 13, 2023
- Public keys are displayed in the bech32 format by default.
- The old hex format is still available with the `--hex` flag.

Related to spacemeshos#38
0xjac added a commit to 0xjac/smcli that referenced this issue Jul 13, 2023
The addresses associated with a wallet file are now displayed when the
file is read.

The flag `--no-address` hides the address, similar to the old behavior.

Related to spacemeshos#38
0xjac added a commit to 0xjac/smcli that referenced this issue Jul 13, 2023
The addresses associated with a wallet file are now displayed when the
file is read.

The flag `--no-address` hides the address, similar to the old behavior.

Related to spacemeshos#38
@0xjac 0xjac mentioned this issue Jul 13, 2023
0xjac added a commit to 0xjac/smcli that referenced this issue Jul 13, 2023
- Public keys are displayed in the bech32 format by default.
- The old hex format is still available with the `--hex` flag.

Related to spacemeshos#38
0xjac added a commit to 0xjac/smcli that referenced this issue Jul 13, 2023
The addresses associated with a wallet file are now displayed when the
file is read.

The flag `--no-address` hides the address, similar to the old behavior.

Related to spacemeshos#38
0xjac added a commit to 0xjac/smcli that referenced this issue Jul 14, 2023
The `wallet address` cmd lists all the addresses of a given wallet.

Related to spacemeshos#38
0xjac added a commit to 0xjac/smcli that referenced this issue Jul 14, 2023
- Public keys are displayed in the bech32 format by default.
- The old hex format is still available with the `--hex` flag.

Related to spacemeshos#38
0xjac added a commit to 0xjac/smcli that referenced this issue Jul 14, 2023
The addresses associated with a wallet file are now displayed when the
file is read.

The flag `--no-address` hides the address, similar to the old behavior.

Related to spacemeshos#38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed pause Don't work on this issue without prior approval
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants