Skip to content

spicehq/spice-bacalhau-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo scripts for generating an NFT collage using Bacalhau

Overview

The general process to generate the collage is

  • Get a list of ipfs uris from the target contract
  • Run a bacalhau job to get image links from the metadata files
  • Run a bacalhau job to generate the collage from the image files

Notes:

script.py should be added to IPFS so it can be run in the bacalhau job (ipfs add script.py). The resulting CID can then be mounted in the container and run

Currently there's a good_uris.pkl containing a list of ipfs uris from vitalik.eth's wallet. The good_tokens.pkl contains a list of (token_address, token_id) tuples that are tokens that have metadata on IPFS. This list could be used to filter tokens before calling the tokenUri method in real time

The generate_volume_args script/function can be used to generate a string with multiple -v IPFS_CID:filename arguments that can be added to the bacalhau job. This function also uses the public ipfs gateway to get file cids when the URI found on chain or in metadata is of the form DIRECTORY_CID/filename. This allows the individual file to be mounted to the job instead of the whole ipfs directory (slow)

This script can be used directly when triggering the bacalhau job like

Parse Metadata

bacalhau docker run $(cat ./bacalhau_vol_args.txt) -v QmWNd38rXz9W87oK8hi1p7CcbTZauJ6h6sd4jipZj6wjQy:/script.py jonahyakoa/bacalhau-demo -- python /script.py parse_metadata

Create Collage

bacalhau docker run $(cat ./bacalhau_vol_args.txt) -v QmWNd38rXz9W87oK8hi1p7CcbTZauJ6h6sd4jipZj6wjQy:/script.py jonahyakoa/bacalhau-demo -- python /script.py create_collage

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages