Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: fturco on April 15, 2014, 10:30:22 AM



Title: Problems with the linearize.py script
Post by: fturco on April 15, 2014, 10:30:22 AM
Hello. I'm a new forum user, but have been using Bitcoin itself for a few months. I read here (https://bitcointalk.org/index.php?topic=145386.0) that I can obtain the bootstrap.dat file via Bittorrent, but since I already downloaded the blockchain data via Bitcoin-Qt I guess it's better to generate the file with the linearize.py script and then seed it. But I get the following error when running it:

Code:
Traceback (most recent call last):
  File "./linearize.py", line 130, in <module>
    get_blocks(settings)
  File "./linearize.py", line 79, in get_blocks
    data = getblock(rpc, settings, height)
  File "./linearize.py", line 66, in getblock
    hash = rpc.getblockhash(n)
  File "./linearize.py", line 63, in getblockhash
    return self.rpc('getblockhash', [index])
  File "./linearize.py", line 41, in rpc
    'Content-type' : 'application/json' })
  File "/usr/lib/python2.7/httplib.py", line 973, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1007, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 969, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 829, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 791, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 772, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 571, in create_connection
    raise err
socket.error: [Errno 111] Connection refused

I don't know Python so I can't understand what's wrong. I just edited the max_height variable in example-linearize.cfg before running the script:

Code:
# bitcoind RPC settings
rpcuser=someuser
rpcpassword=somepassword
host=127.0.0.1
port=8332

# bootstrap.dat settings
netmagic=f9beb4d9
max_height=295000
output=bootstrap.dat


Title: Re: Problems with the linearize.py script
Post by: grue on April 15, 2014, 04:08:55 PM
it should be pretty obvious
Quote
socket.error: [Errno 111] Connection refused

it probably means you don't have server=1 in bitcoin.conf (since you're running bitcoin-qt rather than bitcoind)


Title: Re: Problems with the linearize.py script
Post by: fturco on April 15, 2014, 04:40:10 PM
I don't have a bitcoin.conf file in my home directory. I also don't understand what linearize.py is trying to connect to, as the blockchain data is on my hard disk. Should I run bitcoind instead of Bitcoin-Qt? Sorry but I'm quite confused...


Title: Re: Problems with the linearize.py script
Post by: grue on April 15, 2014, 04:57:24 PM
linearize.py gets blockchain data from bitcoin core using JSON-RPC calls. it does not read it from disk.


Title: Re: Problems with the linearize.py script
Post by: fturco on April 16, 2014, 09:33:18 AM
I finally managed to obtain the bootstrap.dat file. I had to:

  • create bitcoin.conf with server=1
  • set rpcuser/rpcpassword variables in both bitcoin.conf and linearize.cfg
  • set max_height=295000 in linearize.cfg
  • restart Bitcoin-Qt
  • run linearize.py

Thank you for the help.


Title: Re: Problems with the linearize.py script
Post by: deepceleron on April 16, 2014, 10:19:59 AM
If you want to download another copy of the blockchain through the Bitcoin network (which can be from another local bitcoin of yours), you can use https://github.com/jgarzik/pynode. It is a Python standalone Bitcoin node with limited functions. It has a script, mkbootstrap.py, which will also generate the torrent file.