Bitcoin Forum
November 11, 2024, 05:28:48 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Merging two encrypted wallet.dat files  (Read 361 times)
andrecalabrese (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 1


View Profile
April 12, 2020, 07:55:23 AM
 #1

I have a technical question.

A wallet is protected by a password, which encrypts the key.

Is it possible to "merge" two encrypted wallets into one and have a completely new database, if they are encrypted with the same password?

Is there any paper on how the encryption works?
HeRetiK
Legendary
*
Offline Offline

Activity: 3108
Merit: 2177


Playgram - The Telegram Casino


View Profile
April 12, 2020, 08:42:52 AM
Merited by vapourminer (1), pooya87 (1), ABCbits (1), Heisenberg_Hunter (1), aliashraf (1)
 #2

I have a technical question.

A wallet is protected by a password, which encrypts the key.

Is it possible to "merge" two encrypted wallets into one and have a completely new database, if they are encrypted with the same password?

Is there any paper on how the encryption works?

Two different encrypted wallets will be encrypted using two different keys, even if they have the same password. As you mentioned yourself, the key is encrypted using the password. Accordingly the wallet itself is not encrypted using the password but the randomly generated key that is encrypted using said password.

Bitcoin Core's wallet.dat uses standard ciphers and hashing algorithms. See here for reference:
https://en.bitcoin.it/wiki/Wallet_encryption

Information on AES-256 and SHA-512 itself is widely available. It is not possible to "merge" AES-256 encrypted data without decrypting it first, even if they are encrypted using the same key.




▄▄███████▄▄███████
▄███████████████▄▄▄▄▄
▄████████████████████▀░
▄█████████████████████▄░
▄█████████▀▀████████████▄
██████████████▀▀█████████
████████████████████████
██████████████▄▄█████████
▀█████████▄▄████████████▀
▀█████████████████████▀░
▀████████████████████▄░
▀███████████████▀▀▀▀▀
▀▀███████▀▀███████

▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
 
Playgram.io
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

▄▄▄░░
▀▄







▄▀
▀▀▀░░
▄▄▄███████▄▄▄
▄▄███████████████▄▄
▄███████████████████▄
▄██████████████▀▀█████▄
▄██████████▀▀█████▐████▄
██████▀▀████▄▄▀▀█████████
████▄▄███▄██▀█████▐██████
█████████▀██████████████
▀███████▌▐██████▐██████▀
▀███████▄▄███▄████████▀
▀███████████████████▀
▀▀███████████████▀▀
▀▀▀███████▀▀▀
██████▄▄███████▄▄████████
███▄███████████████▄░░▀█▀
███████████░█████████░░
░█████▀██▄▄░▄▄██▀█████░
█████▄░▄███▄███▄░▄█████
███████████████████████
███████████████████████
██░▄▄▄░██░▄▄▄░██░▄▄▄░██
██░░░░██░░░░██░░░░████
██░░░░██░░░░██░░░░████
██▄▄▄▄▄██▄▄▄▄▄██▄▄▄▄▄████
███████████████████████
███████████████████████
 
PLAY NOW

on Telegram
[/
pooya87
Legendary
*
Offline Offline

Activity: 3626
Merit: 11027


Crypto Swap Exchange


View Profile
April 12, 2020, 09:32:00 AM
 #3

what is it exactly that you are trying to do? there is a good chance that there is a more logical and better way of achieving that. for instance wallets usually support "importing" keys which is the option you should use if you want to "merge" another wallet into a wallet you have if the software allowed that. but a still better way is to  "sweep" the keys into the wallet that you have which means sending the coins from the secondary wallet keys to the primary wallet.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
koch44
Jr. Member
*
Offline Offline

Activity: 54
Merit: 11


View Profile
April 12, 2020, 01:43:45 PM
Merited by Halab (2), ABCbits (1), ewaspiro (1)
 #4

I have a technical question.

A wallet is protected by a password, which encrypts the key.

Is it possible to "merge" two encrypted wallets into one and have a completely new database, if they are encrypted with the same password?

Is there any paper on how the encryption works?

First you would need to know if the DB is same version, otherwise you would need to convert it yourself.

This is possible in blockchain.com wallets (to have multiple xpriv) but as someone said above, it would probably mean you would break backward compatibility and would have your own custom bitcoin core version not readable by other versions.

BTC Python developer of various tools. Contact me for programming help (python/cuda)
R.I.U. iol
Newbie
*
Offline Offline

Activity: 15
Merit: 2


View Profile
April 14, 2020, 04:39:31 PM
 #5

I don't know if this helps, but you can:
export the private keys from both wallets
then create a new wallet
import both private keys into the new wallet
your new wallet will have all the addresses of the two old wallets
nc50lc
Legendary
*
Offline Offline

Activity: 2590
Merit: 6366


Self-proclaimed Genius


View Profile
April 16, 2020, 07:32:13 AM
Merited by ABCbits (1)
 #6

You'd lose HD wallet feature, which force you to backup wallet.dat file regularly. OP apparently trying to merge multiple wallet.dat without losing any features or advantage each wallet.dat have.
He will only need to backup once after he imported the keys or dumpwallet file.
After that, the 'new backup' can still generate the new/future addresses/keys as long as the hdseed is the same.
Old backups however wont contain the imported prv keys.

I don't know if this helps, but you can:
export the private keys from both wallets
Better use dumpwallet on wallet1, then importwallet the dump file to wallet2.
That's doable within a minute if you're fast, minus the rescan.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4361

<insert witty quote here>


View Profile
April 16, 2020, 11:08:15 PM
 #7

I have a technical question.

A wallet is protected by a password, which encrypts the key.

Is it possible to "merge" two encrypted wallets into one and have a completely new database, if they are encrypted with the same password?

Is there any paper on how the encryption works?
Which wallet application are you referring to? Huh As not all wallets use the same encryption methods/standards. Are both wallets from the same app?

I suspect this is an "XY problem. What are you actually wanting to achieve by merging two wallets together? Huh What is your specific scenario/reason for wanting to "merge" 2 wallets? Huh

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
keychainX
Member
**
Offline Offline

Activity: 378
Merit: 53

Telegram @keychainX


View Profile WWW
April 26, 2020, 12:00:23 AM
 #8

I have a technical question.

A wallet is protected by a password, which encrypts the key.

Is it possible to "merge" two encrypted wallets into one and have a completely new database, if they are encrypted with the same password?

Is there any paper on how the encryption works?

No you cannot, as there is no wallet that can have multiple passwords for different private keys.

All wallets even those with imported keys share the same password, therefor render it impossible to "merge" two different wallets with different passwords into one.

If you need info on password encryption for bitcoin core you could always dive in here; (google AES-256-CBC and SHA-512)

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

/KX

cryptoworld99
Member
**
Offline Offline

Activity: 84
Merit: 22


View Profile
May 04, 2020, 02:04:11 AM
 #9

Yes, its possible.


bitcoin-cli createwallet "testwallet"

This should make a folder called "testwallet" in your bitcoin dir

delete the wallet.dat file there and upload your encrypted wallet.dat file there

to spend funds from what wallet.dat file you do this

bitcoin-cli loadwallet testwallet

bitcoin-cli -rpcwallet=testwallet sendtoaddress (address) (amount)

Easy as that, repeat step 1 as many times as you like with as many wallet.dat files.


Learn more here: https://bitcoincore.org/en/doc/0.17.0/rpc/wallet/createwallet/

Good luck PM me if you need any help.
ranochigo
Legendary
*
Offline Offline

Activity: 3038
Merit: 4420


Crypto Swap Exchange


View Profile
May 04, 2020, 02:42:29 AM
 #10

-snip-
You're sweeping the funds from one wallet file to another. OP wants to merge two of his wallet.dat such that the addresses from both wallet.dat is in one wallet.dat only.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
cryptoworld99
Member
**
Offline Offline

Activity: 84
Merit: 22


View Profile
May 04, 2020, 04:30:11 AM
 #11

-snip-
You're sweeping the funds from one wallet file to another. OP wants to merge two of his wallet.dat such that the addresses from both wallet.dat is in one wallet.dat only.


-snip-
You're sweeping the funds from one wallet file to another. OP wants to merge two of his wallet.dat such that the addresses from both wallet.dat is in one wallet.dat only.



Hmmmm.


Try this:

Re-run bitcoind/Bitcoin-Qt, giving the -wallet=/path/to/wallet option.
dumpwallet the private keys to a file
Shutdown.
concatenate the files together.
Re-run and importwallet the combined file.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!