Chromia
Start Building

10 / 15Module 2: Running the data pipelineAdvanced

Store vectors on the blockchain

This lesson walks you through uploading vector embeddings and complete movie metadata to your Chromia chain. Once the upload finishes, you can search the data on-chain with semantic queries.

Run the script

From the python/ folder, run this command:

bash
python upload_vectors.py

The script does three things:

  • Reads the input from data/movie_vectors.jsonl
  • Calls the add_movie operation to send movie vectors and metadata to the blockchain in batches
  • Prints a progress update for each movie it uploads

How it works?

Movies go up in batches of 50 by default. Batching keeps transactions efficient and avoids overloading the chain.

Every movie is uploaded through one blockchain operation that carries:

  • The vector embedding derived from the movie's plot
  • The complete metadata, including title, release date, box office earnings, and other fields

For each batch, the script signs the transaction and submits it to your Chromia chain.

Retry logic

When a batch upload fails, the script retries it automatically, up to 5 times. The wait between attempts grows exponentially (2s, 4s, 8s, and so on), which helps it recover from network problems and transient transaction failures.

Output and confirmation

While the script runs, the terminal shows a live count of the movies uploaded so far.

When it finishes, your on-chain database contains the full dataset and is ready for semantic search.

What’s next?

The next module has you run real queries against the chain and explore what on-chain semantic search can do.

Written for this site from Chromia’s public course. Code samples are the course’s own.