summaryrefslogtreecommitdiff
path: root/7c/969e29fdcd0c864a25df5515ca57f4edc0d923
blob: 761c68477d17043c5aec50f64af9b79a2e3cc137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192]
	helo=mx.sourceforge.net)
	by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
	(envelope-from <gavinandresen@gmail.com>) id 1RILvt-0003cm-4O
	for bitcoin-development@lists.sourceforge.net;
	Mon, 24 Oct 2011 14:55:21 +0000
Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of gmail.com
	designates 209.85.213.175 as permitted sender)
	client-ip=209.85.213.175; envelope-from=gavinandresen@gmail.com;
	helo=mail-yx0-f175.google.com; 
Received: from mail-yx0-f175.google.com ([209.85.213.175])
	by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-MD5:128)
	(Exim 4.76) id 1RILvs-0007Gx-Cj
	for bitcoin-development@lists.sourceforge.net;
	Mon, 24 Oct 2011 14:55:21 +0000
Received: by yxi13 with SMTP id 13so1735507yxi.34
	for <bitcoin-development@lists.sourceforge.net>;
	Mon, 24 Oct 2011 07:55:15 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.223.64.197 with SMTP id f5mr4003110fai.24.1319468114702; Mon,
	24 Oct 2011 07:55:14 -0700 (PDT)
Received: by 10.152.24.229 with HTTP; Mon, 24 Oct 2011 07:55:14 -0700 (PDT)
In-Reply-To: <44861.134.106.52.172.1319444997.squirrel@webmail.uni-osnabrueck.de>
References: <44861.134.106.52.172.1319444997.squirrel@webmail.uni-osnabrueck.de>
Date: Mon, 24 Oct 2011 10:55:14 -0400
Message-ID: <CABsx9T2v4uhUdsWEg58Xs2OhOf3ED0Q2LGmkrRpdJDxvVMexdQ@mail.gmail.com>
From: Gavin Andresen <gavinandresen@gmail.com>
To: Jan Vornberger <jan@uos.de>
Content-Type: text/plain; charset=ISO-8859-1
X-Spam-Score: -1.6 (-)
X-Spam-Report: Spam Filtering performed by mx.sourceforge.net.
	See http://spamassassin.org/tag/ for more details.
	-1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for
	sender-domain
	0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
	(gavinandresen[at]gmail.com)
	-0.0 SPF_PASS               SPF: sender matches SPF record
	-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
	author's domain
	0.1 DKIM_SIGNED            Message has a DKIM or DK signature,
	not necessarily valid
	-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
	0.0 AWL AWL: From: address is in the auto white-list
X-Headers-End: 1RILvs-0007Gx-Cj
Cc: Bitcoin Dev <bitcoin-development@lists.sourceforge.net>
Subject: Re: [Bitcoin-development] Determine input addresses of a transaction
X-BeenThere: bitcoin-development@lists.sourceforge.net
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=subscribe>
X-List-Received-Date: Mon, 24 Oct 2011 14:55:21 -0000

> 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>.
> But then I started to wonder if this is safe. Can this be tricked somehow?

Sure. There are lots of non-standard scriptPubKey scripts that will
validate if given <sig> <pubKey> as input:  a simple OP_NOP would work
(do nothing, then check the top value on the stack and validate if it
is not zero-- and <pubKey> is not zero).

If you assume the client has all previous transactions, then you could
get the transaction input's prevout (from the memory pool or disk) and
then ExtractAddress() from it. That is probably a bad idea for
listtransactions, since fetching all the previous inputs from disk
just so you can check to see if they're 'green' violates the "a
feature shouldn't cost anything if it is not being used" design
principle.

You know, just thinking out loud...

Green addresses could be implemented as a second signature in the
scriptSig.  You'd have to hack your bitcoin client, but you could
generate a transaction that had <greensig> <sig> <pubKey>  ... as the
input instead of <sig> <pubKey>.

The <greensig> will be ignored by old clients.  The transactions is
still considered 'standard'.  But you could teach bitcoin to look for
<greensig> signatures in wallet transactions...

-- 
--
Gavin Andresen