Bitcoin Forum
May 04, 2024, 03:18:48 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to sign PSBT with electrum?  (Read 79 times)
8j80 (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
July 16, 2021, 10:56:28 PM
 #1

So I've been trying for 4 days straight to sign a PSBT transaction using software wallets like electrum but upon all my research i failed so i'm seeking for your help.

I'm using a payment gateway that generates the psbt i only provide the address, the gateway is named BTCPay Server https://btcpayserver.org/ these are the steps they provide:
 
•A PSBT gets constructed with certain inputs and outputs, but no signatures
•The exported PSBT can be imported by a wallet that supports this format
•The transaction data can be inspected and signed using the wallet
•The signed PSBT file gets exported from the wallet and imported with BTCPay Server
•BTCPay Server produces the final Bitcoin transaction
•You verify the result and broadcast it to the network


If you didn't understood i get a psbt generated [encoded/decoded] that has my address as an output and i need to sign it. [i do not have access to the input]
After signing it, i need to upload the psbt again and they will sign the transaction and broadcast it.
It can have multiple inputs or just one.

From the psbt generated i get the following json data: https://pastebin.com/ybj10hJM
I uploaded it to pastebin to dont make this thread a mess, and replaced data/hashes with dots because im not aware if i expose anything that i shouldnt.

I'm struggling at the signing part so far i tried the following things:
-Importing the psbt to electrum and attempting to sign it directly [No success, the sign button is greyed out image: https://i.imgur.com/AgykV1V.png
-Tried signing the transaction through the electrum console with the following commands `signtransaction('txid')` and `signtransaction_with_privkey('txid', 'privatekey')` both commands get the following error:
electrum.transaction.SerializationError: Failed to recognise tx encoding, or to parse transaction.
However if i use `signtransaction_with_privkey()` with the encoded psbt insead of the txid i get another psbt but it is still not signed.
-I attempted to use bitcoin core but still failed.
-I tried using https://www.coinb.in/#newTransaction and import the data provided from the psbt but still no success.
-Tried different versions of electrum.
-Tried signing it offline and online.

If anyone offers some help that lead the solving of the problem i will offer a tip.

Thanks for your time & patience!
Activity + Trust + Earned Merit == The Most Recognized Users on Bitcointalk
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Abdussamad
Legendary
*
Offline Offline

Activity: 3612
Merit: 1564



View Profile
July 16, 2021, 11:47:15 PM
Merited by hugeblack (1)
 #2

you sign using the private key behind the inputs not the output address. if you don't have the private key behind the input address you can't sign the transaction.

o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18509


View Profile
July 17, 2021, 03:29:52 PM
Merited by hugeblack (1)
 #3

If you didn't understood i get a psbt generated [encoded/decoded] that has my address as an output and i need to sign it. [i do not have access to the input]
Then you cannot sign it.

The output address(es) do not sign the transaction. A transaction must be signed by the private key associated with the input address(es). If you do not have access to these private keys, then you cannot sign the transaction.

-Importing the psbt to electrum and attempting to sign it directly [No success, the sign button is greyed out image:
You can't just import a PSBT in to any wallet and sign it. You need to import it in to a wallet containing the private keys which generated the addresses used in the inputs. As above, without those private keys, you cannot sign the transaction.

You'll need to figure out where the input addresses are coming from and where the private keys to these addresses are stored. Once you have access to the private key, then you can import them in to Electrum and sign your PSBT.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!