Skip to content

Conversation

lamafab
Copy link
Contributor

@lamafab lamafab commented Jul 7, 2023

This PR allows you to create Ordinal NFT inscriptions, example: https://www.blockchain.com/explorer/transactions/btc/173f8350b722243d44cc8db5584de76b432eb6d0888d9e66e662db51584f44ac

Generally ready, two things to consider:

  1. The TransactionVariant protobuf enum now has the variants:
enum TransactionVariant {
    P2PKH = 0;
    P2WPKH = 1;
    P2TRKEYPATH = 2;
    BRC20TRANSFER = 3;
    NFTINSCRIPTION = 4;
}

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.

  1. Would be nice if someone could quickly write Script::buildNftInscription in src/Bitcoin.cpp in order to expose it. Note that one has to pass on the MimeType from src/nft.rs. Done

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.

lamafab added 30 commits July 5, 2023 18:00
@lamafab
Copy link
Contributor Author

lamafab commented Jul 13, 2023

@satoshiotomakan finally :) done

Copy link
Collaborator

@satoshiotomakan satoshiotomakan left a comment

Choose a reason for hiding this comment

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

LGTM 🔥

@lamafab lamafab merged commit 53c1b1d into master Jul 17, 2023
@lamafab lamafab deleted the bitcoin-nft-inscriptions branch July 17, 2023 15:24
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants