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 ) 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 ; 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: From: Gavin Andresen To: Jan Vornberger 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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 and calculate the > Bitcoin address from . > 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 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 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 ... as the input instead of . The will be ignored by old clients. The transactions is still considered 'standard'. But you could teach bitcoin to look for signatures in wallet transactions... -- -- Gavin Andresen