I’d say a time-locked simple script comes close.
Say, I want to send something to my address addr1qyh72hvvrurjvddx4gq37jd2fzyef8scz9cwcyc90dffq0xxllh3nc5r82ujj36fy9zh0gryqvqy7r3ejd2h2kgsvryswhjr9q
locked until slot 108 900 000 (some time tomorrow, converting times to slots and vice versa is a different topic).
I can decode that address with:
$ echo addr1qyh72hvvrurjvddx4gq37jd2fzyef8scz9cwcyc90dffq0xxllh3nc5r82ujj36fy9zh0gryqvqy7r3ejd2h2kgsvryswhjr9q | bech32
012fe55d8c1f072635a6aa011f49aa4889949e181170ec13057b52903cc6ffef19e2833ab9294749214577a06403004f0e39935575591060c9
The first byte 01
means that it is a delegated base address – payment key hash and stake key hash – the payment key hash are the next 28 bytes:
$ echo addr1qyh72hvvrurjvddx4gq37jd2fzyef8scz9cwcyc90dffq0xxllh3nc5r82ujj36fy9zh0gryqvqy7r3ejd2h2kgsvryswhjr9q | bech32 | cut -c 3-58
2fe55d8c1f072635a6aa011f49aa4889949e181170ec13057b52903c
And the stake key hash are the final 28 bytes:
$ echo addr1qyh72hvvrurjvddx4gq37jd2fzyef8scz9cwcyc90dffq0xxllh3nc5r82ujj36fy9zh0gryqvqy7r3ejd2h2kgsvryswhjr9q | bech32 | cut -c 59-114
c6ffef19e2833ab9294749214577a06403004f0e39935575591060c9
The lock script would be:
{ "type": "all",
"scripts": [ { "type": "sig",
"keyHash": "2fe55d8c1f072635a6aa011f49aa4889949e181170ec13057b52903c" },
{ "type": "after",
"slot": 108900000 } ] }
Meaning that to fulfil this script, a transaction has to be signed by the private payment key for the public key hash of my address and the slot has to be greater than 108 900 000.
The address to send to can then be generated by cardano-cli
(with that lock script in lock.json
):
$ cardano-cli address build --mainnet --payment-script-file lock.json --stake-address stake1u8r0lmceu2pn4wffgayjz3th5pjqxqz0pcuex4t4tygxpjgygq2ay
addr1z9tcswppsxrgyty78yyf0823886zt9y8jpexftgnm47etgxxllh3nc5r82ujj36fy9zh0gryqvqy7r3ejd2h2kgsvrys3cyt3x
If I send something to that address, it is staked with the rest of my stake and can only be moved after some time tomorrow with a signature from my payment key.
The stake address (that I just know because it’s my account) can be derived from the stake part extracted from the address:
$ echo e1c6ffef19e2833ab9294749214577a06403004f0e39935575591060c9 | bech32 stake
stake1u8r0lmceu2pn4wffgayjz3th5pjqxqz0pcuex4t4tygxpjgygq2ay
(The prefix e1
says that it is a stake key hash.)
Most Cardano libraries have functionality for all this that can be used instead of using bech32
and cardano-cli
on the command line. Consult the documentation.