dev-support icon indicating copy to clipboard operation
dev-support copied to clipboard

How can I indicate an input in PSBT by using inscription info?

Open 0xVolar opened this issue 1 year ago • 7 comments

I want to create a PSBT by using inscription's info.I know how to create a simple PSBT.It requires a input by using txID.And I find inscription has the id too.Is this id same to txID? Or I need to fill in some other information as input?I have no idea with that.

0xVolar avatar Apr 01 '24 12:04 0xVolar

The inscriptions are contained within the inputs of a reveal transaction. In order to uniquely identify them they are assigned an ID of the form:

521f8eccffa4c41a3a7728dd012ea5a4a02feed81f41159231251ecf1e5c79dai0

The part in front of the i is the transaction ID (txid) of the reveal transaction. The number after the i defines the index (starting at 0) of new inscriptions being inscribed in the reveal transaction.

here is the document link: https://docs.ordinals.com/inscriptions.html

abangZ avatar Apr 02 '24 04:04 abangZ

https://docs.unisat.io/dev/unisat-developer-service/general/inscriptions/get-inscription-info

this api can get the inscription detail.

abangZ avatar Apr 02 '24 04:04 abangZ

So,I can use this apihttps://docs.unisat.io/dev/unisat-developer-service/general/addresses/get-inscription-utxoto get the utxo as the input of PSBT?

0xVolar avatar Apr 02 '24 12:04 0xVolar

So,I can use this apihttps://docs.unisat.io/dev/unisat-developer-service/general/addresses/get-inscription-utxoto get the utxo as the input of PSBT?

yes

abangZ avatar Apr 03 '24 02:04 abangZ

What should I do if I have A signed PSBT A and I want to use the signed input in A as the input for PSBT in the new PSBT B?

const tx = psbtA.extractTransaction();

psbtB.addInput({
        hash: tx.ins[0].hash,
        index: tx.ins[0].index,
    });

and I get this "Can't find pubkey in input without Utxo data" when I use signPsbt. What can I do to solve this question?

0xVolar avatar Apr 07 '24 09:04 0xVolar

If I include both inscriptions and btc in a PSBT, then there is a risk when signing PSBT, so how do I solve this problem and distinguish between inscriptions and btc?

0xVolar avatar Apr 07 '24 15:04 0xVolar

What should I do if I have A signed PSBT A and I want to use the signed input in A as the input for PSBT in the new PSBT B?

const tx = psbtA.extractTransaction();

psbtB.addInput({
        hash: tx.ins[0].hash,
        index: tx.ins[0].index,
    });

and I get this "Can't find pubkey in input without Utxo data" when I use signPsbt. What can I do to solve this question?

I think you are intending to use the output of transaction A as the input for transaction B. In that case, you should do it like this: const txid = tx.getId(); The hash is the txid, and vout is the number of the output you want to reference.

xhyhh0 avatar Jun 14 '24 06:06 xhyhh0