Photo by Jairo Alzate / Unsplash

Today we code!

devrel 24 lug 2023

As the Treasures of Shimmer campaign progresses, we have decided to gift NFTs to our participants. To automate this process, we created a script that scans the Zealy API and mints and distributes NFTs directly to the participants.

GitHub - antonionardella/shimmer-zealy-nft-dropper: Tool to monitor quests on Zealy and mint/drop NFTs to eligible accounts
Tool to monitor quests on Zealy and mint/drop NFTs to eligible accounts - GitHub - antonionardella/shimmer-zealy-nft-dropper: Tool to monitor quests on Zealy and mint/drop NFTs to eligible accounts

However, we needed to extend the tool to manually distribute NFTs to a CSV list, and I wanted to understand how building for Shimmer is on a Chromebook and Chrome OS.

Shown in this post the Linux developer environment is setup and so is Visual Studio Code. Which means we can get started right away.

Visual Studio Code and the new code

I encountered an issue when using Shimmer libraries. The wheel did not work with Python 3.9 due to an incompatible abitag.

Required version not available

I had to seek help from my colleagues on the IOTA & Shimmer Discord to figure out the problem.

Discord chat with Dr. Electron and Thoralf

Fortunately, they informed me that the issue would be fixed in the next release. In the meantime, we downloaded the iota-client wheel from Thoralf's repo and continued the work.

NFT minted and sent on the Shimmer testnet

After resolving the issue, we successfully minted an NFT to the testnet and sent it to the address

https://explorer.shimmer.network/testnet/addr/rms1zp489egrre33n0a6spgt8yvr65msq7ppg8p5uur0w7em6jrkex93ut7qzge

Now let's start testing the NFT distribution script with 2000 Shimmer testnet addresses. This required generating a large number of addresses, writing them to a CSV file, and thoroughly testing the script's functionality. With the assistance of ChatGPT, the example was successfully adapted to generate the desired number of addresses.

# Sync account with the node
response = account.sync()
print(f'Synced: {response}')
wallet.set_stronghold_password(stronghold_password)

addresses = account.generate_addresses(2000)

with open('data.csv', mode='w', newline='') as file:
    writer = csv.writer(file)
    for address in addresses:
        writer.writerow([address])

However, an obstacle was encounteres when attempting to retrieve the NFTs' quantities from the addresses. The wallet.rs implementation encountered error messages during the synchronization process.
To find a solution, I had to turn to the vibrant community on Discord, where after posting my question I received a helpful response. You can find the question and answer here:
https://iota.stackexchange.com/questions/2937/iota-wallet-common-iotawalleterror-while-synchronizing-the-account/2938#2938

After overcoming this hurdle, I triumphantly sent out 2000 NFTs to the corresponding addresses. It was a resounding success! Despite minor issues with PIP packages not installing immediately, I am relieved to know that a fix is already underway.

Reflecting on the experience, I rate it 7 out of 10.

A few learnings for our DevRel path:

  • PIP Package Support: the importance of broader support for PIP packages. Fortunately, the upcoming release addresses this issue, ensuring a smoother experience for developers
  • wallet.rs Error Handling: While working with wallet.rs, the need for improved error messages and handling is clear. Recognizing that wallet.rs may be approaching its end-of-life phase, and the team has transitioned to the more advanced iota-sdk, which offers enhanced capabilities and developer-friendly features
  • Troubleshooting the Issue: When faced with challenges, the importance of determining whether the issue lies within the library, the node, or both is clear. I forwarded this matter to our team, who are dedicated to finding a comprehensive explanation for developers and providing effective solutions

These learnings serve as valuable insights for our DevRel path, guiding the team in creating a more seamless and empowering experience for developers.

Stay tuned for more updates as we continue our exploration of the exciting world of Shimmer.

Tag