How to resolve blockchain DNS using Python Requests?

0 votes

There are certain blockchain domains that are resolved only by blockchain dns resolvers.

For ex: http://Jstash.bazar

If you try to open this link in a browser, it wont get resolved.

But, just install the browser plugin from https://blockchain-dns.info/ and then try to open the site again, it will open up smoothly.

I want to scrap some data from this site using Python Requests (browserless) and have no idea as to how to resolve such blockchain domains. Any help would be highly appreciated.

Aug 17, 2018 in Blockchain by sabby
• 4,050 points
145 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You could use one of their publicly available apis to resolve the domain and obtain an ip. You'll find a list of api urls in the Firefox or Chrome addon script, in common.js.
A python example,

import requests
from random import choice

def domain_ip(domain):
    '''Uses bdns api to resolve domain names'''
    domain = domain.split('/')[2] if '://' in domain else domain
    apis = ['https://bdns.co/r/', 'https://bdns.us/r/', 'https://bdns.bz/r/']
    api = choice(apis)
    r = requests.get(api+domain)
    if r.status_code == 200:
        ip = r.text.splitlines()[0]
        print("Domain: {}  IP: {}".format(domain, ip))
        return ip
    else:
        print('HTTP Error: {}'.format(r.status_code))

ip = domain_ip('http://jstash.bazar')
if ip:
    r = requests.get('http://'+ip)
answered Aug 20, 2018 by Omkar
• 65,810 points

Related Questions In Blockchain

0 votes
1 answer

How to resolve Blockchain DNS using Python Requests?

Look at this example: import requests from random import ...READ MORE

answered Aug 21, 2018 in Blockchain by Christine
• 15,790 points
27 views
0 votes
1 answer

How to interact with blockchain using Java web app?

You can interact with the blockchain using ...READ MORE

answered Jul 16, 2018 in Blockchain by digger
• 27,620 points
103 views
0 votes
1 answer

How to build a non-payment application using Ethereum blockchain?

I hope the following link is helpful ...READ MORE

answered Jul 17, 2018 in Blockchain by digger
• 27,620 points
22 views
0 votes
1 answer
0 votes
1 answer

Python request module for bitcoin json rpc

This should work: #!/usr/bin/env python import getpass import json import requests ...READ MORE

answered Aug 28, 2018 in Blockchain by digger
• 27,620 points
131 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
60 views
+1 vote
1 answer
0 votes
1 answer

How to change "gasLimit" on Azure private blockchain?

Before deploying your network on Azure you ...READ MORE

answered Jul 3, 2018 in Blockchain by Omkar
• 65,810 points
51 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.