Post
Topic
Board Development & Technical Discussion
Why are pubkeys used in HTLCs instead of pubkey hashes?
by
colatkinson
on 28/12/2017, 09:16:42 UTC
Every resource I've looked at seems to suggest that the HTLCs used by LN are roughly of the form

Code:
HASH160 EQUAL
IF
    
ELSE
    "24h" CHECKSEQUENCEVERIFY DROP
    
ENDIF
CHECKSIG

Why was this was chosen instead of a variant based on the hash of the public key, similar to the standard P2PKH script? Something like

Code:
HASH160 EQUAL
IF
    DUP HASH160
ELSE
    "24h" CHECKSEQUENCEVERIFY DROP
    DUP HASH160
ENDIF
EQUALVERIFY
CHECKSIG

I'm sure that this could be expressed more elegantly, but whatever. If my arithmetic is on, doing so would shave off 19 bytes per script (64 bytes for two pubkeys vs 45 bytes for the two hashes and 5 extra opcodes).

So what's the catch? Am I missing something important in the script? Any insight would be appreciated.