Bitcoin Forum

Other => Beginners & Help => Topic started by: djp3 on May 16, 2012, 08:25:19 PM



Title: Decrypting a wallet
Post by: djp3 on May 16, 2012, 08:25:19 PM
I have an unaccepted transaction in my wallet.
My wallet is encrypted.
Is there a way that I can resubmit the transaction or decrypt my wallet so that I can edit out the transaction?


Title: Re: Decrypting a wallet
Post by: Stephen Gornick on May 16, 2012, 09:12:52 PM
I have an unaccepted transaction in my wallet.
My wallet is encrypted.
Is there a way that I can resubmit the transaction or decrypt my wallet so that I can edit out the transaction?

Are you saying it is a spend transaction that should be valid but that it hasn't been included in a block yet (such as the fee not being high enough)?   Or are you saying it could be a double spend (e.g., what could happen when using multiple copies of the same wallet.dat) and thus the transaction will never confirm and is a cosmetic nuisance/

If the former, does the transaction appear in the blockchain, even as unconfirmed?
 - http://www.blockchain.com

If not, have you given the client time to rebroadcast the transaction?  (i..e, leave it running for an hour or so)?


Title: Re: Decrypting a wallet
Post by: djp3 on May 16, 2012, 09:21:09 PM
The transaction is in my wallet, but it hasn't been confirmed (24+ hours)
The transaction id is:
0a31c7472ca42c9e50db35d58fd0645440552c4769a992149bdcd3d401827016

I don't think it made it into the chain.

I didn't know that the client retransmitted the transaction.

It was a very small experimental transaction to SatoshiDice


Title: Re: Decrypting a wallet
Post by: Stephen Gornick on May 16, 2012, 09:25:28 PM
0a31c7472ca42c9e50db35d58fd0645440552c4769a992149bdcd3d401827016

[...]

I didn't know that the client retransmitted the transaction.

Looks like it just made it to the blockchain:
 - http://blockchain.info/tx-index/5921848/0a31c7472ca42c9e50db35d58fd0645440552c4769a992149bdcd3d401827016


Title: Re: Decrypting a wallet
Post by: djp3 on May 16, 2012, 10:17:19 PM
Thanks for looking that up. :)
I actually tried to do that earlier on blockchain, but figured I had done something wrong when it didn't show up.

Is the .099 BTC part of the transaction the "transaction fee" that goes to the miner who correctly hashed my transaction onto the chain?


Title: Re: Decrypting a wallet
Post by: Stephen Gornick on May 16, 2012, 11:22:25 PM
Is the .099 BTC part of the transaction the "transaction fee" that goes to the miner who correctly hashed my transaction onto the chain?

Nope, there was no fee paid on that transaction (which explains why now several hours later it still has no confirmations).  It will eventually get included in a block, maybe another 24 hours though.

As far as what that 0.099 BTC is about, ... that is the change transaction that goes back to your wallet.   When you made the SatoshiDICE wager for 0.001 BTC, the "best" coin for that was your Deeptbit payout (1VayNert3x1KzbpzMGt2qdqrAThiRovi8) coin, which you received 0.1 BTC.  Because bitcoin transactions spend the entire INPUT, what it did was created two outputs.  One to SatoshiDICE for 0.001 BTC and one for 0.099 which is to a new address in your own wallet.

The Bitcoin client takes care of everything out of sight to handle this so users don't need to know what adresses are in the wallet.


Title: Re: Decrypting a wallet
Post by: djp3 on May 16, 2012, 11:50:40 PM
Thanks!  That makes sense.

So, I'm gathering from my surfing that it isn't easy to manipulate a wallet outside of the bitcoin client once it is encrypted.  And once it's encrypted it can't be easily decrypted.  Is this accurate as far as you know?


Title: Re: Decrypting a wallet
Post by: Stephen Gornick on May 17, 2012, 12:26:14 AM
So, I'm gathering from my surfing that it isn't easy to manipulate a wallet outside of the bitcoin client once it is encrypted.  And once it's encrypted it can't be easily decrypted.  Is this accurate as far as you know?

Well, the wallet itself isn't encrypted but the private keys needed for spending from the wallet are encrypted.  If you used a strong passphrase for that encryption, then your wallet.dat is useless to anyone except those who know your passphrase.  The client asks for this passphrase each time you either create a new address or make a spend transaction.

Of course, a compromised system could have a keylogger or other type of malware on it in which even a strong passphrase doesn't protect you.   So for amounts where greater security is warranted, there are things like "air-gapped" offline wallets (cold storage) and other approaches that can greatly help improve security.



Title: Re: Decrypting a wallet
Post by: djp3 on May 17, 2012, 01:03:19 AM
That's more sophisticated than what I was getting at.
When my wallet is unencrypted I can edit it with a text editor outside of the client.
When it is encrypted it is all binary and not easily editable outside of the client.
But once it's encrypted I can't get the text version back again (by say "decrypting" it permanently)


Title: Re: Decrypting a wallet
Post by: Stephen Gornick on May 17, 2012, 03:54:00 AM
When it is encrypted it is all binary and not easily editable outside of the client.
But once it's encrypted I can't get the text version back again (by say "decrypting" it permanently)

I see.  There is not yet the feature to let you revert a wallet back to being unencrypted.

There is, however, an easy way to access the contents of the wallet using RPC.

Edit your bitcoin.conf  to put in rpcuser and rpcpassword entries.

 - https://en.bitcoin.it/wiki/Running_Bitcoin#Bitcoin.conf_Configuration_File

Run bitcoin as a server, e.g.,

$ ./bitcoin-qt -server

then

Open it for RPC

$ ./bitcoind walletpassphrase [passphrase] 1000

then you can

$ ./bitcoind dumpprivkey [bitcoin address]

or

$ ./bitcoind importprivkey [bitcoin address] [label]

 - http://en.bitcoin.it/wiki/Importprivkey


Does that help?

p.s., Editing wallet.dat with a text editor is a bad, bad idea.


Title: Re: Decrypting a wallet
Post by: djp3 on May 17, 2012, 08:02:22 PM
Thanks Stephen for the help.
Everything I need is available from the RPC interface (short of decrypting a wallet).  I was just looking at the command-line options and missed the functions you pointed out.