Inspiration
Content has been inscribed on the Bitcoin blockchain throughout its history, and has been re-popularized in recent years with the advent of ordinal inscriptions; however, there isn't a great way to search thru this massive archive.
What it does
Ordinals Archive is a search index for data stored on chain. It provides a unified search for data in coinbase script signature fields, op return outputs, and ordinal inscriptions. A search bar is provided for full text search, as well as controls for searching by mime type (e.g. text, image, audio, video), block range, and more.
When a user clicks on a search result, they are brought to its "context" page, where another view of the content is shown, as well as further details. A bitcoin QR code is present, allowing for user tips, as well as an editor that may allow for contributions of additional context in the future.
Finally, the context page links to the block where the content is found, which brings the user to a page where the block data is shown in its raw form, unifying a rudimentary block explorer with an ordinal (and other content) explorer.
How it's built it
The backend is mostly Python, utilizing the Django web framework and a PostgreSQL database. Management commands are used to download the raw block data from mempool.space, search for and parse the embedded content, and store it to the database. In this step, a copy of the binary and deserialized JSON block data is stored on Storj, an S3-compatible decentralized storage network. The frontend was built primarily with simple HTML, CSS, and Javascript, but also leverages Tailwind, HTMX, and React. HTMX is used for the infinite scroll of the search results, sending the search query, and updating the window url. React was used for the block range slider widget, and quill was used for the WYSIWYG editor. Several SVG icons were designed in Figma and from scratch, including the block, moon, and triangle icons. A few other icons were brought in with fontawesome and otherwise. Clicking the moon icon toggles dark mode, featuring an HTML canvas with a stars effect made with Javascript.
Challenges
The database model design is a critical aspect of this application for delivering timely search results and a good UX, and this proved to be quite challenging given the amount of data involved. Building the model to be intuitive, effective, and quickly searchable was an iterative process. Various methods were used, such as, adding additional database indexes, as well as, flattening table data. Improving upon these and developing other database optimizations will be crucial for the project moving forward. Additionally, other tools, such as elastic search, might be necessary, as more sophisticated search queries are implemented. Another challenge was being able to correctly parse ordinal inscriptions. Many inscriptions have been parsed successfully, but there are known errors, and inscription numbering is not yet implemented.
Accomplishments
- Achieving a sleek, aesthetic, mobile-first UI
- Parsing inscriptions and implementing full text search
- Initial prototype of context editor and tip modal
- Actual deployment using decentralized and scalable technologies
Lessons Learned
- The database schema could be more efficient. The current schema reflects a lot of different datatypes that are important to Bitcoin, and links them via foreign keys, but this is not efficient for search. A leaner, flattened data model might provide an enormous speed-up.
- Ordinals protocol and witness parsing - Some of the errors that were encountered while parsing inscriptions, are likely due to parsing the witness stack incorrectly. The current implementation scans thru the bytes, searching for protocol tags and data. Instead, the full taproot stack evaluation should be implemented, so that it handle edge cases properly and avoids errors
What's next
Short term goals include:
- Enhancing search functionality and performance
- Enhancing user interface and providing more features
- Implementing user and contributor model
- Improving block explorer
A more detailed list of planned work and other issues can be found on GitHub: https://github.com/jtraub91/ordinalsarchive/issues
Built With
- apache
- babel
- bitcoin
- css
- digitalocean
- django
- font-awesome
- html
- htmx
- javascript
- npm
- postgresql
- python
- quill
- react
- s3
- storj
- tailwind
- webpack
Log in or sign up for Devpost to join the conversation.