Author

Topic: Can I get seed from brain wallet in Java? (Read 158 times)

legendary
Activity: 4466
Merit: 3391
November 14, 2021, 11:00:48 PM
#10
but how to get a seed from an ordinary word?

The brain wallet's private key is typically the result of a SHA-256 operation on the passphrase. The seed phrase would be a conversion of the SHA-256 result according to BIP-39. The seed is then the result of a cryptographic operation on the seed phrase.

https://en.bitcoin.it/wiki/BIP_0039

and will there be any connection between the addresses obtained from the brain wallet and the addresses obtained from the seed-phrase obtained from the brain wallet?

There is no way for anyone to tell that the brain wallet address and the BIP-32 addresses are related without knowing (or guessing) the passphrase.
legendary
Activity: 952
Merit: 1385
November 13, 2021, 09:47:09 AM
#9

They don't point to the same private key. The brainwalletx will give you an address whose private key will be the hash of your word and the other will give you private keys whose master private keys' entropy will be the hash of the word.


Yes, right - the difference is how you retrieve address from private key. One way it is "direct", other way "indirect" as you create children using additional algorithm.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
November 13, 2021, 09:17:34 AM
#8
I think the question was if user receive the same address using both seed and brainwallet. And then yes, as both point to the same private key.

They don't point to the same private key. The brainwalletx will give you an address whose private key will be the hash of your word and the other will give you private keys whose master private keys' entropy will be the hash of the word.

With brainwalletx and the entropy I used above, we get this:
Code:
1HmwnvKYDQX1qr5UJxMbMP69RizXQSNV85

But, by deriving the addresses of that entropy (BIP32) we get:
Code:
path,address,public key,private key
m/0/0,1BXzAYeGfAfukysx9u3jNVmDHotuvC7c56,,
m/0/1,1A6FVYA9HK16dUG5HFoXe86uYwYL7CoDCt,,
m/0/2,166CEjEnx4YG5wcbrVjZfaN6iuAHrvvqet,,
m/0/3,1CAThBwUATTKM76qYA2DyRNApRqGcoywC4,,
m/0/4,1Nna3pcMqgzzF68WFnfX16942eTGQQNYcu,,
m/0/5,1F2FAkokmpZeSMiuN5dUB3CDux9fht5ysK,,
m/0/6,187UUwEq8VLp1Gk1ujymZEBmS722F26WA8,,
m/0/7,18P22y4bNYn5RzDaJ6AaxVKEKMXP9huo5q,,
m/0/8,13btapJMLaHDpasQNHuQYtTGbpWkSdYZY1,,
m/0/9,1FP3HcDkes9hPcMjx4oLaSC4xXHn5D4wDC,,
m/0/10,15HJWVG8g7EKzqRkhE8RiHkGP7a28jR4r6,,
m/0/11,1EfDjyuK4Kme7w6X5Y3ag9L2tqsNgLCffh,,
m/0/12,1NDkwp2rVQQmBhiXfXiytsjRuaPvwmGGvW,,
m/0/13,182EqE96vc9DA93j6qdJrYT9PKw4bLjYir,,
m/0/14,1PbDazL1vk2asbX275k7ZBRF8XXYThLWob,,
m/0/15,1CBDtNjz5oyyrHanBwrNxXSKsBREr7w6cz,,
m/0/16,1CUm963uvpc9vjnYGNHaSnMHf7MSzaMCQZ,,
m/0/17,1AQ5F9LRg6HPe93Ws9rH4tCHCCFyZYvkiz,,
m/0/18,14uiQMBA9nMhyUhBcAjygmSc4LTs2ezrui,,
m/0/19,1H4vTaFXZwWSpgGXzVmWPxg5keg86XD81W,,

They don't have any connection unless you reveal the entropy.
legendary
Activity: 952
Merit: 1385
November 13, 2021, 09:05:17 AM
#7
I think the question was if user receive the same address using both seed and brainwallet. And then yes, as both point to the same private key.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
November 13, 2021, 07:53:12 AM
#6
No, they won't have any connection at all.

To be more precise: There won't be any connection if you never share with anyone either the brainwallet's private key or the seed phrase.
member
Activity: 96
Merit: 36
November 13, 2021, 04:36:53 AM
#5
thank you very much  Smiley
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
November 13, 2021, 04:27:38 AM
#4
but how to get a seed from an ordinary word?
Think simply. What's a seed phrase? An entropy of x bits. A twenty four words seed phrase is a representation of 256 ones and zeros (plus 8 which are calculated from those 256). So, in order to get a seed from a word, you'll have to get 256 bits from that word. To do that, you could just hash it.

That's what they're doing in that website. Hash the word “apple” with SHA256 and you'll get:
Code:
3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b

Use the word “apple” as a brain passphrase, and you'll get the same entropy:
Code:
3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b

The site just converts the entropy into words: (Based on BIP-39)
Code:
usage drastic muscle brave attack ridge legal layer party sample mango refuse

(12, 15, 18 and 21 words require less than 256 bits, so it just removes characters from the 256-bit hash)

The question is: will the addresses in the first and second cases be somehow connected?
If I understand correctly, you write a word, the site gives you the seed phrase which was calculated by the hash of that word, you then import it into Electrum and get addresses. Now you take the word and create a brain wallet from a website such as brainwalletx.

No, they won't have any connection at all.
member
Activity: 96
Merit: 36
November 13, 2021, 04:02:30 AM
#3
thank you very much for the example. The most important question:

1) This site takes the word. Makes seed-phrase. Seed can be inserted into electrum and get addresses

2) I take the same word. I make a brain wallet out of it (without a seed). I get several types of addresses.


The question is: will the addresses in the first and second cases be somehow connected?
legendary
Activity: 952
Merit: 1385
November 13, 2021, 03:45:53 AM
#2
Hi,

I am not sure do what you want - to restore seed for a given address/priv key (so you will convert brainwallet -> key -> seed)?
It could be done that way: https://medium.com/geekculture/cryptocurrency-911-how-does-12-word-seed-phrase-work-9d892de9732

Operations are simple and you will encode it in any language without any problems I guess, just the matter of number of words.
member
Activity: 96
Merit: 36
November 13, 2021, 03:33:32 AM
#1
I am using Java and trying to repeat the trick from brain2bip.com

I already know how to get addresses from the brain wallet
I already know how to get addresses from a seed-phrase

but how to get a seed from an ordinary word?
there is open source how the site does it but I don't understand JS(

I will be very grateful for any help


PS: and will there be any connection between the addresses obtained from the brain wallet and the addresses obtained from the seed-phrase obtained from the brain wallet?
Jump to: