-
willyijinin[m]
-
willyijinin[m]
I run this snippet of code twice, each time prints out a different primaryAddress. This doc -
moneroecosystem.org/monero-javascript/global.html#createWalletKeys- says `primary address of the wallet to create (only provide if restoring from keys)`. Why can't I restore a wallet from just the private spend key?
-
jetsteel[m]
I believe the address is comprised of both the "spend" and "view" keys. Further, IIRC, I believe you need both of those keys to actually spend the funds.
-
jetsteel[m]
will.yijinin: I'll see if i can validate what I said
-
jetsteel[m]
will.yijinin: The address of a user is the pair of public keys [spend and view]. Her private keys will be the correspond-
-
jetsteel[m]
ing pair [of private keys]. <- from an old copy of "zero to monero"
-
willyijinin[m]
> <@jetsteel:matrix.org> will.yijinin: The address of a user is the pair of public keys [spend and view]. Her private keys will be the correspond-
-
willyijinin[m]
> ing pair [of private keys]. <- from an old copy of "zero to monero"
-
willyijinin[m]
Thank you. I started to understand it. What I am wondering is why I cannot infer the public keys from the set of private keys? Why in this case is the public keys needed to restore the wallet?
-
jetsteel[m]
will.yijinin: I've been gone for a few years (so my knowledge may be dated). But I rewrote code for generating monero addresses back then. Give me a few to find and review my notes and I'll be able to answer.
-
jetsteel[m]
will.yijinin: So, if I am reading my old notes correctly, the main address is just the base58 encoding of the prefix, public spend key, public view key, and checksum.
-
jetsteel[m]
will.yijinin: the public spend and view keys are just the private keys × G
-
jetsteel[m]
will.yijinin: and the private view key is a hash of the private spend key. So, you should be able to generate the main address from the private spend key alone. (And subaddresses as well).
-
willyijinin[m]
That's what I thought, just the private spend key to restore the wallet. But from experiment and from doc, it seems the primary address is required.
-
willyijinin[m]
jetsteel:
-
jetsteel[m]
will.yijinin: Help me understand better. You say a primary address is required. But a primary address can be created from the private spend key. So, logically, it is possible to do what you need with just a spend key.
-
willyijinin[m]
-
willyijinin[m]
This snippet of code generates a different primary address each run/
-
jetsteel[m]
will.yijinin: I think I may be answering the wrong question. Can you restate your question? Are you asking if it is possible, or asking what existing code does this already? Or asking how to get thr software to do this?
-
jetsteel[m]
will.yijinin: I just sae your last post. Let me take another look.
-
jetsteel[m]
will.yijinin: well, that is curious to me. I believe you are right that you can derive everything from the private sprnd key. At least, that was my experience a couple years back. I do not have experience with this js code base. So, I am not sure what you are seeing or why. We'll both have to wait for someone more knowledgeable.
-
jetsteel[m]
will.yijinin: could you provide example input and output? (Obviously do **not** use real private keys...just a dummy one) Perhaps, that might offer a clue. ....
-
jetsteel[m]
Like, use a dummy private key "11111...." or something. When you run it twice, what do you get back each time?
-
jetsteel[m]
Are you able to step through the code with a debugger and see where the code starts to diverge from your expectations?
-
willyijinin[m]
-
willyijinin[m]
jetsteel:
-
jetsteel[m]
will.yijinin: I'll look some more later, but likely someone else will need to answer
-
willyijinin[m]
-
willyijinin[m]
-
LyzaL
matrix folks when you edit messages it looks like a hot mess on the IRC side
-
woodser[m]
> Will there be a (beta) release of that project soon?
-
woodser[m]
dEBRUYNE: not realistically. it needs a full design and then to be built
-
woodser[m]
will.yijinin: when creating the wallet, it needs to be passed `privateSpendKey: <private spend key>`:... (full message at
libera.ems.host/_matrix/media/r0/do…290090ff9ca09612d41e585935856f01b07)
-
woodser[m]
looks like you're only passing it `privateSpendKey,`
-
woodser[m]
I’m looking for help to design the web wallet tool if anyone knows interested designers
-
willyijinin[m]
-
jetsteel[m]
<woodser[m]> "looks like you're only passing..." <- For clarity, what should his code snippet look like in the example will.yijinin last gave?
-
jetsteel[m]
woodser: ^
-
-
jetsteel[m]
woodser: The snippet you gave uses the mnemonic. mathematically, a private spend key has all the information needed to recreate the wallet, correct? Can monerojs do that?
-
woodser[m]
currently the wallet needs to be recreated with either the mnemonic or the private spend key, private view key, and primary address
-
jetsteel[m]
woodser: Thanks. That is unexpected, though, considering the private view key and primary address can be derived from the private spend key. Do you know if there is a specific rationale for that? Or is it more "it was coded that way" and nobody has changed it?
-
hyc
there are non-deterministic keys too, where the private view key is unrelated to the spend key
-
jetsteel[m]
hyc: I can see how that would necessitate optionally specifying the private view key. But I don't (yet) see the rationale for requiring the primary address when both keys have been provided. Also, IMO, such a function should operate using just the private spend key by implicitly or explicity deterministically generating the rest of the info. Would you agree? Or am I off?
-
moneromooo
Sanity checks maybe ?
-
moneromooo
I'd be fine with an empty (or zeroed) input being interpreted as "fill this in if you can, error out if you can't".
-
hyc
yeah I always wondered why we needed to provide the address
-
woodser[m]
I was able to restore a wallet in monerojs from only the private spend key by removing sanity checks:
-
woodser[m]
-
woodser[m]
-
woodser[m]
I can incorporate the changes in the next release if it makes sense and isn't unsafe, given the non-determinstic keys
-
jetsteel[m]
woodser: Thanks. I would have had the same question will.yijinin had. Is your "sense and safety" concern regarding someone (who had a non-determinsitic view key) calling it and (by accident/bug/typo) generating a wallet with a deterministic view key?
-
sethsimmons
Gentle reminder that we have loose consensus on the next hard-fork in early 2022:... (full message at
libera.ems.host/_matrix/media/r0/do…ee4b7d4452390e264e861952ce939cf26fb)
-
sethsimmons
Branch/feature complete is barely 30d away.
-
sech1
jetsteel when both private keys are provided, you can reconstruct the primary address because it's just a combination of the two corresponding public keys. The catch is you don't know whether it's mainnet/testnet/stagenet if you only have two public keys.
-
sech1
but usually it's just mainnet that matters anyway
-
luigi1111w
sethsimmons> Branch/feature complete is barely 30d away. <= fork it
-
hyc
30d away, wait till we're all back from our new years hangovers before forking it
-
selsta
the question will be how much time hardware wallets will need to update to bp+
-
luigi1111w
probably about 3 months longer than we have
-
selsta
someone claimed supporting bp+ will be easier than clsag
-
luigi1111w
actually yeah maybe
-
garth
Is the latest PR the multisig vuln fix?
-
garth
-
luigi1111w
yep
-
woodser[m]
jetsteel: yeah, my concern would be someone calling this function with a private spend key and deriving any unexpected keys. I'd be fine to support it if the risk is low