Giter Club home page Giter Club logo

ordinal_inscription.netcore's Introduction

Ordinal Inscription.netcore

A simple C# .netcore library for fetching inscribed data on the bitcoin blockchain in a decentralized & censorship resistant way.

Usage

Query via local Bitcoin Core RPC

BitcoinOrdinal btcordinal = new("127.0.0.1", 8332, "<username>", "<password>");
OrdinalData ordinal = await btcordinal.QueryOrdinalData("<transaction ID>", BcDataProviderType.BitcoinCoreRPC, <optional blockId to speed up query>);
BitcoinOrdinal btcordinal = new();
OrdinalData ordinal = await btcordinal.QueryOrdinalData("<transaction ID>", BcDataProviderType.BlockchainInfo);
BitcoinOrdinal btcordinal = new();
OrdinalData ordinal = await btcordinal.QueryOrdinalData("<transaction ID>", BcDataProviderType.BlockStream);

Recursively query a random data source until one is found.

BitcoinOrdinal btcordinal = new("127.0.0.1", 8332, "<username>", "<password>");
OrdinalData ordinal = await btcordinal.QueryOrdinalData("<transaction ID>", <optional blockId to speed up query>);

Query GOAT bittorrent tracker links

BitcoinOrdinal btcordinal = new();
OrdinalData ordinal = await btcordinal.QueryOrdinalData...
GoatModel goatordinal = GoatModel.DeserializeGoatData(ordinal);

For more information on Ordinals:

https://docs.ordinals.com/introduction.html

Inscriptions inscribe sats with arbitrary content, creating bitcoin-native digital artifacts, more commonly known as NFTs. Inscriptions do not require a sidechain or separate token.

These inscribed sats can then be transferred using bitcoin transactions, sent to bitcoin addresses, and held in bitcoin UTXOs. These transactions, addresses, and UTXOs are normal bitcoin transactions, addresses, and UTXOS in all respects, with the exception that in order to send individual sats, transactions must control the order and value of inputs and outputs according to ordinal theory.

The inscription content model is that of the web. An inscription consists of a content type, also known as a MIME type, and the content itself, which is a byte string. This allows inscription content to be returned from a web server, and for creating HTML inscriptions that use and remix the content of other inscriptions.

Inscription content is entirely on-chain, stored in taproot script-path spend scripts. Taproot scripts have very few restrictions on their content, and additionally receive the witness discount, making inscription content storage relatively economical.

Since taproot script spends can only be made from existing taproot outputs, inscriptions are made using a two-phase commit/reveal procedure. First, in the commit transaction, a taproot output committing to a script containing the inscription content is created. Second, in the reveal transaction, the output created by the commit transaction is spent, revealing the inscription content on-chain.

Inscription content is serialized using data pushes within unexecuted conditionals, called "envelopes". Envelopes consist of an OP_FALSE OP_IF �c OP_ENDIF wrapping any number of data pushes. Because envelopes are effectively no-ops, they do not change the semantics of the script in which they are included, and can be combined with any other locking script.

A text inscription containing the string "Hello, world!" is serialized as follows:

OP_FALSE
OP_IF
  OP_PUSH "ord"
  OP_1
  OP_PUSH "text/plain;charset=utf-8"
  OP_0
  OP_PUSH "Hello, world!"
OP_ENDIF

First the string ord is pushed, to disambiguate inscriptions from other uses of envelopes.

OP_1 indicates that the next push contains the content type, and OP_0 indicates that subsequent data pushes contain the content itself. Multiple data pushes must be used for large inscriptions, as one of taproot's few restrictions is that individual data pushes may not be larger than 520 bytes.

The inscription content is contained within the input of a reveal transaction, and the inscription is made on the first sat of its first output. This sat can then be tracked using the familiar rules of ordinal theory, allowing it to be transferred, bought, sold, lost to fees, and recovered.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.