Bitcoin Forum
May 13, 2024, 08:43:01 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Development & Technical Discussion / Re: Bitcoin development tapscript C# seemingly unsolvable task on: May 02, 2024, 09:35:25 AM
Quote
Have you verified that your transaction creation functions are working fine for other types of transactions and that it is just the TapScript code that's causing errors?
 

Yeah I have a more complex version of each script that creates the inscription address, I send a BTC transaction to that address, then the script spends the UTXO that I sent the address. The Javascript scripts works perfectly and creates an inscription when I spend along the script path of the freshly created address. The C# script fails with a signature error when I try to spend from the script path of the freshly created address.

My C# script works fine spending along the address keypath, but not the script keypath. Looking at the output transactions from the Javacript script and C# script, I've narrowed it down to the the tapscript not being created correctly in the C# script.
2  Bitcoin / Development & Technical Discussion / Re: Bitcoin development tapscript C# seemingly unsolvable task on: May 01, 2024, 07:50:01 PM
Btw, I know that creating Bitcoin inscriptions or anything that could be considered similar to an ordinal or BRC-20 is somewhat controversial but that's not the goal here. I want to create an inscription to build an app that requires a TINY AMOUNT of "hard" storage stored in the form of an inscription. It's SUPER TINY (literally the size of a sha-256 hash) and not going to clog up Bitcoin but I just can't find anyone that can help me fix the bug in my script. Does anyone know how to make by C# script work like my Javascript script does?

Since you only want to include output of SHA-256 hash (which have size 256-bit or 32-byte), you better use OP_RETURN. I didn't do any research, but i expect there should be C# library which let you create Bitcoin TX with OP_RETURN support since OP_RETURN has been around for 10+ years.


I already know about OP_RETURN, but unfortunately I can't use it for this project. The app requires the string to be read with the ordinal envelope aka: 
Code:
OP_FALSE 
OP_IF
   OP_PUSH "ord"
   OP_PUSH 1
   OP_PUSH "text/plain;charset=utf-8"
   OP_PUSH 0
   OP_PUSH "Hello, world!"
 OP_ENDIF
 

But obviously instead of "Hello world!", it will be the SHA256 hash. I'm taking advantage of an ordinal block explorer to by giving the envelope the ordinal identifier "ord" so the SHA256 hash is picked up on the ordinal block explorer where my app can read the hash. 

Even though I am using the ordinal envelope and using an ordinal block explorer to read the data, this is not an ordinal in a traditional sense. Every user on my app will write 1 ordinal as a registering function for my app. It will not clog up the bitcoin blockchain and will not spam the bitcoin network. Gas fees will not go up because of my app, don't worry. 

So does anybody know how to fix my C# script so it works like my Javascript script does?
3  Bitcoin / Development & Technical Discussion / Bitcoin development tapscript C# seemingly unsolvable task on: May 01, 2024, 04:55:17 AM
Hi guys, I made this post on Bitcointalk a while ago:


Quote
I have a script that works perfectly in creating an inscription taproot address with Javascript https://gist.github.com/ChristianOConnor/fa07462990a74606f486f97031783e50. I committed the private key and inscription text to the code. There's nothing in the wallet so it shouldn't be a security problem. The address outputted by the script is tb1pzr0236kw9vnavfl6zjk4xvfsvptfwq2202newug2se5tsg2fmrhsa4hv7z.

Again, I've tested the javascript code including spending an inscription output and it works perfectly. I unsuccessfully tried porting the above script to C#. It doesn't produce the correct address. This is the C# script https://gist.github.com/ChristianOConnor/2399a864f38666a2a3305b9ad7d374d1 preloaded with the same private key and inscription string. It incorrectly produces this address: tb1p90cf5jsmvv2cwu7wq2k60pewtpu5xvlfypxwjeag4aq9yhaccgks68fc8j.

Can anyone fix my C# script so that it produces the correct address aka tb1pzr0236kw9vnavfl6zjk4xvfsvptfwq2202newug2se5tsg2fmrhsa4hv7z.

This would be unpaid, but if you can fix the C# script I'll open source it and MIT license the code. P.S. Could you please perpetually MIT license your fix for the C# script.



I thought it was a going to be a simple task but OMG I was wrong. I'm trying to create a Bitcoin inscription with C#. I've found libraries that can do this in Javascript and a few other languages but non in C#. I can't find an example. I made a script that ALMOST does this but I get a signature error.

Btw, I know that creating Bitcoin inscriptions or anything that could be considered similar to an ordinal or BRC-20 is somewhat controversial but that's not the goal here. I want to create an inscription to build an app that requires a TINY AMOUNT of "hard" storage stored in the form of an inscription. It's SUPER TINY (literally the size of a sha-256 hash) and not going to clog up Bitcoin but I just can't find anyone that can help me fix the bug in my script. Does anyone know how to make by C# script work like my Javascript script does?

And I don't need open time stamps. This project is different.
4  Bitcoin / Development & Technical Discussion / I need help embedding a message into a Tapscript spend on: April 12, 2024, 04:39:36 PM
I have a script that works perfectly in creating an inscription taproot address with Javascript https://gist.github.com/ChristianOConnor/fa07462990a74606f486f97031783e50. I committed the private key and inscription text to the code. There's nothing in the wallet so it shouldn't be a security problem. The address outputted by the script is tb1pzr0236kw9vnavfl6zjk4xvfsvptfwq2202newug2se5tsg2fmrhsa4hv7z.

Again, I've tested the javascript code including spending an inscription output and it works perfectly. I unsuccessfully tried porting the above script to C#. It doesn't produce the correct address. This is the C# script https://gist.github.com/ChristianOConnor/2399a864f38666a2a3305b9ad7d374d1 preloaded with the same private key and inscription string. It incorrectly produces this address: tb1p90cf5jsmvv2cwu7wq2k60pewtpu5xvlfypxwjeag4aq9yhaccgks68fc8j.

Can anyone fix my C# script so that it produces the correct address aka tb1pzr0236kw9vnavfl6zjk4xvfsvptfwq2202newug2se5tsg2fmrhsa4hv7z.

This would be unpaid, but if you can fix the C# script I'll open source it and MIT license the code. P.S. Could you please perpetually MIT license your fix for the C# script.
5  Bitcoin / Development & Technical Discussion / Re: How can taproot transactions manage to store so much data? on: April 04, 2024, 11:25:08 PM
Quote
They do.  They wrap arbitrary data in a tapscript and inject it in the witness part of the transaction. 
 

But I thought tapscripts only stored the merkle root on chain. Each one of the leafs gets collapsed down to a single hash (the merkle root) and that's the only thing that gets committed to the chain. Therefore, if you have a any data longer than a hash, it will vanish into the merkle root. 

My above explanation could be wrong so please correct me if it's wrong. 

Is that why you have to spend it in order to get the ordinal on chain? Does the committed ordinal data only exist in the proof that you provide?
6  Bitcoin / Development & Technical Discussion / Re: How can taproot transactions manage to store so much data? on: April 04, 2024, 08:06:32 PM
Quote
So, to sum up, there are many ways to make the whole system secure, without pushing everything on-chain. But users just decided to put their data anyway, even if there is no need to do so.
 

Thank you very much for your answer. I think I'm starting to wrap my head around this better... 

So when someone makes an ordinal they are not using tapscript right? They are simply writing Opcodes into the transaction just like you would with a non-taproot transaction?  If I did a typical P2PKH transaction I would put
Code:
"scriptPubKey": "OP_DUP OP_HASH160 HASH_OF_PUBKEY_IN_HEX OP_EQUALVERIFY OP_CHECKSIG"
as my locking script, but If I wanted to do an ordinal I would make my locking script
Code:
"scriptPubKey": "OP_DUP OP_HASH160 HASH_OF_PUBKEY_IN_HEX OP_EQUALVERIFY OP_CHECKSIG OP_FALSE OP_IF OP_PUSH "ord" OP_PUSH 1 OP_PUSH "text/plain;charset=utf-8" OP_PUSH 0 OP_PUSH "Hello, world!" OP_ENDIF"
? Does this mean that I could do an ordinal in a non-taproot address bitcoin transaction? So I could mint an ordinal with a P2PKH address?
7  Bitcoin / Development & Technical Discussion / How can taproot transactions manage to store so much data? on: April 04, 2024, 10:35:29 AM
I don't quite understand how ordinals are able to store so much data on chain. I know about the ordinals envelope. 

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

According to the ordinals handbook, in this example, the text "Hello, world!" is stored on chain. But I thought that the taproot upgrade simply enables people to tweak the public key to embed a merkle root on chain by tweaking the public key to create a modified address. Even then, the merkle root isn't actually stored on chain. You just have to know it to spend coins from that address right? 

I know my understanding is wrong because if all you needed to know to spend coins from the script path was the merkle root you wouldn't need to know the hash of any of the leaves. So can you guys fill in the gaps in my understanding? 

I know that bitcoin transactions have some code for scripting in the actual hexadecimal transaction. For example a simple locking script in a bitcoin transaction output looks like this "scriptPubKey": "OP_DUP OP_HASH160 HASH_OF_PUBKEY_IN_HEX OP_EQUALVERIFY OP_CHECKSIG" so to spend that transaction whoever has the private key of the address in the UTXO provides an unlocking script consisting of the signature and public key. But this is just a little bit of data that bitcoin transactions store, how does taproot allow for such larger amounts of data to be stored?
8  Bitcoin / Development & Technical Discussion / Re: I'm looking for an example of code or a tutorial that implements tapscript on: January 18, 2024, 09:52:52 PM
Quote
Check out https://www.youtube.com/watch?v=ixHVnvq4S7g, this goes step by step through the full flow from 0 to p2tr via script spending path (also helps you setup a local testnet + block explorer).

I'm doing a deep dive into this tool. It looks awesome so far. Thanks for sharing!
9  Bitcoin / Development & Technical Discussion / Re: BitIDE - TapScript IDE with Local Testnet, Explorer and Custom Op Codes (P2TR) on: January 16, 2024, 07:11:26 PM
Quote
Cleaning up the source and adding some tests, will be open sourced this week =)

Awesome! Thanks!
10  Bitcoin / Development & Technical Discussion / Re: I'm looking for an example of code or a tutorial that implements tapscript on: January 16, 2024, 09:33:34 AM
Quote

This was very helpful thanks
11  Bitcoin / Development & Technical Discussion / Re: BitIDE - TapScript IDE with Local Testnet, Explorer and Custom Op Codes (P2TR) on: January 15, 2024, 02:45:38 AM
Is BitIDE open source?
12  Bitcoin / Development & Technical Discussion / I'm looking for an example of code or a tutorial that implements tapscript on: January 15, 2024, 12:56:13 AM
I'm looking to create a Bitcoin tapscript transaction, but I can't find an example or a tutorial that demonstrates how to do this. When I was building on Ethereum it was easy because there's a lot of tutorials about how to create a custom ERC-20 or ERC-721. I understand that comparing Ethereum to Bitcoin is like comparing apples to oranges. Bitcoin is designed to be a store of value while Ethereum is a platform designed to run code.

Still though... I want to practice writing tapscript transactions on Bitcoin. Can someone provide a code example or a tutorial about how to actually create a tapscript transaction?

Just to be clear, when I say a tapscript transaction, I mean constructing a UTXO that contains a script spending path. That means a taproot transaction that contains a merkle root with a taptree where spending from this UTXO means solving a logic condition in one of the tapleafs.
13  Bitcoin / Development & Technical Discussion / I'm trying to understand the exact mechanism of a UTXO spend on: January 07, 2024, 12:12:06 AM
My understanding of a bitcoin transaction is as follows. Each UTXO (that's not a null value UTXO like an OP_RETURN), has a value, scriptPubKey (hereafter referred to as a "locking script"), and index (hereafter referred to as "n"). 

In order to spend a UTXO, you have have to supply an unlocking script which contains a signature from the address possessing the UTXO (this proves that the spender actually has the private key for the address), and the UTXO owner's public key so the signature can be verified. 

I made this diagram to show what I believe a bitcoin transaction spend to look like:  
https://imgur.com/a/titAohe

Clearly I don't grasp the entire structure of a BTC transaction as indicated by the fact that I put several "IDK"s in the diagram. Can someone fill in the gaps in my knowledge?
14  Bitcoin / Development & Technical Discussion / Re: Why can't I find any resources on how to mint ordinal NFTs via code? on: January 06, 2024, 11:47:01 PM
I would recommend to read the ordinals BIP to understand how it works:
https://github.com/ordinals/ord/blob/master/bip.mediawiki

And if you want the full tech information, you can see the docs on the main ordinals site:
https://docs.ordinals.com/introduction.html

And that site you will understand how to work with ordinals step by step, and the limits of the technology.

You mentioned the sites that make ordinal don't have their code open source, and that's because anyone can code it's own program with the current info in the docs.

And one last source of ordinal info is Bitcoin-Knowledge repo:
https://github.com/vondas-network/Bitcoin-knowledge#ordinals

Nice! Thanks for the resources! I will dig into this.
15  Bitcoin / Development & Technical Discussion / Re: Why can't I find any resources on how to mint ordinal NFTs via code? on: January 06, 2024, 11:36:49 PM
Quote
See? It is valid, and instead of 1MejoVXRvsmwyDpTpkw3VJ82NsjjT8SyEw mainnet address, you have n2Ah6YcQjuDCkLJ5YKuRKDLMEsLSPhKwWQ regtest address. And because a lot of altcoins just copy-pasted Bitcoin code, you can migrate their coinbase transactions as well.

Fascinating... I'm surprised that there's away around storing the entire blockchain history. Thanks for the post.
16  Bitcoin / Development & Technical Discussion / Re: Why can't I find any resources on how to mint ordinal NFTs via code? on: January 02, 2024, 04:26:58 AM
Quote
This is true here and now, but in the future, it can be changed. Because each time when something is sent as fees, the new coinbase transaction starts a new "chain of signatures". Which means, if you want to migrate transactions from one chain to another, then you have to follow signatures only to the nearest coinbase transaction. Because then, it could be made from original fees, or from any other fees, which means, it may be possible in the future to discard the chain of signatures, after the nearest coinbase transaction, if Ordinals or other abuse will force full node operators to do so, and to optimize some things in some future model (for example UTXO-based model).

Are you sure about this? I think the mining nodes would still have to keep an entire transaction history. Nodes that sync from the genesis block need every block to calculate/verify the hashes of every block leading up to the latest block. This requires at least some nodes to have every single block. This means that there can never be zero seeders for the entire bitcoin blockchain. Please correct me if I'm wrong. 

P.S. I looked into commitment signatures and I think this would be a great replacement for ordinals in the application that I plan on building.
17  Bitcoin / Development & Technical Discussion / Why can't I find any resources on how to mint ordinal NFTs via code? on: January 01, 2024, 10:13:45 AM
I have spent a few days now looking into how to mint ordinal NFTs. I am a hobbyist developer so I consider myself pretty tech literate and ordinal NFTs are NOT user friendly lol. What's even more concerning is that ordinal services never provide a code example. They usually make you upload an image or piece of text to a webpage, pay an invoice QR code with the lightning network, wait (a long long time), and eventually receive an ordinal NFT to a btc taproot address. This doesn't make sense. Why can't I find a script on Github and do this myself? Doesn't minting an ordinal NFT require the simple construction of an envelope transaction like: 

Code:
OP_FALSE 
OP_IF
    OP_PUSH "ord"
    OP_PUSH 1
    OP_PUSH "text/plain;charset=utf-8"
    OP_PUSH 0
    OP_PUSH "Hello, world!"
OP_ENDIF

Assigning 1 satoshi to the output, and running the command? Why has no one written out a self contained script that mints ordinal NFTs?
18  Bitcoin / Development & Technical Discussion / I'm Trying to Make A Script That Spends BTC from A Taproot (bech32m) Address on: December 28, 2023, 08:55:12 PM
I want to build an app that uses taproot addresses in C#. The problem is that I can't find any good tutorials on how to spend BTC from a taproot address in C#. I want to use NBitcoin https://github.com/MetacoSA/NBitcoin, and I am trying to build a simple C# command line app that spends btc from an address as a mvp of taproot spending functionality. I know that NBitcoin has the capacity to spend BTC from a taproot address because this exists in the tests, https://github.com/MetacoSA/NBitcoin/blob/40ca72b3e4da8baf58e6c06801cd4b0e66cb8b59/NBitcoin.Tests/sample_tests.cs#L15. So how can I build the simplest possible send btc from a taproot address console app in C#? Has anyone here ever done this?
19  Other / Meta / Do Users Own Their Posts? Is There a Compelled License for User Content? on: December 23, 2023, 09:20:16 AM
I am new to this forum. Before I start sharing code and stuff like that, if I post something (and am the original author), do I still own it? And am I still free to license that content how I choose? I ask this because I've heard of forums where the terms and conditions contains something about all posts being CC-BY-SA or GPL etc... No offense to those licenses, but personally I'm not a fan of copyleft licenses. I prefer the MIT license for open source code. 

To summarize... Do us forum users own the code we post on "https://bitcointalk.org" and if so, are we compelled to license our posts under a specific license like CC-BY-SA or GPL? 

Please provide a source if you can.
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!