This very simple script sets an expiry date and public key that must be matched to unlock the funds.
The funds cannot move from the time locked address until the set expiry date and time.
After the expiry, a single private key, corresponding to the set public key, is required.
CHECKSEQUENCEVERIFY and CHECKLOCKTIMEVERIFY leave the time value on the stack so usually a DROP is added after these operands to clean up the stack like so:
To establish a payment channel between Alice and Bob, Alice will fund a 2-of-2 hashed timelocked contract address requiring Bob's key and her key.
Alice will then ask Bob to sign a refund transaction spending the 2-of-2 address to her timelocked address.
The payment channel will be open as long as Alice does not broadcast her timelocked refund transaction.
<expiry time> CHECKLOCKTIMEVERIFY DROP <public key> CHECKSIG
scriptSig (after expiry):
Expiry: 2016-11-13 15:28:44 UTC
Public Key: 023927B837A922696836E26399F759965328437F93AAFAF3E02767D22860C0FBA7
Timelocked Address: 3AMdSGWdRwvaTbsDqFn4s35P3HLf8NKJ6U