jimmysong / programmingbitcoin

Repository for the book
Other
1.75k stars 656 forks source link

http://testnet.programmingbitcoin.com and http://mainnet.programmingbitcoin.com are down #177

Open bolatovumar opened 4 years ago

bolatovumar commented 4 years ago

http://mainnet.programmingbitcoin.com is a 404 http://testnet.programmingbitcoin.com is a 503

As a result a bunch of code examples can't be followed.

For the time being I'm using Blockstream's block explorer API like so:

def get_url(cls, testnet=False):
        if testnet:
            return 'https://blockstream.info/testnet/api/'
        else:
            return 'https://blockstream.info/api/'

And a slightly modified fetch method (notice the / before hex as opposed to .hex as it was initially:

@classmethod
    def fetch(cls, tx_id, testnet=False, fresh=False):
        if fresh or (tx_id not in cls.cache):
            url = '{}/tx/{}/hex'.format(cls.get_url(testnet), tx_id)
bolatovumar commented 4 years ago

@kevin11h yeah, it's the same issue as #151. Blockstream block explorer is good and worked for me for these exercises.

lucidprojects commented 3 years ago

is the consensus here to use blockstream.info/testnet/api/ like so?

#node = SimpleNode('testnet.programmingbitcoin.com', testnet=True, logging=False)
node = SimpleNode('https://blockstream.info/testnet/api/', testnet=True, logging=False)
bolatovumar commented 3 years ago

is the consensus here to use blockstream.info/testnet/api/ like so?

#node = SimpleNode('testnet.programmingbitcoin.com', testnet=True, logging=False)
node = SimpleNode('https://blockstream.info/testnet/api/', testnet=True, logging=False)

Yeah, that's what I did back when I was going through the book.

lucidprojects commented 3 years ago

when I change to blockstream I get a gaierror. Do I need a more specific cmd?

---------------------------------------------------------------------------
gaierror                                  Traceback (most recent call last)
<ipython-input-16-faf9611714a8> in <module>
     43 
     44 
---> 45 node = SimpleNode('https://blockstream.info/testnet/api', testnet=True, logging=False)
     46 
     47 # bf = Bloomfilter(size=30, function_count=5, tweak=90405)

~/Documents/programmingbitcoin/programmingbitcoin/code-ch12/network.py in __init__(self, host, port, testnet, logging)
    361         # connect to socket
    362         self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
--> 363         self.socket.connect((host, port))
    364         # create a stream that we can use with the rest of the library
    365         self.stream = self.socket.makefile('rb', None)

gaierror: [Errno 8] nodename nor servname provided, or not known
bolatovumar commented 3 years ago

It's been a while since I've gone through the book and I don't really know what gaierror means. I found this: https://stackoverflow.com/questions/15246088/what-does-this-socket-gaierror-mean

I would also search for the nodename nor servname provided, or not known error message to see what can be found.

amadeann commented 3 years ago

You can find currently running full nodes here: https://bitnodes.io/nodes/

Pick any with ipv4, and it should work.