Back to All Episodes
Season 3Episode 108

Intro to Bitcoin Ordinals with Hiro

March 30, 2024
32m
1 Guest

Listen Now

About This Episode

In this episode of DevNTell, Narb welcomes Ryan Waits from Hiro to provide an introduction to Bitcoin Ordinals. Ryan, a developer advocate with a strong engineering background in the Ethereum and Bitcoin/Stacks ecosystems, explains the difference between ordinals (a numbering system for individual satoshis) and inscriptions (the data or digital assets attached to those satoshis). He highlights the challenges of building on Ordinals, such as data integrity during blockchain re-orgs and managing vast amounts of data. To address these issues, Ryan introduces several Hiro tools, including the Ordinals Explorer, the Ordinals API, and Ordhook, a powerful client indexer that extracts and streams inscription information from Bitcoin nodes. The episode includes demos of these tools and discusses the practical uses of Ordinals, like NFTs and BRC-20 tokens, ending with a call to explore Hiro's documentation and join their community for further learning and support.

Key Takeaways

1

Ordinals uniquely identify individual satoshis, while inscriptions are the actual data (images, text, code) permanently attached to them.

2

Building on Ordinals is challenging due to data integrity issues from blockchain re-orgs, the sheer volume of data, and the fact that Bitcoin was not originally designed for this.

3

Hiro's Ordinals Explorer and API simplify data access and filtering for developers and users.

4

Ordhook is a sophisticated tool for indexing Bitcoin nodes, allowing for the scanning and streaming of inscription information.

5

Recursive inscriptions provide a creative workaround for Bitcoin's block data limits by allowing one inscription to reference others.

Featured Guest

RW

Ryan Waits

DevRel @ Hiro

Hiro

Episode Transcript

Narb

GM, GM everybody, welcome to what's going to be another great DevNTell here. So, if you didn't know, DevNTell is a 30-minute window for builders to showcase something that they're passionate about or have been building on Web3. This is going to be an awesome project you've been working on, unit testing best practices, automation goodies, smart contracts, etc., etc. Basically, if you've got a passion for something, this is your opportunity to share it with the community here at Developer DAO. And today I'm excited to have Ryan from Hiro on the show. Welcome Ryan!

Ryan Waits

Hey, yeah, I'm good, I'm unmuted, I didn't know if I needed to do that. Thanks for having me, Narb. Appreciate it.

Narb

My pleasure, my pleasure. Ryan's going to be talking, or giving us a whole overview of building with Bitcoin Ordinals. So, if you're interested in learning on how to get started with that, this is the show for you. But before we get into that, Ryan, would you like to give a brief introduction about yourself just in case folks aren't familiar?

Ryan Waits

Yeah, so I'm Ryan, like Narb said, I'm the developer advocate at Hiro. I've been in the crypto space since around 2018. Excuse me. I've been an engineer for almost 10 years now. I started in the Ethereum space initially, and then I moved to the Bitcoin and Stacks ecosystem around like 2020-21 or so with the launch of Stacks 2.0. So yeah, that's pretty much my background.

Narb

Cool. And I guess what was that transition like, going from the Ethereum space to the Bitcoin space? Was it, had you started completely brand new from zero or were there transitional skills there?

Ryan Waits

There were elements. So if anyone's unfamiliar with Stacks, the smart contract language Clarity is a bit different than Solidity. And so there was a little bit of a barrier there for about like a few weeks or so or about a month. But all the other sort of basic concepts that you learn just in crypto itself pretty much translate fairly well.

Narb

Excellent, excellent, great to hear. I guess in the interest of time, do you want to get going with the content here?

Ryan Waits

Yeah sure, I'm ready when you are.

Narb

All right, I will bring your slides up on the screen there.

Ryan Waits

Cool. Ready? Let's do it. All right. So yeah, obviously as you can see by the giant words on the slide here, we're going to be walking through an intro on Ordinals. What they are, what are inscriptions, what exactly is the distinction between those two, what are some of the challenges around Bitcoin Ordinals and building on those, on that protocol, and also go over a few of tools that we've built at Hiro that make building on this new protocol a lot easier than without them. And so, and I'll also at the end we have three tools that we'll go over and I'll share my screen and run through a couple high-level demos of those tools. And so yeah, without further ado I guess we can run to the next slide, Narb.

Ryan Waits

Cool. Okay. So yeah, Ordinals. So what exactly are they? Essentially Ordinals represent a new and novel application on Bitcoin that at its core introduces the ability to use Bitcoin for more than just financial transactions. And so what does that actually mean, like in practice? So essentially what Ordinals introduced or unlocked was the ability to transform a satoshi, which is the smallest unit of a Bitcoin, into something that can store arbitrary data. And so this really unlocked Bitcoin to not only just serve as a digital currency, but also as a platform for say hosting a variety of digital assets and information. And so, oh yeah no, stay on that slide. So basically like a bunch of use cases have been unlocked, I.E. you know NFTs on Bitcoin, decentralized identity, just storing arbitrary metadata, document verification, I mean pretty much you know you name it. And so oftentimes in the space you sort of kind of gear towards defining the terms a bit more. You see Ordinals and inscriptions are often used interchangeably. And so for clarity's sake, you know when we're talking about Ordinals, we're referring to a way to uniquely identify each individual satoshi using a sequential number.

Ryan Waits

And this numbering allows each satoshi to be differentiated from every other. And then you know when we're speaking about inscriptions, these are like the actual digital assets or data, arbitrary data inscribed onto these individual satoshis via the Ordinals method or protocol, if that makes sense. And so these include things like images, text, even small pieces of code. I know I was working on a project a few months back and noticed that like jQuery and React, like the actual like programming languages, have just been inscribed on Bitcoin. So you can actually like pull those into your projects and it's like coming from Bitcoin, which is pretty interesting. So anyway, yeah, so the inscription process embeds this data into a Bitcoin transaction, associating it permanently with a specific satoshi. And one really big unlock for all of this ultimately was the Taproot upgrade on the Bitcoin network, which introduced more complex smart contract capabilities and improved the efficiency which allowed something like this Ordinals protocol to exist in the first place. And so, yeah, so okay, so we talked about sort of what are Ordinals and inscriptions. Those are the definitions in terms, but what I guess exactly is the distinction between Ordinals and inscriptions?

Ryan Waits

The distinction really lies in their functionality. So Ordinals, like I said previously, refer to the unique sort of identification and numbering system for satoshis, essentially providing a way to individualize each unit of Bitcoin. Inscriptions on the other hand are the actual content itself or data attached to these uniquely identified satoshis. And so they represent the utilization of the Ordinals concept, if you will, to embed or store information directly on the Bitcoin blockchain. And so maybe like a summary or like a more simple way to put it, like if you think of each satoshi, which is like unit of Bitcoin, as like a blank page, the Ordinals would represent the page numbers on that page, and the inscriptions would be like the actual text, image, or content that is put onto those pages. So that's like the clear distinction between those two terms that we hear used interchangeably. Kind of drives me nuts because it confused me for a while, so I had to like dive in like, what is the difference between those two? But yeah. But anyway, yeah, so now looks like you're on the right slide here. Okay, so building on Ordinals obviously has a few challenges. I've broken these into like three main categories. The first is essentially data integrity.

Ryan Waits

So blockchains as you know they re-org. And so transactions that were considered confirmed can suddenly become unconfirmed or discarded if they were part of the orphan block. And if you're trying to utilize or build an indexer, ideally you'd be able to detect these events and accurately revert any changes made based on you know these orphan blocks, ensuring the integrity and accuracy of its data. The second, if you go to the next slide, there's just a lot of data on the blockchain and not all of it's necessarily important to your use case as an application developer. And so you know if I'm to be the most effective in you know building my application, I need as little context switching and information overload as possible.

Ryan Waits

And so the process of you know managing and extracting you know this relevant data, especially in regards to Ordinals and all the new meta protocols that we'll talk about shortly that are being deployed, you know I would need something that synthesizes and filters that data for me in an easily consumable way. And then lastly if you go to the next piece, thank you, you know Bitcoin's obviously primary design was centered around enabling peer-to-peer transactions of a digital currency. So there was no real consideration I guess from like a design perspective, there was no real consideration on how to natively recognize or manage you know these distinct identities for each satoshi, which Ordinals protocol does.

Ryan Waits

Or you know for that matter support the embedding of rich data directly into the blockchain aside from you know simple transactional information. And so being able to operate and interact on top of the existing Bitcoin infrastructure and you know leverage the flexibility within certain parts of Bitcoin transactions is more of a creative process rather than like a feature designed into the protocol itself. So that can be super challenging to try and build off of that because there's no, you're kind of just winging it in a lot of ways. And so yeah you can hop over to the next slide. And of course tada you know we have all the solutions for that now. We have we have a few really good tools that do provide a lot of key solutions for the challenges that we just went over. And so these tools were were built and designed to to obviously alleviate a lot of the pain points or challenges.

Ryan Waits

To the point that we you know we don't just build and advocate for these these tools and others to use them, we actually you know we dog food and use these tools ourselves. For instance you know the Stacks Explorer is powered by the Ordinals API, we use Ordhook to actually insert and I guess manage our data that goes into our API. So yeah, I guess we'll do a quick I guess I'll do a quick little overview of each one of those projects. So the Explorer is pretty straightforward, it's a web UI that that users can go to. It uses our API like I said just to explore the data that's being inscribed on the Ordinals protocol. Yeah, like I said, it has pretty much what you would expect an explorer to have if you're already familiar with them from other ecosystems. It does have a lot of nice filtering tools that we'll go over for like displaying inscriptions by data type whether it's like video, images, text. And in addition it's also open source so you can pull that front-end code down and tinker around with it, kind of figure out how things work, how it connects to our API and even spin up an instance of yourself. We actually have some docs that help you do that yourself if you wanted to make any modifications to it yourself. And so the Ordinals API, so that exposes a lot of the, you know what you expect, the most common data that you'd want to retrieve from the Ordinals protocol such as just inscriptions themselves, the content from those inscriptions, transfer information for those inscriptions, and even some of the meta protocol stuff that I mentioned, BRC-20, you get some information around those. But yeah we'll demo some API calls here in a minute from our docs page to give you a good idea of how that works. And then lastly here is Ordhook. So this is our, this is our client indexer. This is probably the most advanced tool we have for Ordinals. It's what's actually you know connecting to a Bitcoin node and extracting inscription information based on the Ordinals protocol conventions to then serve that information up to the Ordinals API or even to you know create a custom indexer for BRC-20 or some other meta protocol like you know SNS which is like SATs, SATs name service, similar to ENS or BNS on Stacks.

Ryan Waits

And so yeah, those are our tools. And then I think I think the next slide is just diving into, I guess we have some questions here. What are differentiations? So Ordinals so Runes is I to that's that's a good question. So, I think it as far as I know it implements it implements like the the ordinal like binary code, but it's a complete it's not ordinal or inscription related, it's a completely different concept. And so what impact will Nakamoto fork have on Ordinals? None. Nakamoto is a is a Stacks-related upgrade. And so very little. Anyway, yeah, great. Let me let me unshare. Well I guess you're sharing on the slide screen, I can do it I can do this sharing on my side. Yeah, go ahead.

Narb

Those are great questions Nikitas. And gang, if you have any other questions please post them in the chat and I will bring them up as we go along here. All right. Just waiting on the screen share. All right. Cool. Good? Yep. All right. And so yeah, so here's our explorer. Let me go ahead and the front page basically just you know gives you your latest inscriptions. Looks like some people are inscribing, this was this image or an image similar to this was actually the first ordinal that was inscribed. So yeah, you can search by the inscription ID, you can actually search by block. Let me see if I can grab a block number here. Yeah, so you see here you can actually go into a block and you'll see a collection of inscriptions for that block that have been inscribed.

Ryan Waits

And then we'll take a look at this hamburger one here. And so yeah, each individual inscription you got all the metadata, all the properties that belong to it right here and it's pretty pretty pretty clean explorer. You have these tabs up here in the corner, inscriptions. This is where you can do a lot of like your cool filtering. You could filter just only by images. Yeah, everybody something going on here with this this image. You can do video. And then some of the the meta protocol stuff, so here's BRC-20. So this is you got this sort of text up here, it's it's kind of like a it's a protocol, it's obviously trying to not use the words protocol to describe it, but it's just a set of rules and conventions that it's pure just consensus level where you know you say this this is kind of the rules of this particular token. So it's very similar to like ERC-20, 720 I mean. And so yeah, people are minting and transferring and basically building tokens aside from Bitcoin on the Bitcoin main chain here.

Ryan Waits

And so here's our, and do you have a I guess I can Narb I can share some links here that I think is probably pretty important for people if they want to take a look at some code on the explorers and stuff. Let me bring that back up. Sure. And looks like there's a couple more questions in here. Oh yeah, the bridging speed. Yeah, of course yeah, that yeah, anything to do with if you're if you're talking about interacting with Stacks at any level with bridging to inscriptions, yeah it'll be ultimately much faster. Five-second blocks is the is the expected time for Stacks blocks. Oh yeah there is a max length. It's not necessarily like a max length, it's just a max it's a data limit. It's the same data limit that Bitcoin blocks have. I just I don't know that off the top of my head. But yeah there are limits. But there are creative ways to getting around it. You have you have like recursive inscriptions. So you have so you can like inscribe data that references other inscriptions. And so if you have a large amount of data that you want to inscribe ultimately onto onto Bitcoin, you can do it by referencing you know related inscriptions with the max amounts. And so like that's how like things like jQuery, React, and like bodies of code that are much, you know that would exceed that limit, you're able to do it through like recursion, recursive inscriptions.

Narb

Great questions gang. All right, that's Ordhook, and then yeah we have that, and then let's go to our docs. And so here we have here's the Ordinals API API reference page. Let me go ahead and send this in the group too.

Ryan Waits

Great. So yeah so you'll see here for inscriptions, you know you can get a list of inscriptions, like I said you can get transfers for those inscriptions per block, you can grab specific inscription here. All right let's go ahead and just try and do that. Let's go ahead and grab this guy. We'll grab the ID. And we can actually do this inline on our docs page. Go ahead and pass that in and execute, and there you go. Get back a bunch of information and they actually have recursive and recursive references that get returned in the responses in the API.

Narb

And sorry I may have missed but do you need a API key to be able to interact with this or?

Ryan Waits

You don't, but there but you can go and use the the platform that we have. Hiro.so. This is another cloud IDE tool that we have and you'll see here at the top banner, create API key. So if you start running into like any kind of limits for your use case, you can go ahead and generate one of these API keys and use it.

Narb

Excellent. And then Nikitas asks, the genesis fee, is that in SATs?

Ryan Waits

Yes, yeah, all SATs.

Ryan Waits

Did I send did I send in the yeah cool great. And then yeah let me see if I can share my whole screen now. I kind of wanted to run through a quick little example of of Ordhook. Let me go ahead and send the repo first and then I'll unshare my screen and then share it back here in a minute. Got it. Can you see the whole screen now? No, I don't believe you shared yet. Not yet? No. I had an issue with this last oh now don't do this to me again goodness. Looks like I'm getting some permission stuff here. Hold on. All good. If not I can I can run through our readme in the docs. Not the first time we've had technical difficulties on the show. Yeah right, I know. We're supposed to be evolved in tech and we can't even, well I guess I can just share let me see if I can just share the the terminal itself. Sure.

Ryan Waits

Still nothing? Oh no. It's telling me to restart Chrome. Okay. All right, well let me share the we'll go back here. Sure. We'll go back to the browser. Can't trust Google, yeah. Indeed. Okay. All right so you see the screen now? Great. All right let's see, oh man we been we been doing some updating. Yeah this this looks good. Okay looks like it's in a good spot. So yeah, so there's I would say there's probably like three categories of of how to use Ordhook. The first is just scanning blocks in your terminal. So first you obviously you install the the binary, you install Ordhook, and you can scan through a range of blocks. So this code here, let me see if everyone can see that right here.

Ryan Waits

It'll just output the inscription ID and some other like information about that inscription just straight into your terminal. And so it's like kind of it's kind of a good idea to use it for excuse me like just any kind of testing or if you're expecting to see something in a particular block you can run that and see if everything kind of aligns with what you expect to get back. And there's a couple you can use blocks, you can actually scan the inscription itself, that'll actually return the inscription information plus any transfers that are associated to it. And then the the next thing that you can do is streaming. And so this the difference between scanning and streaming is essentially you can stream it to another application for instance. So like this is really one of the main use cases. So if you did want to like actually activate and use Ordhook and say hey I want to build like a custom indexer for SATs name. What you would do is you would set up this Ordhook config mainnet and you would set it up to you know if there's particular like intervals of blocks or whatnot that you wanted to scan to it but you would stream that information to an API endpoint. So like here you see this localhost 3000, it would send a payload of the same information that you were getting inside of your terminal with the scan and then you'd be able to do whatever you needed to do with that information for your particular use case in your back end, if that makes sense.

Ryan Waits

And then in addition to streaming, so like that basically that process is hey go from block A to block Z and stream it here to this place in this case like a back end or you can even append it into like a local file. The third use case is okay do that same thing but keep listening for inscriptions. So don't just stop in between the ranges of blocks that I've specified, like do that and then continue to listen for more inscriptions coming in so that I can run my you know custom code back end to like you know go and extract and filter out what I need to and build my application. And so yeah and so that's those are sort of the three those are essentially the three main concepts of of how to how to leverage Ordhook.

Narb

Have you seen any interesting developments, people building with Ordhooks that you can speak of or mention, just to give examples for folks who might be wanting to play around with this over the weekend here?

Ryan Waits

I mean the the most obvious is the BRC-20 endpoints that we have in our in our hosted Ordinals API. That was leveraged and used using our own Ordhook tool to be able to filter out inscriptions and basically go and find the right rules and understandings of what this BRC-20 meta protocol requires and be able to put that information into a database and provide a hosted API for BRC-20. And that could be done for any meta protocol.

Narb

Interesting, interesting. Nikitas has another question here, where does Clarity's Turing incompleteness fit in with inscriptions? If any?

Ryan Waits

Yeah no it it doesn't. So inscriptions are purely L1 things. So it's it's aside from what Nikitas mentioned with like bridging, you know whether it's bridging an asset from Stacks and you know trying to figure out how to like inscribed the the metadata of like an NFT or some sort of asset on the L1, aside from that like connection, they're pretty much isolated sort of concepts, Ordinals and inscriptions from Clarity and Stacks.

Narb

Great answer and great question. I guess since we're coming up on time here and we have a nice long weekend, at least in North America coming up, what's the what would you suggest for people who are watching this today and they want to get started building with Ordinals? What would be the the best way for them to start? And where should they start?

Ryan Waits

The the best would be to go to our documentation and send the just sort of the I've sent some like specific links there. I'll send just sort of the the main root docs page and it has essentially all the all the links to our to our repos, the readmes are up to date with information if you're trying to dive deeper and if there's no guides that sort of like you know tackle specific issue that you're trying to unlock, but through the docs and through our repos and readmes is the best place to start.

Narb

Awesome. And I guess to follow up on that is if people have questions after they start doing that, is there a way they can get support? Can they reach out to you directly or is there a Discord or or some sort of group they can join?

Ryan Waits

Yeah absolutely. So there is a a Discord, the the Stacks Discord. We have a few channels dedicated to Ordinals-related tooling. But really any of the channels, there's a there's a I think the API channel we deal with Ordinals API and you know Stacks blockchain API stuff. But if you don't have the link for the for the Discord stuff I can get that to you, we all know the Discord links are challenging so make sure I get the right ones. And also we are beginning to hold not sort of tentative, we will be holding like an office hours and it could range from you know anything Stacks-related and Ordinals-related that I will also be a part of. And so this will also be inside of the Stacks Discord and so anyone is welcome to hop on on there. I think it's Mondays, but don't hold me to that, I can get that information to you to be to be specific. And I do have a Calendly if you just want to set up like a sort of private little you know office hour with me, I'm happy to answer any questions.

Narb

Excellent. There you go folks. Ryan and the folks at Hiro are making themselves available to you, so definitely if you're interested get playing around and if you get stuck they have folks that are there to help you get unstuck. And with that unfortunately we are at time, but Ryan thank you so much for taking the time today to come on and give us that awesome overview regardless of the technical issues we may have had, we got through them. So yeah.

Ryan Waits

I appreciate it. Thanks for hanging in there with me.

Narb

My pleasure, my pleasure. And folks, before you leave, I'd like to share with you the QR code here for you to scan to be able to claim your NFT for being a attendee today on DevNTell. So what you want to do is grab your regular QR code scanner on your phone, scan this code, fill out the form, and you'll be airdropped a NFT on the Base network from the folks at DeForm over the next handful of days. So you'll want to grab your QR code scanner, scan this, fill out the form, and you'll be airdropped that NFT in your wallets within a couple days. And you'll have a hour and a half from now to be able to fill out that form before it closes. And with that just want to wish everybody a very happy Friday, a happy weekend, happy long weekend if you have a long weekend, and that will catch you all back here next week for another episode. Right-o! Have a good one! My pleasure! Bye!

Ryan Waits

Thanks Narb, thanks y'all! See ya! Peace!

Listen On

Share This Episode

Share on X

Watch Episodes Live!

Subscribe to our event calendar and never miss a live episode.

View Event Calendar