Bitcoin Forum
November 05, 2024, 12:46:19 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 4 5 6 7 8 [9] 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 »
  Print  
Author Topic: Pywallet 2.2: manage your wallet [Update required]  (Read 208210 times)
dserrano5
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
April 10, 2013, 03:04:52 PM
 #161

Did you put the bitcoin address? (Not pub key nor priv key)

First I tried with the privkey but got a message "success, deleted 0 keys". It was when I tried the address that I got "success, deleted 1 key".


Are you sure you delete from, and dump the same wallet?

Yes. But let me do it for a third time and I'll report back (will take some hours though).
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 10, 2013, 09:12:16 PM
 #162

I'm sorry but I can't reproduce your problem
Check that:
  • you have the last version of pywallet (should be 1.9.3 or 1.9.4)
  • pywallet returns "key:1Pc6N7aDoxxxxxxx has been successfully deleted from /home/xxx/.bitcoin/wallet.dat, resulting in 2 deleted items"
  • you're dumping the wallet that from which you deleted a key (already said I know)



Btw, it's slower than expected but the new version isn't forgotten, I'm working on it

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
dserrano5
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
April 11, 2013, 09:29:44 AM
 #163

I'm sorry but I can't reproduce your problem
Check that:
  • you have the last version of pywallet (should be 1.9.3 or 1.9.4)
  • pywallet returns "key:1Pc6N7aDoxxxxxxx has been successfully deleted from /home/xxx/.bitcoin/wallet.dat, resulting in 2 deleted items"
  • you're dumping the wallet that from which you deleted a key (already said I know)

I wasn't using the latest version, but 2.0b9 from march (commit 278c6e0). However, this is getting interesting:

Code:
$ pgrep -lf bitco
$ grep ^pywver pywallet.py
pywversion="1.9.3"
$ cp /home/btc/.bitcoin/wallet.dat /some/backup
$ read -s P
$ ./pywallet.py --passphrase="$P" --dumpwallet &>wallet-dump1
$ xxd /home/btc/.bitcoin/wallet.dat >wallet-hex1
$ grep 1BLre3Uv7Xxh5XgYa8NXbS7ZYTXBuyCfiK wallet-dump1
            "addr": "1BLre3Uv7Xxh5XgYa8NXbS7ZYTXBuyCfiK",

That is the address I want to delete. Now I run "./pywallet.py --web" and submit the "Delete a key from your wallet" form with this data (copy-pasted here):

Code:
Wallet Directory: /home/btc/.bitcoin
Wallet Filename: wallet.dat
Key: 1BLre3Uv7Xxh5XgYa8NXbS7ZYTXBuyCfiK
Type: Bitcoin address

key:1BLre3Uv7Xxh5XgYa8NXbS7ZYTXBuyCfiK has been successfully deleted from /home/btc/.bitcoin/wallet.dat, resulting in 0 deleted item

Python isn't my native tongue but after managing to tweak the code a bit:

Code:
$ git diff
diff --git a/pywallet.py b/pywallet.py
index 45370e0..c6bbdb2 100755
--- a/pywallet.py
+++ b/pywallet.py
@@ -1781,16 +1781,19 @@ def delete_from_wallet(db_env, walletfile, typedel, keydel):
                elif typedel == "key":
                        if type == "key":
                                if keydel == public_key_to_bc_address(kds.read_bytes(kds.read_compact_size())):
+                                       print "ok deleting key %s of type key" % key
                                        db.delete(key)
                                        deleted_items+=1
                        elif type == "pool":
                                vds.read_int32()
                                vds.read_int64()
                                if keydel == public_key_to_bc_address(vds.read_bytes(vds.read_compact_size())):
+                                       print "ok deleting key %s of type pool" % key
                                        db.delete(key)
                                        deleted_items+=1
                        elif type == "name":
                                if keydel == kds.read_string():
+                                       print "ok deleting key %s of type name" % key
                                        db.delete(key)
                                        deleted_items+=1

I don't get any of those lines in stdout:

Code:
$ ./pywallet.py --web
'ecdsa' package is not installed, pywallet won't be able to sign/verify messages
2013-04-11 11:11:57+0200 [-] Log opened.
2013-04-11 11:11:57+0200 [-] Starting server: 2013-04-11 11:11:57.506397
2013-04-11 11:11:57+0200 [-] twisted.web.server.Site starting on 8989
2013-04-11 11:11:57+0200 [-] Starting factory <twisted.web.server.Site instance at 0x2c18a70>
2013-04-11 11:12:11+0200 [HTTPChannel,0,127.0.0.1] 127.0.0.1 - - [11/Apr/2013:09:12:10 +0000] "GET / HTTP/1.1" 200 29750 "http://localhost:8989/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0"
2013-04-11 11:12:18+0200 [HTTPChannel,0,127.0.0.1] 127.0.0.1 - - [11/Apr/2013:09:12:17 +0000] "GET /Delete?dir=/home/btc/.bitcoin&name=wallet.dat&keydel=1BLre3Uv7Xxh5XgYa8NXbS7ZYTXBuyCfiK&typedel=key HTTP/1.1" 200 132 "http://localhost:8989/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0"
^C2013-04-11 11:12:31+0200 [-] Received SIGINT, shutting down.
2013-04-11 11:12:31+0200 [twisted.web.server.Site] (Port 8989 Closed)
2013-04-11 11:12:31+0200 [twisted.web.server.Site] Stopping factory <twisted.web.server.Site instance at 0x2c18a70>
2013-04-11 11:12:31+0200 [-] Main loop terminated.

In fact:

Code:
$ ./pywallet.py --passphrase="$P" --dumpwallet &>wallet-dump2
$ xxd /home/btc/.bitcoin/wallet.dat >wallet-hex2
$ md5sum wallet-*
fdffc13c2ee830e46b6b33ea8629ea10  wallet-dump1
fdffc13c2ee830e46b6b33ea8629ea10  wallet-dump2
db862daf9579568a9fcdfba2cd6378b4  wallet-hex1
db862daf9579568a9fcdfba2cd6378b4  wallet-hex2

Something I didn't say yesterday because I didn't think it would have something to do, is the contents of the "reserve" field in the wallet:

Code:
$ less wallet-dump1    ## trimmed output
{
    "keys": [
            "addr": "1BLre3Uv7Xxh5XgYa8NXbS7ZYTXBuyCfiK",
            "compressed": true,
            "encrypted_privkey": "2d4a14267d220fce36d7c48df789561797743c29cf750ef5a5234faa7ab178ed8ef4e113771bdb9fe3aa4b0c2a94e9e
9",                                                                                                                                          "pubkey": "02e34a2cc7ee8694cd943d58b222a82e181741002151378820216f6e330cee4c31",
            "reserve": 1,
            "sec": "KxKs8MzyCZ7ufjGsvZNUJtEF9dxuV12geRfM5KCMRofmFXWhbuVr",
            "secret": "2100db5080ec709e0e015d669808111de6f5e9c0e8425f126dce4dc1cd8f520601"
        },

I could swear that "reserve" was 0 before I tried to delete the key for the first time, and maybe turned into one when I got the "success, 1 key deleted" message. Can this be the reason that today pywallet isn't able to show at least the "1 deleted" message?

I'd be happy to be able to --dumpwallet into a file, edit that file and then --importdump or something like that.
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 11, 2013, 09:56:17 AM
 #164

Wow what the actual fuck?

Well, first things first
I'd be happy to be able to --dumpwallet into a file, edit that file and then --importdump or something like that.
You can: this then that

About your "reserve" finding: I think it was 1 before, then 0 after
If so, the 'delete' function deleted the address from the pool, hence the 1 key deleted

But I just found the problem!
Line 1782: change 'if type == "key":' to 'if type == "key" or type == "ckey":'
Must do the trick

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
dserrano5
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
April 11, 2013, 10:27:11 AM
 #165

I'd be happy to be able to --dumpwallet into a file, edit that file and then --importdump or something like that.
You can: this then that

I had read about that but somehow I got the impression that I would lose the transactions stored in the wallet. I am totally and utterly wrong, no? Smiley


Line 1782: change 'if type == "key":' to 'if type == "key" or type == "ckey":'
Must do the trick

Yeah that did it, thank you! The second dump shows an unhandled exception without any additional info:

Code:
$ diff -U2 wallet-dump{1,2}
--- wallet-dump1 2013-04-11 12:13:22.029680350 +0200
+++ wallet-dump2 2013-04-11 12:14:42.028662746 +0200
@@ -22,13 +22,4 @@
         },
         {
-            "addr": "1BLre3Uv7Xxh5XgYa8NXbS7ZYTXBuyCfiK",
-            "compressed": true,
-            "encrypted_privkey": "2d4a14267d220fce36d7c48df789561797743c29cf750ef5a5234faa7ab178ed8ef4e113771bdb9fe3aa4b0c2a94e9e9",
-            "pubkey": "02e34a2cc7ee8694cd943d58b222a82e181741002151378820216f6e330cee4c31",
-            "reserve": 1,
-            "sec": "KxKs8MzyCZ7ufjGsvZNUJtEF9dxuV12geRfM5KCMRofmFXWhbuVr",
-            "secret": "2100db5080ec709e0e015d669808111de6f5e9c0e8425f126dce4dc1cd8f520601"
-        },
-        {
             "addr": "1L7aZRwhW3Kku66mMxi9NH5z6UUymEZ9im",
             "compressed": false,
@@ -35882,2 +35873,6 @@
     "version": 80000
 }
+Unhandled exception in thread started by
+Error in sys.excepthook:
+
+Original exception was:
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 11, 2013, 12:42:05 PM
 #166

I had read about that but somehow I got the impression that I would lose the transactions stored in the wallet. I am totally and utterly wrong, no? Smiley
It's true that you'll lose the transactions but a rescan is rather quick, isn't it?

Yeah that did it, thank you! The second dump shows an unhandled exception without any additional info:
Yeah it happens sometimes. I didn't look at this matter closely as it doesn't seem serious.

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
Dabs
Legendary
*
Offline Offline

Activity: 3416
Merit: 1912


The Concierge of Crypto


View Profile
April 11, 2013, 01:08:47 PM
 #167

What happened to the import public key? (with a bogus private key; this is for encrypted wallets only.)

jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 11, 2013, 02:28:07 PM
 #168

Oh yeah I forgot to test that

I just looked at the code and... erm... before importing a private key in an encrypted wallet I don't check if it's the right one (-> todo list'd)
So it makes things easier to test:
  • create a dummy encrypted wallet
  • pywallet.py --importhex --importprivkey 0123456789012345678901234567890123456789012345678901234567890123 --passphrase anything_that_is_not_the_correct_passphrase
That should import the address corresponding to 01234... but with the bad encrypted private key
See what then happens (I can't test right now)

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
dserrano5
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
April 11, 2013, 02:33:17 PM
 #169

It's true that you'll lose the transactions but a rescan is rather quick, isn't it?

Ah, I didn't know that a rescan repopulated the wallet with the transactions. I thought the client added each transaction at broadcast time and that was all.
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 11, 2013, 02:58:17 PM
 #170

It's true that you'll lose the transactions but a rescan is rather quick, isn't it?

Ah, I didn't know that a rescan repopulated the wallet with the transactions. I thought the client added each transaction at broadcast time and that was all.
Nope, during a rescan the client reads all the blockchain and repopulate the wallet.
The "issue" is that you lose your unbroadcasted transactions. But it can be used when you made a transaction that won't never be include in a block for example.

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
dserrano5
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
April 11, 2013, 07:23:33 PM
 #171

Thanks for all the insights, and for pywallet of course!
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 12, 2013, 09:57:30 AM
 #172

Thanks!  Smiley


To everybody: I pushed the new version, can you check that pywallet tells you there's an update? and that auto-update works?

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
dserrano5
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
April 12, 2013, 10:39:48 AM
 #173

I got the "out of date" message. Then clicked on it to upgrade and I got the standard Firefox error about being unable to connect. pywallet output is sane so I guess the Firefox message is normal:

Code:
2013-04-12 12:39:36+0200 [HTTPChannel,0,127.0.0.1] 127.0.0.1 - - [12/Apr/2013:10:39:35 +0000] "GET /?update=1 HTTP/1.1" 200 29750 "http://localhost:8989/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0"
2013-04-12 12:39:36+0200 [twisted.web.server.Site] (Port 8989 Closed)
2013-04-12 12:39:36+0200 [twisted.web.server.Site] Stopping factory <twisted.web.server.Site instance at 0x18d5950>
2013-04-12 12:39:36+0200 [-] Main loop terminated.

Did a ./pywallet.py again and now it reports being up to date.
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 12, 2013, 11:09:28 AM
 #174

Great, so that works
It's true I should add a little message to say everything happened as expected

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
dserrano5
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
April 12, 2013, 11:37:12 AM
 #175

ADSL routers and the like have a piece of javascript or HTML META tag to refresh the page some time after instructing the router to reboot itself. That mechanism would fit nicely here.
K1773R
Legendary
*
Offline Offline

Activity: 1792
Merit: 1008


/dev/null


View Profile
April 12, 2013, 11:44:16 AM
 #176

ADSL routers and the like have a piece of javascript or HTML META tag to refresh the page some time after instructing the router to reboot itself. That mechanism would fit nicely here.
Code:
<META HTTP-EQUIV="REFRESH" CONTENT="5;URL=http://127.0.0.1:8989/">

[GPG Public Key]
BTC/DVC/TRC/FRC: 1K1773RbXRZVRQSSXe9N6N2MUFERvrdu6y ANC/XPM AK1773RTmRKtvbKBCrUu95UQg5iegrqyeA NMC: NK1773Rzv8b4ugmCgX789PbjewA9fL9Dy1 LTC: LKi773RBuPepQH8E6Zb1ponoCvgbU7hHmd EMC: EK1773RxUes1HX1YAGMZ1xVYBBRUCqfDoF BQC: bK1773R1APJz4yTgRkmdKQhjhiMyQpJgfN
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 12, 2013, 11:51:51 AM
 #177

Yup good idea I'll put that soon


Code:
<META HTTP-EQUIV="REFRESH" CONTENT="5;URL=http://127.0.0.1:8989/">
That would work too right?
Code:
<META HTTP-EQUIV="REFRESH" CONTENT="5">

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
K1773R
Legendary
*
Offline Offline

Activity: 1792
Merit: 1008


/dev/null


View Profile
April 12, 2013, 12:02:55 PM
 #178

Yup good idea I'll put that soon


Code:
<META HTTP-EQUIV="REFRESH" CONTENT="5;URL=http://127.0.0.1:8989/">
That would work too right?
Code:
<META HTTP-EQUIV="REFRESH" CONTENT="5">
no, otherwise it would refresh the update site and therefore update itself all 5 seconds lol
update site = "/?update=1"

[GPG Public Key]
BTC/DVC/TRC/FRC: 1K1773RbXRZVRQSSXe9N6N2MUFERvrdu6y ANC/XPM AK1773RTmRKtvbKBCrUu95UQg5iegrqyeA NMC: NK1773Rzv8b4ugmCgX789PbjewA9fL9Dy1 LTC: LKi773RBuPepQH8E6Zb1ponoCvgbU7hHmd EMC: EK1773RxUes1HX1YAGMZ1xVYBBRUCqfDoF BQC: bK1773R1APJz4yTgRkmdKQhjhiMyQpJgfN
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 12, 2013, 12:11:33 PM
 #179

Yeah of course! Grin
And I forgot I coded the update page that way... That's kinda stupid actually
I'll change that to the ajax way...

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
jackjack (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 14, 2013, 09:05:16 PM
Last edit: April 14, 2013, 11:14:46 PM by jackjack
 #180

Pywallet v2.0 released!

I hope you'll like the changes

I'd like someone to confirm that the new update system works on windows

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
Pages: « 1 2 3 4 5 6 7 8 [9] 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 »
  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!