-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[Bitcoin/Rust] Add support for creating Ordinal NFT inscriptions #3297
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ld_brc20_transfer_inscription in Script.cpp
…imeType enum and use strings directly
…iption, fix CoinType import issue
@satoshiotomakan finally :) done |
satoshiotomakan
approved these changes
Jul 17, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🔥
Milerius
approved these changes
Jul 17, 2023
This was referenced Jul 17, 2023
zkrypt-crossbar
pushed a commit
to Cramiumlabs/wallet-core
that referenced
this pull request
Jun 15, 2025
…stwallet#3297) * expand comment on MIME data prefix in the construction of ordinal inscription * add NFT module * update comment on push_opcode * add test for NFT inscription * expand full list of inscription types * compare NFT inscription test data with expected values * avoid splitting expected values into individual consts, use slices directly * fix warnings * rename new_image to just new * add tw_build_nft_inscription FFI function * test tw_build_nft_inscription FFI function * test protobuf NFT inscriptions * rename ImageType to MimeType * rename TW::Rust::tw_build_brc20_inscribe_transfer to TW::Rust::tw_build_brc20_transfer_inscription in Script.cpp * bitcoin-nft-inscriptions * add Script::buildNftInscription to CXX files, include correct path to MimeType * add CXX test for SignNftInscription * add CXX test SignNftInscriptionReveal * expand C interfaces with NFT inscription construction * track TWBitcoinOrdinalsMimeType.h * add Swift tests for NFT inscription * track TWOrdMimeType.h * correctly set payload when reading from file * compare substrings * avoid var name reuse * add nft inscription hex data of image and expected output * small cleanup * replace TW::Rust::MimeType with TWOrdMimeType * pass raw integer to Rust, derived from enum variant * reverse txId for Swift tests * trigger CI * run cargo fmt * revert Podlock and update rust/coverage.stats * update wallet-core-kotlin version in kmp * clear todos * rename tw_build_nft_inscription to tw_build_ordinal_nft_inscription * remove Foundation import in Swift tests * add Ordinal prefix to Nft inscriptions where appropriate, deprecate MimeType enum and use strings directly * pass mime type as string from C++ to Rust * rename tw_build_ordinal_nft_inscription to tw_bitcoin_build_nft_inscription, fix CoinType import issue * update wallet-core-kotlin * update Pods in samples * run cargo fmt * update pods in swift/ and swift/Example * fix how mime type is passed in swift tests * pass string directly to Rust functions * undo pod changes in samples * run cargo fmt * embed image content and raw transaction in CPP file directly * embed image as raw hex in Rust * add embedded data in CPP files into separate file
zkrypt-crossbar
pushed a commit
to Cramiumlabs/wallet-core
that referenced
this pull request
Jun 21, 2025
…stwallet#3297) * expand comment on MIME data prefix in the construction of ordinal inscription * add NFT module * update comment on push_opcode * add test for NFT inscription * expand full list of inscription types * compare NFT inscription test data with expected values * avoid splitting expected values into individual consts, use slices directly * fix warnings * rename new_image to just new * add tw_build_nft_inscription FFI function * test tw_build_nft_inscription FFI function * test protobuf NFT inscriptions * rename ImageType to MimeType * rename TW::Rust::tw_build_brc20_inscribe_transfer to TW::Rust::tw_build_brc20_transfer_inscription in Script.cpp * bitcoin-nft-inscriptions * add Script::buildNftInscription to CXX files, include correct path to MimeType * add CXX test for SignNftInscription * add CXX test SignNftInscriptionReveal * expand C interfaces with NFT inscription construction * track TWBitcoinOrdinalsMimeType.h * add Swift tests for NFT inscription * track TWOrdMimeType.h * correctly set payload when reading from file * compare substrings * avoid var name reuse * add nft inscription hex data of image and expected output * small cleanup * replace TW::Rust::MimeType with TWOrdMimeType * pass raw integer to Rust, derived from enum variant * reverse txId for Swift tests * trigger CI * run cargo fmt * revert Podlock and update rust/coverage.stats * update wallet-core-kotlin version in kmp * clear todos * rename tw_build_nft_inscription to tw_build_ordinal_nft_inscription * remove Foundation import in Swift tests * add Ordinal prefix to Nft inscriptions where appropriate, deprecate MimeType enum and use strings directly * pass mime type as string from C++ to Rust * rename tw_build_ordinal_nft_inscription to tw_bitcoin_build_nft_inscription, fix CoinType import issue * update wallet-core-kotlin * update Pods in samples * run cargo fmt * update pods in swift/ and swift/Example * fix how mime type is passed in swift tests * pass string directly to Rust functions * undo pod changes in samples * run cargo fmt * embed image content and raw transaction in CPP file directly * embed image as raw hex in Rust * add embedded data in CPP files into separate file
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows you to create Ordinal NFT inscriptions, example: https://www.blockchain.com/explorer/transactions/btc/173f8350b722243d44cc8db5584de76b432eb6d0888d9e66e662db51584f44ac
Generally ready, two things to consider:
TransactionVariant
protobuf enum now has the variants:The last two can technically be combined, I propose calling it
P2ScriptPath
(P2TRKEYPATH
should be lowercased, too). But that's a breaking change afaik.EDIT: We're keeping it like this now, we're planning on writing a new interface as part of a larger task anyway.
Would be nice if someone could quickly writeDoneScript::buildNftInscription
insrc/Bitcoin.cpp
in order to expose it. Note that one has to pass on theMimeType
fromsrc/nft.rs
.EDIT: Additionally, added tests for C++ and Swift, Kotlin is WIP... having some build/dependency error (?). Will change this from Draft to Open, let the CI run.