Bitcoin Forum
May 09, 2024, 01:04:28 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Sweep private key in Python program  (Read 676 times)
xcbtrader (OP)
Hero Member
*****
Offline Offline

Activity: 865
Merit: 1006


View Profile
June 23, 2016, 08:41:21 AM
 #1

Hello

I'm doing a program in python 2.7 and I need to make a sweep private key.
I have searched but can not find information.
Some help?

Thanks

1715216668
Hero Member
*
Offline Offline

Posts: 1715216668

View Profile Personal Message (Offline)

Ignore
1715216668
Reply with quote  #2

1715216668
Report to moderator
1715216668
Hero Member
*
Offline Offline

Posts: 1715216668

View Profile Personal Message (Offline)

Ignore
1715216668
Reply with quote  #2

1715216668
Report to moderator
"I'm sure that in 20 years there will either be very large transaction volume or no volume." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715216668
Hero Member
*
Offline Offline

Posts: 1715216668

View Profile Personal Message (Offline)

Ignore
1715216668
Reply with quote  #2

1715216668
Report to moderator
1715216668
Hero Member
*
Offline Offline

Posts: 1715216668

View Profile Personal Message (Offline)

Ignore
1715216668
Reply with quote  #2

1715216668
Report to moderator
1715216668
Hero Member
*
Offline Offline

Posts: 1715216668

View Profile Personal Message (Offline)

Ignore
1715216668
Reply with quote  #2

1715216668
Report to moderator
racezefi
Member
**
Offline Offline

Activity: 80
Merit: 14


View Profile
June 24, 2016, 10:07:15 PM
 #2

What do you need precisely?
xcbtrader (OP)
Hero Member
*****
Offline Offline

Activity: 865
Merit: 1006


View Profile
June 25, 2016, 07:56:57 AM
 #3

What do you need precisely?

Sorry

I've solved the problem.
I put here the code if it can serve to someone else.
a greeting

Code:
import os

def electrum_sweep(electrumPKey):
try:
print ('### START ELECTRUM DAEMON ##')
os.system('electrum daemon start')
time.sleep(30)
print ('###  SWEEP ###')
os.system('electrum sweep ' + electrumPKey + ' YOUR ADDRESS TO RECEIVE BITCOINS')
time.sleep(30)
print ('### STOP ELECTRUM DAEMON ###')
os.system('electrum daemon stop')
print ('*** SWEEP PROCESS OK ***')
except:
print ('### ERROR SWEEP ###')

xcbtrader (OP)
Hero Member
*****
Offline Offline

Activity: 865
Merit: 1006


View Profile
June 25, 2016, 09:04:55 PM
 #4

What do you need precisely?

My code don't work  Angry Angry Angry

I have a private key in format "5J3NjusByyNidYsWxXXXXXXXXXXXXX"
This private key have founds.
I need to make a program in python to sweep (transfer the total founds in another address) this founds to my electrum wallet.

I test to:

Code:
import os
import time
from electrum import Network, Transaction

n = Network()
n.start()

Transaction.sweep(["5J3NjusByyNidYsWxa8CyeX7mqXXXXXXXXXXXXXXXXXXXX"],n,"19yZZdxnmtULAAv8XXXXXXXXXXXXX" ,"0.000001")

But don't work.
I see this error:

Traceback (most recent call last):
  File "ProvaTry.py", line 11, in <module>
    Transaction.sweep(["5J3NjusByyNidYsWxa8CyeX7mqm4vXXXXXXXXXXXXXXXXXX"],n,"19yZZdxnmtULXXXXXXXXXXXXX" ,"0.000001")
  File "/usr/local/lib/python2.7/dist-packages/electrum/transaction.py", line 564, in sweep
    u = network.synchronous_get(('blockchain.address.listunspent',[address]))
  File "/usr/local/lib/python2.7/dist-packages/electrum/network.py", line 830, in synchronous_get
    raise BaseException('Server did not answer')
BaseException: Server did not answer

Any solution???

Thanks

xcbtrader (OP)
Hero Member
*****
Offline Offline

Activity: 865
Merit: 1006


View Profile
July 02, 2016, 05:43:31 PM
 #5

Any Idea??'

Thanks

xcbtrader (OP)
Hero Member
*****
Offline Offline

Activity: 865
Merit: 1006


View Profile
May 31, 2017, 10:48:00 AM
 #6

It is an old post but I continue to have the same problem.
Any ideas?

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!