public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: "Jan Vornberger" <jan@uos•de>
To: "Bitcoin Dev" <bitcoin-development@lists•sourceforge.net>
Subject: [Bitcoin-development] Determine input addresses of a transaction
Date: Mon, 24 Oct 2011 10:29:57 +0200 (CEST)	[thread overview]
Message-ID: <44861.134.106.52.172.1319444997.squirrel@webmail.uni-osnabrueck.de> (raw)

Hi there!

As part of my green address endeavor, I'm currently trying to extend the
'gettransaction' call to include an extra field "inputaddresses" which
should return a list of the Bitcoin addresses associated with the inputs
of the transaction.

I understand that this is not generally possible, because of the different
possible structures enabled through the scripting language. But it would
be fine, if this only worked for 'regular' transactions.

So my first shot at this is to go through the inputs of a transaction and
see if the scriptSig field has only two opcodes. If that is the case, I
assume that it is of the structure <sig> <pubKey> and calculate the
Bitcoin address from <pubKey>. The patch for this is here:

https://github.com/javgh/bitcoin/compare/vps_wheezy...showinputaddresses

But then I started to wonder if this is safe. Can this be tricked somehow?
Would it be possible to create a valid transaction which has an input that
has only two opcodes but with an arbitrary pubKey at the second position?
Could someone who has a better grasp on the scripting capabilities comment
on this?

Or alternatively: should I determine the input addresses of a transaction
in a different way? if so, how?

Regards!
Jan



             reply	other threads:[~2011-10-24  8:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-24  8:29 Jan Vornberger [this message]
2011-10-24 11:09 ` Pieter Wuille
2011-10-27 14:12   ` Jan Vornberger
2011-10-24 14:55 ` Gavin Andresen
2011-10-24 16:25   ` Mike Hearn
2011-10-24 18:52     ` Simon Barber
2011-10-24 17:14   ` Michael Hendricks
2011-10-27 13:37   ` Jan Vornberger
2011-10-27 14:50   ` Jan Vornberger
2011-10-25  9:45 Jan Vornberger
2011-10-25 10:03 ` Joel Joonatan Kaartinen
2011-10-25 10:42 ` Mike Hearn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44861.134.106.52.172.1319444997.squirrel@webmail.uni-osnabrueck.de \
    --to=jan@uos$(echo .)de \
    --cc=bitcoin-development@lists$(echo .)sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox