public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Gavin Andresen <gavinandresen@gmail•com>
To: Bitcoin Dev <bitcoin-development@lists•sourceforge.net>
Subject: Re: [Bitcoin-development] Detecting OP_EVAL scriptPubKeys that are to you
Date: Tue, 25 Oct 2011 09:21:30 -0400	[thread overview]
Message-ID: <CABsx9T3WKv3RLWT+Q6s7cCLzDL3sVRCWfmPiKcSp=_Re05m+zQ@mail.gmail.com> (raw)
In-Reply-To: <CANEZrP1ic4RXFzoqf66MGv=rJe3MgWxVi5nnk2VKkMc4VMCDyw@mail.gmail.com>

On Tue, Oct 25, 2011 at 6:49 AM, Mike Hearn <mike@plan99•net> wrote:
> scriptPubKeys that use OP_EVAL contain a hash of a script. If I
> understand correctly, that means to detect a transaction in a block
> that is relevant to your wallet, that means you need to pre-calculate
> every possible hash that might appear.

You could do it that way...  but that would be inefficient.

You give the hash to whoever is paying you, and store the hash -->
script  mapping when you do that (assuming you're not using a
deterministic wallet; if you are, you probably just increment a
counter in the wallet).

The only use case I can think of where you'd want to check for every
possible hash is if you lose your wallet, you have a wallet backup
that has your private keys in it, but DOES NOT have the hash -->
script mapping(s).

For use cases involving other people, that's probably not a problem--
you could ask them to tell you what public keys are involved, and then
add them back in to the wallet (the RPC interface I settled on for
m-of-n txns is an "addmultisigaddress" that takes the "m" and an array
of "n" public keys, creates the script, adds the hash-->script mapping
to the wallet, and returns the hash).

For use cases where all the keys belong to you... either a good,
automatic, in-the-cloud-backup or the equivalent of "-rescan" is
needed to recover in case the mappings are lost.

-- 
--
Gavin Andresen



  reply	other threads:[~2011-10-25 13:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-25 10:49 Mike Hearn
2011-10-25 13:21 ` Gavin Andresen [this message]
2011-10-25 14:49   ` Gregory Maxwell
2011-10-25 16:47     ` Alan Reiner
2011-10-26  8:58       ` Michael Grønager
2011-10-26 14:03         ` Gregory Maxwell
2011-10-26 15:00           ` Gavin Andresen
2011-10-27  7:32             ` Michael Grønager
2011-10-27  9:08               ` Gregory Maxwell
2011-10-28 10:24                 ` Michael Grønager
2011-10-29 17:01                   ` Gavin Andresen
2011-10-31  8:50                     ` Michael Grønager

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='CABsx9T3WKv3RLWT+Q6s7cCLzDL3sVRCWfmPiKcSp=_Re05m+zQ@mail.gmail.com' \
    --to=gavinandresen@gmail$(echo .)com \
    --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