Bitcoin Forum
July 31, 2024, 09:49:12 PM *
News: Help 1Dq create 15th anniversary forum artwork.
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Urgent help Finding scriptPubKey for a transaction without bitcoincore  (Read 580 times)
ocelot^ (OP)
Newbie
*
Offline Offline

Activity: 72
Merit: 0


View Profile
July 16, 2016, 04:21:18 PM
 #1

Hi guys, I am having an issue sending bitcoin from a multisig address I made.

Before I begin, two caveats:
1. I am using raw transactions which I'm hand crafting .
2. I do not have access to a bitcoincore with blocks downloaded on it.

As I understand it I need to have the scriptPubKey for the transaction which paid into the multisig address and which I want to pay from.

Now when I send a transaction from electrum to the multisig address I can get a copy of the transaction from electrum which I can run "bitcoin-cli decoderawtransaction" on and get the scriptPublicKey so I am able to send those transactions from the multisig address no problem.

My issue arises when someone else sends my multisig address some coins, how do I get the scriptPubKey (or raw transaction in hex) for that transaction so I can redeem the coins.

I've looked all over google for a service that provides this and I've turned up nothing so I'm asking here.

Thanks for the help.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3472
Merit: 6793


Just writing some code


View Profile WWW
July 16, 2016, 04:51:16 PM
Last edit: July 16, 2016, 05:04:34 PM by knightdk
 #2

You can get the raw hex of a transaction by going to blockchain.info and appending ?format=hex to the URL for the transaction. You can also go to blockcypher, look up the transaction, and click on the button for "api call" under the Advanced details section. This will give you JSON for the transaction and under the outputs section is the script for the output in hex.


In Electrum, you can go to the console and type
Code:
gettransaction("<txid>")
where <txid> is the txid. This will give you the raw hex of the transaction.

Then you can take that hex and type
Code:
deserialize("<hex>"
which will give you the decoded version of the transaction. You can chain the two commands together by doing
Code:
deserialize(gettransaction("<txid>"))
and get the decoded transaction from the txid.

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!