Open JeremyRand opened 7 years ago
That's a very nice idea - I'm totally in favour of keeping this in mind for a future protocol upgrade.
Note that P2SH is actually not yet fully enabled for Namecoin - while the infrastructure is there in code, the softfork is not active. We need to do this by flag-day activation, possibly combined with a scheduled fork for AAA.
This is a great idea.
It occurred to me that the extra data used in
name_new
andname_firstupdate
transactions doesn't actually need to be publicly viewable, and that we can take advantage of this fact to use P2SH for name registrations. Consider the following changes:name_new
becomes a P2SH output, with the following redeemScript:OP_NAME_NEW (unsalted hashed name) OP_2DROP (Bitcoin scriptPubKey)
name_firstupdate
remains non-P2SH, but has the following scriptPubKey:OP_NAME_FIRSTUPDATE (name) (value) OP_2DROP OP_DROP (Bitcoin scriptPubKey)
What benefits does this have?
name_new
outputs look identical to unspent P2SH currency outputs. a. Better privacy. b. Better censorship resistance. c. Better usability, since Alice can create a P2SH address for a name registration, and Bob can fund the name registration by sending coins directly to the P2SH address. (This would make it easy to use Bitsquare to purchase Namecoin names using bitcoins, for example.)name_new
front-running attacks are inherently prevented without any special duplicate-checking logic, because the role of thename_new
salt is played by the Bitcoin scriptPubKey (which is only valid for whoever holds the private key).This could be implemented as a hardfork, or as a soft-hard-name fork.
If we wanted to save a few extra bytes, we could also remove the (unsalted hashed name) from the redeemScript serialization in the
name_firstupdate
scriptSig (but keep it present when calculating the P2SH hash). This works in theory, since the name exists in thename_firstupdate
scriptPubKey. However, since this would change how P2SH is validated (in a way that's presumably a hardfork), I don't think it's worth the extra complexity.