Gavin Andresen [ARCHIVE] on Nostr: š
Original date posted:2011-10-25 šļø Summary of this message: OP_EVAL ...
š
Original date posted:2011-10-25
šļø Summary of this message: OP_EVAL scriptPubKeys contain a hash of a script, but pre-calculating every possible hash is inefficient. Instead, store the hash --> script mapping.
š Original message:On Tue, Oct 25, 2011 at 6:49 AM, Mike Hearn <mike at 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
Published at
2023-06-07 02:35:26Event JSON
{
"id": "61e95d6ead33e63166ee1868f7ed2f4cf35c7739dff01dec66a6e74834b30ff6",
"pubkey": "857f2f78dc1639e711f5ea703a9fc978e22ebd279abdea1861b7daa833512ee4",
"created_at": 1686105326,
"kind": 1,
"tags": [
[
"e",
"38ab95ef62f6301977f9dec6ff3b1f25746d558345bec15abbd412157a28a77b",
"",
"root"
],
[
"e",
"8eed15db4e0afb0905cb417f5bce3383af002134f4b4a3beb66bda40e1306e92",
"",
"reply"
],
[
"p",
"f2c95df3766562e3b96b79a0254881c59e8639f23987846961cf55412a77f6f2"
]
],
"content": "š
Original date posted:2011-10-25\nšļø Summary of this message: OP_EVAL scriptPubKeys contain a hash of a script, but pre-calculating every possible hash is inefficient. Instead, store the hash --\u003e script mapping.\nš Original message:On Tue, Oct 25, 2011 at 6:49 AM, Mike Hearn \u003cmike at plan99.net\u003e wrote:\n\u003e scriptPubKeys that use OP_EVAL contain a hash of a script. If I\n\u003e understand correctly, that means to detect a transaction in a block\n\u003e that is relevant to your wallet, that means you need to pre-calculate\n\u003e every possible hash that might appear.\n\nYou could do it that way... but that would be inefficient.\n\nYou give the hash to whoever is paying you, and store the hash --\u003e\nscript mapping when you do that (assuming you're not using a\ndeterministic wallet; if you are, you probably just increment a\ncounter in the wallet).\n\nThe only use case I can think of where you'd want to check for every\npossible hash is if you lose your wallet, you have a wallet backup\nthat has your private keys in it, but DOES NOT have the hash --\u003e\nscript mapping(s).\n\nFor use cases involving other people, that's probably not a problem--\nyou could ask them to tell you what public keys are involved, and then\nadd them back in to the wallet (the RPC interface I settled on for\nm-of-n txns is an \"addmultisigaddress\" that takes the \"m\" and an array\nof \"n\" public keys, creates the script, adds the hash--\u003escript mapping\nto the wallet, and returns the hash).\n\nFor use cases where all the keys belong to you... either a good,\nautomatic, in-the-cloud-backup or the equivalent of \"-rescan\" is\nneeded to recover in case the mappings are lost.\n\n-- \n--\nGavin Andresen",
"sig": "b1f2907b4416fffbfae3b51c65831261c2dbaa76893a2871f4e8b3a881992f5b149f2bf59003584569d501042b3ec1b2c3954b7a34aa64f488fbd21248d45acf"
}