Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive endpoint for retrieving details about an inscription #2628

Merged
merged 22 commits into from
Feb 21, 2024

Conversation

lifofifoX
Copy link
Collaborator

This should be useful for a variety of use cases.

src/subcommand/server.rs Outdated Show resolved Hide resolved
@elocremarc
Copy link
Contributor

elocremarc commented Nov 3, 2023

We should add sat and output I have been wanting these forever.
Sat
Output

We should add output so we can eventually do a output recursive endpoint. This would have tons of uses. You could do dynamic content like a website that you can update based on coin control. Having an inscription aware of what output its on is how you would do start this.

Address would also play into cool stuff combined with output it gets us close to be able to port over openordex and make an inscription be a PSBT marketplace of itself.

Other more whimsical uses of output is an inscription that changes as it moves.

Sat would also play super well when combined with child and the sat recursive endpoint.

@lifofifoX
Copy link
Collaborator Author

I wanted to keep the response as minimal as possible, as we can always add stuff. But probably never remove. Happy to add whatever we want, if there's consensus. Output sounds good to me!

Re: sat, I think that'd require sat index, no? That's why I didn't add it.

@elocremarc
Copy link
Contributor

elocremarc commented Nov 3, 2023

Re: sat, I think that'd require sat index, no? That's why I didn't add it.

Yeah but were already crossing that bridge with sat endpoint. So it would return null probably if no sat index.
Also this would be super powerful with the child endpoint to then go into that with the sat endpoint.

@elocremarc
Copy link
Contributor

if there's consensus. Output sounds good to me!

@rot13maxi and I were talking on the sat endpoint spaces the other day about how we really want to get to the point where we can start making crazy cool inscriptions that get us closer to calling data on the bitcoin node. Been wanting to see if we can get openordex onto an inscription since it came out. Knowing an inscriptions output is invaluable for this kinda stuff.

@lifofifoX
Copy link
Collaborator Author

I'll work on adding output to JSON.

Still not convinced about sat. My gut feeling is that we should refrain from adding recursive endpoints that rely on a full sat index. The risk is creating two classes of inscriptions, especially as the index grows larger and slower with every block.

We can achieve most of the things with /children recursive endpoint that would be made possible with sat endpoint. Agree that sat endpoint would make it much easier as there are no sit ups involved in figuring out the inscription id. But it also comes at a cost and maybe something we can punt on in favor of /children.

@owenstrevor
Copy link

owenstrevor commented Nov 4, 2023

Would be awesome to add the Sat Endpoint. IMO the Sat Endpoint is the most important endpoint for Ordinals right now. With the Sat Endpoint, you can futureproof your collection so that you can access all of the endpoints that come out in the future, and then you can lock down your work by burning the sat. This would probably also give the devs some breathing room from people wanting stuff right away because they can just add the Sat Endpoint and then get the endpoint they need when it's fully ready.

@lifofifoX
Copy link
Collaborator Author

I'm curious to know what thing is possible with sat endpoint that's not possible with a children endpoint?

@lifofifoX lifofifoX force-pushed the inscription-recursive-endpoint branch from 471f20f to 048bc33 Compare November 4, 2023 03:30
@lifofifoX
Copy link
Collaborator Author

@elocremarc Added satpoint to response JSON.

@lifofifoX lifofifoX force-pushed the inscription-recursive-endpoint branch from 048bc33 to 6f3292e Compare November 4, 2023 03:55
@elocremarc
Copy link
Contributor

elocremarc commented Nov 5, 2023

I'm curious to know what thing is possible with sat endpoint that's not possible with a children endpoint?

Sat is more controlled by creator and child can be collector basically. However you could make the sat endpoint work for a collector if you reference the sat that an inscription is being inscribed to. With sat you can know what the sat is prior to inscribing. However if you want to know the sat in some future child its good to have it here in this endpoint because it might not be known ahead of time.

Also you might not always want to reinscribe a sat and might want this ability in a child instead.

Copy link
Collaborator

@casey casey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there! See comments.

src/subcommand/server.rs Outdated Show resolved Hide resolved
src/subcommand/server.rs Outdated Show resolved Hide resolved
src/subcommand/server.rs Outdated Show resolved Hide resolved
src/subcommand/server.rs Outdated Show resolved Hide resolved
src/subcommand/server.rs Outdated Show resolved Hide resolved
src/subcommand/server.rs Outdated Show resolved Hide resolved
src/subcommand/server.rs Outdated Show resolved Hide resolved
src/subcommand/server.rs Outdated Show resolved Hide resolved
src/templates/inscription.rs Outdated Show resolved Hide resolved
src/templates/inscription.rs Outdated Show resolved Hide resolved
@elocremarc
Copy link
Contributor

@casey don't we wanna add the sat number in this endpoint? This is very useful combined with the child endpoint or doing the sat endpoint on children you might not know the sat number for prior to inscribing like with batch inscriptions.

@lifofifoX
Copy link
Collaborator Author

@elocremarc @casey I am planning to work on this again this week. Let me know and I can add whatever other keys to JSON.

@elocremarc
Copy link
Contributor

Been making some onchain inscription viewers I think having parent would also be super helpful here. Then you can traverse up and down the family tree.
example: if you are on some inscription then you can see the siblings with the /children endpoint. Or find the ancestor.

Let me know and I can add whatever other keys to JSON.

My vote adding the sat_number and parent to the JSON

@owenstrevor
Copy link

owenstrevor commented Jan 14, 2024

@casey don't we wanna add the sat number in this endpoint? This is very useful combined with the child endpoint or doing the sat endpoint on children you might not know the sat number for prior to inscribing like with batch inscriptions.

YES PLEASE. Right now we have to inscribe the sat number itself, either in the individual inscription metadata or in a separate "lookup table" inscription afterwards. The former is not really possible with bulk inscriptions without more customization to ord. Both are hacky solutions where truth is what the dev wrote and not Bitcoin. Essential for our "holder-permissioned" sat endpoint upgrade model: https://ninjalerts.gitbook.io/bitcoin-ordinals-pizza-ninjas/upgradability

* master: (175 commits)
  Inscribe with delegate (ordinals#3021)
  Add blocks and transaction JSON endpoints (ordinals#3004)
  Use --name instead of --wallet in README (ordinals#3010)
  Hide BVM Network inscriptions (ordinals#3012)
  Add option to retain sat index for spent outputs (ordinals#2999)
  Don't use browser sniffing when serving favicon (ordinals#3003)
  Add minimal Dockerfile (ordinals#2786)
  Cache less aggressively (ordinals#3002)
  Add `indexed` to output JSON (ordinals#2971)
  Remove dead link from README (ordinals#3000)
  Add crate to audit content security policy (ordinals#2993)
  Optimize get_inscription_ids_by_sat_paginated (ordinals#2996)
  Suppress empty command output (ordinals#2995)
  Add recipe to deploy to all servers in fleet (ordinals#2992)
  Release 0.15.0 (ordinals#2989)
  Fix Project Board link (ordinals#2991)
  Make `FundRawTransactionOptions ` public (ordinals#2938)
  Use enums for runestone tags and flags (ordinals#2956)
  Update server names in justfile (ordinals#2954)
  Update delegate.md (ordinals#2976)
  ...
@raphjaph
Copy link
Collaborator

raphjaph commented Jan 23, 2024

Is this ready for review? @devords

@lifofifoX
Copy link
Collaborator Author

@raphjaph Going to working on the requested changes today!

* master:
  Dump and restore wallet from descriptors (ordinals#3048)
  Forbid destinations in same-sat mode (ordinals#3038)
  Enable JSON API by default (ordinals#3047)
  Exclude unnecessary docs (ordinals#3043)
  Add documentation for reinscriptions (ordinals#2963)
  Better wallet error messages (ordinals#3041)
  Remove uneccessary allocations in Inscription Script Creation (ordinals#3039)
  Test fee-spent inscription numbering (ordinals#3032)
  Break deploy recipes into multiple lines (ordinals#3026)
  Make wallet communicate with index via RPC (ordinals#2929)
  Use untyped table API to get table info (ordinals#2747)
@lifofifoX
Copy link
Collaborator Author

@raphjaph I think I addressed all of the comments, except address one.

  • Added charms and output
  • Made sat optional

Still holding out some hope for including address. It'll unlock so many use cases! I am curious if there's some way without having to compromise on address reuse. Maybe the address could be hashed?

* master:
  Use a flag to indicate a mint (ordinals#3068)
  Add dry run to send, print Outgoing and PSBT (ordinals#3063)
  Make invariant message more concise (ordinals#3029)
  Add /runes/balances (ordinals#2978)
@raphjaph
Copy link
Collaborator

raphjaph commented Feb 2, 2024

What use cases does address unlock?

@lifofifoX
Copy link
Collaborator Author

@raphjaph The primary one I'm interested in is using address for randomization seed for generative art, where rarity would be tied to an address. Moving inscription to a new address would generate a new output. But moving it back to the previous address would then generate the output you had before.

Additionally, you can also do soulbound'esq inscriptions where the inscription behaves different when it's held by a specific owner.

@lifofifoX
Copy link
Collaborator Author

@raphjaph Removed the address

@ZedZeroth
Copy link

@devords Thank you for raising this. I've been thinking about such endpoints since mid-2023 and how much this kind of self-data would benefit the inscription ecosystem. I didn't realise that it was already in progress until @gmart7t2 pointed me here. I would like inscriptions be able to reference their own:

  1. Inscription ID
  2. Sat number
  3. UTXO location
  4. Address location
  5. Metadata

It looks as though some of these are being pushed through soon? Could you clarify which ones are currently looking likely to be included and then I may respond with some arguments for including the others? :)

@ZedZeroth
Copy link

@raphjaph The primary one I'm interested in is using address for randomization seed for generative art, where rarity would be tied to an address. Moving inscription to a new address would generate a new output. But moving it back to the previous address would then generate the output you had before.

Additionally, you can also do soulbound'esq inscriptions where the inscription behaves different when it's held by a specific owner.

Yes 100% this!

@ZedZeroth
Copy link

@raphjaph I think I addressed all of the comments, except address one.

* Added charms and output

* Made sat optional

Still holding out some hope for including address. It'll unlock so many use cases! I am curious if there's some way without having to compromise on address reuse. Maybe the address could be hashed?

Is this just a general "reusing bitcoin addresses is bad" argument, or is there something more specific to ordinals/inscriptions? Thanks

@ep150de
Copy link

ep150de commented Feb 20, 2024 via email

@jerryfane
Copy link
Contributor

Address is cool to implement some onchain subscription mechanism

Copy link
Collaborator

@casey casey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Collaborator

@casey casey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Collaborator

@raphjaph raphjaph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go!

@casey casey enabled auto-merge (squash) February 21, 2024 03:40
@casey casey merged commit 3eb92cd into ordinals:master Feb 21, 2024
6 checks passed
@lifofifoX
Copy link
Collaborator Author

This will be a fun one! Thank you @casey and @raphjaph 🙏

@ZedZeroth
Copy link

Thanks for this. I think I am going to map out what inscriptions can currently access, and what they can't, and then push for "full inter-ordinal operability" where possible. It looks like a sat/inscription's current address is the only major one missing though? I have some further ideas but they may be more technically challenging/prohibitive to include. Huge progress with this has been made in the last six months though, it's fantastic for building :)

thedoublejay pushed a commit to sadoprotocol/ord that referenced this pull request Mar 12, 2024
* Add recipe to deploy to all servers in fleet (ordinals#2992)

* Suppress empty command output (ordinals#2995)

* Optimize get_inscription_ids_by_sat_paginated (ordinals#2996)

* Add crate to audit content security policy (ordinals#2993)

* Remove dead link from README (ordinals#3000)

* Add `indexed` to output JSON (ordinals#2971)

* Cache less aggressively (ordinals#3002)

* Add minimal Dockerfile (ordinals#2786)

* Don't use browser sniffing when serving favicon (ordinals#3003)

* Add option to retain sat index for spent outputs (ordinals#2999)

* Hide BVM Network inscriptions (ordinals#3012)

* Use --name instead of --wallet in README (ordinals#3010)

* Add blocks and transaction JSON endpoints (ordinals#3004)

* Inscribe with delegate (ordinals#3021)

* Use untyped table API to get table info (ordinals#2747)

* Make wallet communicate with index via RPC (ordinals#2929)

* Break deploy recipes into multiple lines (ordinals#3026)

* Test fee-spent inscription numbering (ordinals#3032)

* Remove uneccessary allocations in Inscription Script Creation (ordinals#3039)

* Better wallet error messages (ordinals#3041)

* Add documentation for reinscriptions (ordinals#2963)

* Exclude unnecessary docs (ordinals#3043)

* Enable JSON API by default (ordinals#3047)

* Forbid destinations in same-sat mode (ordinals#3038)

* Dump and restore wallet from descriptors (ordinals#3048)

* Add /runes/balances (ordinals#2978)

* Make invariant message more concise (ordinals#3029)

* Add dry run to send, print Outgoing and PSBT (ordinals#3063)

* Use a flag to indicate a mint (ordinals#3068)

* Move SatPoint into library (ordinals#3077)

* [ordinals] Bump version: 0.0.1 → 0.0.2 (ordinals#3078)

* Use min instead of clamp (ordinals#3081)

* Make clippy stop complaining about insane repair callback (ordinals#3104)

* Remove index parameter from index_block (ordinals#3088)

* Allow specifying satpoint in `same-sat` batch inscribe (ordinals#3100)

* Show reinscriptions in `ord wallet inscriptions` (ordinals#3101)

* Move sat and friends into ordinals crate (ordinals#3079)

* fix naming (ordinals#3112)

* Return signed PSBT from `ord wallet send` (ordinals#3093)

* Add /r/blockinfo endpoint (ordinals#3075)

* Import multiple descriptors at a time (ordinals#3091)

* Add `satpoints` batch inscribe mode (ordinals#3115)

* Allow inscribing AVIF images (ordinals#3123)

* Fix spelling mistake in bip.mediawiki (ordinals#3118)

* Only allow mnemonic from stdin (ordinals#3023)

* Emit inscription update events to channel (ordinals#3137)

* Make Options public (ordinals#3138)

* Use `image-rendering: auto` when downscaling images (ordinals#3144)

* Add `ord env` to spin up a test bitcoin daemon and ord server (ordinals#3146)

* Display inscription content type counts on /status (ordinals#3127)

* Add optional HTTP authentication for server (ordinals#3131)

* Make wallet async (ordinals#3142)

* Add `/r/inscription` endpoint for getting inscription details (ordinals#2628)

* Use `image-rendering: auto` for AVIF inscriptions (ordinals#3148)

* Make `ord env` more user friendly (ordinals#3153)

* Move JSON structs into api module (ordinals#3167)

* Display parent above metadata on /inscription (ordinals#3160)

* Represent rune IDs as `BLOCK:TX` (ordinals#3165)

* Add parent preview to inscription page (ordinals#3163)

* Update inscription sat documentation (ordinals#3114)

* Fix lints (ordinals#3124)

* Remove unnecessary lifetime from Formatter (ordinals#3178)

* Print PSBT for dry run inscribe (ordinals#3116)

* Update docs to reflect wallet changes (ordinals#3179)

* Improve configuration (ordinals#3156)

* Document `ord env` (ordinals#3180)

* Install openssl in docker image (ordinals#3181)

* Release 0.16.0-rc0 (ordinals#3182)

* Refactor test server to use arguments (ordinals#3183)

* Update ordinals crate (ordinals#3184)

* Release 0.16.0-rc1 (ordinals#3185)

* Allow configuring interval between commits to index (ordinals#3186)

* Credit contributors in changelog (ordinals#3187)

* Make deploys noninteractive (ordinals#3189)

* Make nop and burn tags one byte (ordinals#3207)

* Encode claims as tag (ordinals#3206)

* Add content proxy (ordinals#3216)

* Add reinscribe option to batch file (ordinals#3220)

* Check for duplicate satpoints in `satpoints` mode (ordinals#3221)

* Overhaul settings (ordinals#3188)

* Rename index_envelopes to index_inscriptions (ordinals#3233)

* Test that runes can be minted with no edict (ordinals#3231)

* Add libssl-dev to ubuntu install command (ordinals#3235)

* Enable indexing runes on mainnet (ordinals#3236)

* Document `ord wallet restore` (ordinals#3237)

* Load config from default data dir and configure `ord env ` using config (ordinals#3240)

* Document `ord env` commands (ordinals#3241)

* Fix list numbering in handbook (ordinals#3248)

* Display initial sync time on status page (ordinals#3250)

* Create tempdir in download-log recipe (ordinals#3242)

* Don't consider unconfirmed UTXOs as spent (ordinals#3255)

* Reserve inscription tag 15 (ordinals#3256)

* Rename genesis fee to inscription fee (ordinals#3257)

* Add more fields to /r/blockinfo (ordinals#3260)

* Add `id` inscription recursive JSON (ordinals#3258)

* Document recursive endpoint backwards compatibility guarantees (ordinals#3265)

* Release 0.16.0 (ordinals#3264)

- Bump version: 0.16.0-rc1 → 0.16.0
- Update changelog
- Update changelog contributor credits
- Update dependencies

* Bump ordinals version: 0.0.3 → 0.0.4 (ordinals#3267)

---------

Co-authored-by: Casey Rodarmor <casey@rodarmor.com>
Co-authored-by: oxSaturn <oxSaturn@proton.me>
Co-authored-by: raph <raphjaph@protonmail.com>
Co-authored-by: Robert Clarke <robert@rjfc.net>
Co-authored-by: Davirain <davirain.yin@gmail.com>
Co-authored-by: Jeremy Rubin <jeremy.l.rubin@gmail.com>
Co-authored-by: mj10021 <jamesthespeedy@gmail.com>
Co-authored-by: zhiqiangxu <652732310@qq.com>
Co-authored-by: 0xLugon <lugon@alphatrue.com>
Co-authored-by: Jerry the Martian <38183696+jerryfane@users.noreply.github.com>
Co-authored-by: HarveyV <34950940+HarveyV@users.noreply.github.com>
Co-authored-by: Michael Yu <michael@magiceden.io>
Co-authored-by: lifofifo <134870335+devords@users.noreply.github.com>
Co-authored-by: Eloc <42568538+elocremarc@users.noreply.github.com>
Co-authored-by: Sitt Guruvanich <aekazitt@gmail.com>
Co-authored-by: bingryan <41174435+bingryan@users.noreply.github.com>
Co-authored-by: Andrew <47720952+andrewhong5297@users.noreply.github.com>
Co-authored-by: Arik <arik-so@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants