Git Product home page Git Product logo

Comments (13)

cmdruid avatar cmdruid commented on July 28, 2024

The problem is that for sig2, you are using the tapkey to sign, however the tapkey is a tweaked public key from Tap.getPubKey, and you need the tweaked private key in order to sign.

There should also be a Tap.getSecKey which you can use to get the tweaked private key, and you should be able to use that to produce a proper sig2.

Let me know if that change fixes the issue.

The API isn't very clear in this regard, so I apologize. I'm hoping to make V2 of the library even simpler to use.

from tapscript.

skyrover7 avatar skyrover7 commented on July 28, 2024

@cmdruid thanks for the quick response! I just tried that but still facing the same issue. does the whole process make sense in context of the ordinal provenance docs? I think the relevant instructions are in the screenshot below. i believe i have correctly added the script tag 3, but think I am having issues with the spending the parent in input of the child.

image

So far I have

  • created an inscription with this same code/approach without the parent code i recently added. Inscription here: https://testnet.ordinals.com/inscription/e13f106578fe0955b375cfb66e4a212fd794b7168a7da5873fada2b78c47e035i0
  • setup a testnet wallet on the address where the parent inscription is held and using the secret key hardcoded in the child inscriber
  • added the 3 script tag to the script with the txid of the parent serialized according to the ordinals docs (i believe)
  • added the parent txid as an input to the new child inscription
  • added a second signature to try and sign the transaction

from tapscript.

cmdruid avatar cmdruid commented on July 28, 2024

I'm not clear how the child tx is supposed to be formatted in order to spend the parent.

Do you have a link to a pair of example transactions that perform a successful child inscription? That would help clarify how this should be formatted.

from tapscript.

skyrover7 avatar skyrover7 commented on July 28, 2024

here is a child

parent

from tapscript.

cmdruid avatar cmdruid commented on July 28, 2024

Looking at the transactions that you linked, the example inscriptions do not seem to be following the documentation.

  • I see the '03' being pushed, along with the 32-byte txid.
  • I do not see a 4 byte index being pushed.
  • There's also a '05' being pushed, with an additional blob of data. I'm not sure what that is supposed to be.
  • The parent also has these attributes in the script. So is the example parent also a child to another inscription?

In any case, the second input doesn't seem to be anything important to the spec, it looks like just an input being used for fees and change. So that input should just be a simple P2TR key-spend of the selected utxo being used for fees.

from tapscript.

skyrover7 avatar skyrover7 commented on July 28, 2024

thanks @cmdruid

image

from tapscript.

cmdruid avatar cmdruid commented on July 28, 2024
  • Is the second input not the Spend the parent P in one of the inputs of T. part of the spec? Can you elaborate on So that input should just be a simple P2TR key-spend of the selected utxo being used for fees

From my understanding, only one input is handing the inscriptions stuff, so it is both spending the parent and minting the child. All the inscription related stuff should be in that tx input.

Any additional inputs are merely adding funds to the tx, and are not relevant to the inscription protocol. You can use any utxo for that, it doesn't even need to be P2TR actually.

from tapscript.

rohitkeshav27 avatar rohitkeshav27 commented on July 28, 2024

@skyrover7
Did you find a way inscribing the child inscription using Parent?

Even I was trying do the same thing , seeing your code
I think I have a suggestion

the var=endian you are using happens to be a wrong value (i guess)

//Pass the inscription id to the below function
function convertHexString(hexString) {
  // Reverse the hexadecimal string
  const reversedHexString = hexString
    .match(/.{2}/g) // Split string into pairs
    .reverse() // Reverse the order
    .join("");

  // Convert reversed hex string to a byte array
  const byteArray = [];
  for (let i = 0; i < reversedHexString.length; i += 2) {
    byteArray.push(parseInt(reversedHexString.substr(i, 2), 16));
  }

  // Convert byte array to hexadecimal string with '0x' prefix
  const formattedHex = "0x" + Buffer.from(byteArray).toString("hex");

  return formattedHex;
}

Try using the above helper function to convert
and let me know , if it worked

Coz I need your help after this !!

from tapscript.

skyrover7 avatar skyrover7 commented on July 28, 2024

@rohitkeshav27 nope, still no luck

i believe the endian value is correct. I am using the below function and am able to make an inscription with the delegate ID. the delegate ID and parent ID need to be serialized the same way. I have confirmed that the below code is creating the correct endian value and is recognised as a valid delegate ID. Here is an inscription with valid delegate ID using the below code for ID conversion https://ordinals.com/inscription/20bd89f9f9b29314f7995286c18a80386d245efc1f03aa76e07feb81bf1748a8i0

my trouble is still on signing the transaction, hoping @cmdruid can shine some light 🙏🏾

export function convertInscriptionId(inscriptionId) {
    // Extract the TXID from the inscription ID
    const txid = inscriptionId.slice(0, 64);

    // Extract the INDEX value following the 'i' after the TXID
    const indexPart = inscriptionId.slice(65); // Assuming the index always follows 'i' after the TXID
    const index = parseInt(indexPart, 10);

    // Reverse the bytes of the TXID
    const reversedTxid = txid.match(/.{2}/g).reverse().join('');

    // Convert the INDEX to a 4-byte little-endian format
    const littleEndianIndexBuffer = Buffer.alloc(4);
    littleEndianIndexBuffer.writeUInt32LE(index);

    // Concatenate and return the result
    let result = reversedTxid + littleEndianIndexBuffer.toString('hex');

    // Omit trailing zeros
    result = result.replace(/0+$/, '');

    return result;
}

from tapscript.

cmdruid avatar cmdruid commented on July 28, 2024

Do you have updated code for signing the transaction?

Your previous example was using the tapkey to sign the second input, which was incorrect. It should be the secret key that signs for that second utxo.

from tapscript.

rohitkeshav27 avatar rohitkeshav27 commented on July 28, 2024

@skyrover7
I had a doubt in your code
you are spending the parent inscription in input
But you are not creating an appropriate output , does this mean your parent inscription is spent ( lost)

and
2nd input is a taproot address , so the witness passed also shd be like the first input
There is something missing !!

rohitkeshav
the above is my discord username - we could connect and work this together ( coz even I have an urgent need to complete this )

from tapscript.

skyrover7 avatar skyrover7 commented on July 28, 2024

@rohitkeshav27 sent you a fr on discord

from tapscript.

cmdruid avatar cmdruid commented on July 28, 2024

I am closing this for now. Feel free to reopen this issue if you still need help.

from tapscript.

Related Issues (20)

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.