CryptoPunks Harvester Using Python

What are NFT's?

NFTs, or Non-Fungible Tokens, are a type of digital asset that represents ownership or proof of authenticity of a unique item or piece of content using blockchain technology. Unlike cryptocurrencies such as Bitcoin or Ethereum, which are fungible and can be exchanged on a one-to-one basis (1 BTC is always equal to 1 BTC), NFTs are non-fungible, meaning each NFT has distinct characteristics that make it unique and irreplaceable. In this guide we are going to be collecting CryptoPunks.

What are CryptoPunks?

CryptoPunks are one of the earliest and most iconic examples of NFTs (Non-Fungible Tokens). They are a collection of 10,000 unique, algorithmically generated 24×24 pixel art characters, each with its own distinct attributes and traits. These attributes include various combinations of hairstyles, accessories, facial expressions, and more. CryptoPunks were created by software developers Matt Hall and John Watkinson and released in June 2017 on the Ethereum blockchain.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Intelligence Gathering

I opened my browser and found the CryptoPunks website and then tried https://www.larvalabs.com/cryptopunks/cryptopunk0.png It worked I had found the first in the collection. I then worked my way up in large intervals to see how many there were. I went all the way to cryptopunk9999.png.

So, I established there are 10000 CryptoPunks NFT’s. I then realized I probably could have just found this information if I asked Google LOL but where is the fun in that.

Writing the Python Scraper Script

The code short and simple, take a good look and make sure you understand what it is doing. Each time through the loop it adds +1 to the cPunk variable, this way it will continue to grab the next image with every loop.

The Code:
import requests
import shutil
## Set up the image URL and filename
cPunk=0
while bucket <= 9999:
    image_url = "https://www.larvalabs.com/cryptopunks/cryptopunk"+str(cPunk)+".png"
    filename = image_url.split("/")[-1]
    r = requests.get(image_url, stream = True)
    if r.status_code == 200:
        r.raw.decode_content = True
        with open(filename,'wb') as f:
            shutil.copyfileobj(r.raw, f)
        print('Image sucessfully Downloaded: ',filename)
    else:
        print('Image Couldn\'t be retreived')
    cPunk=cPunk+1

Using a basic Python web scraper script, I was able to grab the first 40 CryptoPunks before getting the “Too Many Requests” Error 429 warning. It wouldn’t even let me access their main page. Hopefully this didn’t get flagged as a Denial-Of-Service attack. This can be avoided if you add a simple time delay in-between each image grab.

Conclusion

This was a fun experiment, but I was a little concerned about the 429 Error being flagged as a denial-of-service attack as I wasn’t using a VPN while scraping the site. If you wish to try this yourself, add a time delay to the code, and use a VPN to protect yourself. Lastly, I should add, these are just images and not the real NFT, they are worthless.

Happy Hacking!

Recommendation:

The Elegoo Super Starter Kit

If you don’t already own any Arduino hardware, we highly recommend this kit as it has everything you need to start programming with Arduino. You can find out more about this kit, including a list of its components here: Elegoo Super Starter Kit

You can find this kit on Amazon here: Elegoo Super Starter Kit

Luke Barber

Hello, fellow tech enthusiasts! I'm Luke, a passionate learner and explorer in the vast realms of technology. Welcome to my digital space where I share the insights and adventures gained from my journey into the fascinating worlds of Arduino, Python, Linux, Ethical Hacking, and beyond. Armed with qualifications including CompTIA A+, Sec+, Cisco CCNA, Unix/Linux and Bash Shell Scripting, JavaScript Application Programming, Python Programming and Ethical Hacking, I thrive in the ever-evolving landscape of coding, computers, and networks. As a tech enthusiast, I'm on a mission to simplify the complexities of technology through my blogs, offering a glimpse into the marvels of Arduino, Python, Linux, and Ethical Hacking techniques. Whether you're a fellow coder or a curious mind, I invite you to join me on this journey of continuous learning and discovery.

Leave a Reply

Your email address will not be published. Required fields are marked *

Verified by MonsterInsights