Bitcoin Forum
May 10, 2024, 03:02:15 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Is there a relatively painless way to get a transaction's input(s)?  (Read 940 times)
Satosh¡ Slot (OP)
Full Member
***
Offline Offline

Activity: 164
Merit: 100


Indie Developer


View Profile WWW
March 26, 2014, 02:39:03 AM
Last edit: March 26, 2014, 04:17:24 AM by Satosh¡ Slot
 #1

I have accomplished to retreive the input address(es) with blockchain.info's API and it works fairly well for web applications, to prepopulate withdraw address fields etc, but it would be nice to be able to get this straight from bitcoind RPC calls. This is supposedly possible through viewing raw transactions, but I never got it to work. Anyone else tried to accomplish this?

1715310135
Hero Member
*
Offline Offline

Posts: 1715310135

View Profile Personal Message (Offline)

Ignore
1715310135
Reply with quote  #2

1715310135
Report to moderator
1715310135
Hero Member
*
Offline Offline

Posts: 1715310135

View Profile Personal Message (Offline)

Ignore
1715310135
Reply with quote  #2

1715310135
Report to moderator
1715310135
Hero Member
*
Offline Offline

Posts: 1715310135

View Profile Personal Message (Offline)

Ignore
1715310135
Reply with quote  #2

1715310135
Report to moderator
Every time a block is mined, a certain amount of BTC (called the subsidy) is created out of thin air and given to the miner. The subsidy halves every four years and will reach 0 in about 130 years.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715310135
Hero Member
*
Offline Offline

Posts: 1715310135

View Profile Personal Message (Offline)

Ignore
1715310135
Reply with quote  #2

1715310135
Report to moderator
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1025



View Profile
March 26, 2014, 03:30:56 AM
 #2

Input address?  What's that?  I don't remember seeing that in the specs anywhere.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
Satosh¡ Slot (OP)
Full Member
***
Offline Offline

Activity: 164
Merit: 100


Indie Developer


View Profile WWW
March 26, 2014, 04:12:32 AM
 #3

Input address?  What's that?  I don't remember seeing that in the specs anywhere.

I mean what is generally called "input" or "inputs", basically the hash(es) from where the bitcoins in a transaction are taken. In blockchain.info it's returned like this:

Code:
"inputs":[
{
"prev_out":{
"hash":"a3e2bcc9a5f776112497a32b05f4b9e5b2405ed9",...
}
}
]

I'm new to raw transactions as you can see.

DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4653



View Profile
March 26, 2014, 05:39:35 AM
 #4

Transaction inputs are previous outputs.  They don't have addresses.  They just have a transaction hash and an index.

If you want a "withdrawal address", you should ask your users for one.  It is a VERY BAD idea to try to guess at a withdrawal address based on bad assumptions from a transaction and blockchain history.  The fact that there are other services that use this VERY BAD idea does not make it a good idea.
gweedo
Legendary
*
Offline Offline

Activity: 1498
Merit: 1000


View Profile
March 26, 2014, 05:42:00 AM
 #5

Take the input go to the transaction that it's hash points to, get outputs of that transactions. Then using vout go to that in the output array, get the address.
Foxpup
Legendary
*
Offline Offline

Activity: 4354
Merit: 3044


Vile Vixen and Miss Bitcointalk 2021-2023


View Profile
March 26, 2014, 08:30:58 AM
 #6

Suppose the input does not refer to any previous transactions at all? What then? (If you don't know why this might be the case, you shouldn't be trying to interpret transactions in this way. I mean, you shouldn't be doing it anyway, but now you have one more reason not to.)

Will pretend to do unspeakable things (while actually eating a taco) for bitcoins: 1K6d1EviQKX3SVKjPYmJGyWBb1avbmCFM4
I am not on the scammers' paradise known as Telegram! Do not believe anyone claiming to be me off-forum without a signed message from the above address! Accept no excuses and make no exceptions!
gweedo
Legendary
*
Offline Offline

Activity: 1498
Merit: 1000


View Profile
March 26, 2014, 02:47:31 PM
 #7

Suppose the input does not refer to any previous transactions at all? What then? (If you don't know why this might be the case, you shouldn't be trying to interpret transactions in this way. I mean, you shouldn't be doing it anyway, but now you have one more reason not to.)

That means they are newly mined and wouldn't have come from an address.
Foxpup
Legendary
*
Offline Offline

Activity: 4354
Merit: 3044


Vile Vixen and Miss Bitcointalk 2021-2023


View Profile
March 27, 2014, 01:36:08 AM
 #8

Suppose the input does not refer to any previous transactions at all? What then? (If you don't know why this might be the case, you shouldn't be trying to interpret transactions in this way. I mean, you shouldn't be doing it anyway, but now you have one more reason not to.)

That means they are newly mined and wouldn't have come from an address.
That question wasn't directed at you.

Will pretend to do unspeakable things (while actually eating a taco) for bitcoins: 1K6d1EviQKX3SVKjPYmJGyWBb1avbmCFM4
I am not on the scammers' paradise known as Telegram! Do not believe anyone claiming to be me off-forum without a signed message from the above address! Accept no excuses and make no exceptions!
BitEscrow
Newbie
*
Offline Offline

Activity: 42
Merit: 0


View Profile
March 27, 2014, 01:50:45 AM
 #9

Take the input go to the transaction that it's hash points to, get outputs of that transactions. Then using vout go to that in the output array, get the address.

  You literally made that up. GTFO with your FUD.

 Really, not one person here has fully answered the question.
gweedo
Legendary
*
Offline Offline

Activity: 1498
Merit: 1000


View Profile
March 27, 2014, 01:58:46 AM
 #10

Take the input go to the transaction that it's hash points to, get outputs of that transactions. Then using vout go to that in the output array, get the address.

  You literally made that up. GTFO with your FUD.

 Really, not one person here has fully answered the question.

Wait what? Put your bitcoind in to txindex=1, and reindex the blockchain and then you can use getrawtransaction to get the information. No FUD here.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4653



View Profile
March 27, 2014, 02:46:25 AM
 #11

Take the input go to the transaction that it's hash points to, get outputs of that transactions. Then using vout go to that in the output array, get the address.

  You literally made that up. GTFO with your FUD.

 Really, not one person here has fully answered the question.

Go away troll.

Foxpup and I both gave the correct answer (It is a very bad idea to try to guess at a withdrawal address from a transaction.  The method is unreliable and will lead to long term problems.)

gweedo gave the technical answer on how to make a best guess from the information available in the blockchain. His method will work most of the time for a standard single signature transaction when the bitcoins aren't sent from a web-hosted shared bitcoin storage service.
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!