Skip to content

Commit

Permalink
Update templates
Browse files Browse the repository at this point in the history
  • Loading branch information
yukibtc committed Nov 2, 2023
1 parent b0513b0 commit 17f048d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 25 deletions.
7 changes: 4 additions & 3 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@

[Introduction](README.md)


# Miniscript Templates

- [Decaying Multisig](./miniscript-templates/decaying-multisig.md)
- [Collaborative Custody](./miniscript-templates/m-of-n.md)
- [Hodl Lock](./miniscript-templates/hold.md)
- [Inheritance](./miniscript-templates/inheritance.md)
- [Social Recovery](./miniscript-templates/social-recovery.md)
- [Social Recovery / Inheritance](./miniscript-templates/social-recovery.md)

# Nostr Specs

- [Event Kinds](./kinds/index.md)

# SDKs

- [Rust SDK](./rust-sdk/01-getting-started.md)
* [Installation](./rust-sdk/02-installation.md)
* [Features](./rust-sdk/03-features.md)
Expand Down
18 changes: 11 additions & 7 deletions src/miniscript-templates/decaying-multisig.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,42 @@ Decaying multisig is a custody technique where the number of keys required to mo
One use case for this is mitigating against loss of funds due to key loss. If a key is lost, the owner only needs to wait until the next decay step to recover the funds. Another use case is for loosening consensus for co-managed assets. For example, a board of directors may generally require a higher threshold (67%) to spend funds, but decrease that over time (to 51%) to avoid allowing a subset of signers to deadlock the funds.

## Vault Configuration Example

All 3 signers are needed to spend. After 10,000 blocks, the `after` block meets one of the threshold's conditions, so only 2 signatures are needed to unlock the funds. Finally, after 20,000 blocks, 2 conditions are met by the `after` statements and only 1 additional signature is needed.
![image](https://github.com/smartvaults/smartvaults/assets/32852271/199630b1-8812-45ce-9d44-6f2a35e030e6)


## Inputs

- Threshold
- List of Signers (extended public keys)
- List of Signers (extended descriptor)
- List of Lock times (integers)

## Miniscript

```
thresh(
<threshold>,
pk(key_1),
pk(key_2),
pk(key_3),
pk(Key1),
pk(Key2),
pk(Key3),
...
after(lock_time_1),
after(lock_time_2),
after(Timelock1),
after(Timelock2),
...
)
```

## Output Descriptor

```
tr(InternalKey,thresh(3,pk(K1),s:pk(K2),s:pk(K3),snl:after(B1),snl:after(B2)))
tr(InternalKey,thresh(3,pk(Key1),s:pk(Key2),s:pk(Key3),snl:after(Timelock1),snl:after(Timelock2)))
```

### Example

Example Output Descriptor

```
tr(3ec243044db203bc418092014b46bfe9494a1c16ee66160e385d7dd676e378cd,thresh(3,pk([7356e457/86'/1'/784923']tpubDCvLwbJPseNux9EtPbrbA2tgDayzptK4HNkky14Cw6msjHuqyZCE88miedZD86TZUb29Rof3sgtREU4wtzofte7QDSWDiw8ZU6ZYHmAxY9d/0/*),s:pk([4eb5d5a1/86'/1'/784923']tpubDCLskGdzStPPo1auRQygJUfbmLMwujWr7fmekdUMD7gqSpwEcRso4CfiP5GkRqfXFYkfqTujyvuehb7inymMhBJFdbJqFyHsHVRuwLKCSe9/0/*),s:pk([f3ab64d8/86'/1'/784923']tpubDCh4uyVDVretfgTNkazUarV9ESTh7DJy8yvMSuWn5PQFbTDEsJwHGSBvTrNF92kw3x5ZLFXw91gN5LYtuSCbr1Vo6mzQmD49sF2vGpReZp2/0/*),snl:after(1721743844),snl:after(1747663844)))#p0skyz4j
```
16 changes: 12 additions & 4 deletions src/miniscript-templates/hold.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
# Hold Template

## Description

Hodl time locks let’s user set specific time intervals, with a maximum of 24 months, during which their bitcoin remains locked.

The hodl time lock feature prevents impulsive selling during market fluctuations and allows users to stick to their investment strategy.


## Vault Configuration Example

TODO

## Inputs

* Signer key (extended descriptor)
* Timestamp or Block Height if using an absolute timelock (`after`), number of confirmed blocks if using relative timelock (`older`)

## Miniscript

```
and(pk(Key1),after(TimestampOrBlockHeight))
```

## Output Descriptor
```

```
tr(InternalKey,and_v(v:pk(Key1),after(TimestampOrBlockHeight)))
```

### Example

Example Output Descriptor
```

```
tr(e3e5c4a66d85841b9cea26793ef640bf7c1d26e759ae0296e643a16dad606c02,and_v(v:pk([7356e457/86'/1'/784923']tpubDCvLwbJPseNux9EtPbrbA2tgDayzptK4HNkky14Cw6msjHuqyZCE88miedZD86TZUb29Rof3sgtREU4wtzofte7QDSWDiw8ZU6ZYHmAxY9d/0/*),older(10000)))#e4gyn573
```
4 changes: 0 additions & 4 deletions src/miniscript-templates/inheritance.md

This file was deleted.

21 changes: 18 additions & 3 deletions src/miniscript-templates/m-of-n.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
# Collaborative Custody Template

## Description

Collaborative custody allows users to configure the number of co-signers and the threshold required to access the vault’s bitcoin.

Users can choose a 2 of 3, 3 of 5, or a custom configuration, this feature ensures that multiple trusted parties agree before a transaction takes place. It's an ideal solution for shared ownership and collaborative arrangements.

## Vault Configuration Example

TODO

## Inputs

* Threshold
* List of Signers (extended descriptor)

## Miniscript

```
thresh(
<threshold>,
pk(key_1),
pk(key_2),
pk(key_3),
...
)
```

## Output Descriptor
```

```
tr(InternalKey,thresh(3,pk(K1),s:pk(K2),s:pk(K3)))
```

### Example

Example Output Descriptor
```

```
tr(885db1e89516e0f0adc15ff8389320a01270a54f3b8ea4ecc705472904fc9a7e,multi_a(2,[7356e457/86'/1'/784923']tpubDCvLwbJPseNux9EtPbrbA2tgDayzptK4HNkky14Cw6msjHuqyZCE88miedZD86TZUb29Rof3sgtREU4wtzofte7QDSWDiw8ZU6ZYHmAxY9d/0/*,[4eb5d5a1/86'/1'/784923']tpubDCLskGdzStPPo1auRQygJUfbmLMwujWr7fmekdUMD7gqSpwEcRso4CfiP5GkRqfXFYkfqTujyvuehb7inymMhBJFdbJqFyHsHVRuwLKCSe9/0/*))#g52crz77
```
17 changes: 13 additions & 4 deletions src/miniscript-templates/social-recovery.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
# Social Recovery Template
# Social Recovery Template / Inheritance

## Description

Social recovery keeps you in full and exclusive control of your bitcoin while enabling a recovery path in case you lose your keys. After a predefined number of months set by the user, an m of n multisig of trusted co-signers is able to move the user funds

Between 20%-25% of all bitcoin has been lost forever by owners who lost their keys. This security feature helps you have a plan B, leveraging trusted connections like friends, family, or colleagues to regain access to your Bitcoin

## Vault Configuration Example

TODO

## Inputs

* Signer keys (extended descriptor): 1 + N for recovery
* Timestamp or block height if using an absolute timelock (`after`), number of confirmed blocks if using relative timelock (`older`)

## Miniscript

```
or(1@pk(Key1),1@and(thresh(2,pk(RecoveryKey1),pk(RecoveryKey2)),after(TimestampOrBlockHeight)))
```

## Output Descriptor
```

```
tr(Key1,and_v(v:multi_a(2,RecoveryKey1,RecoveryKey2),after(TimestampOrBlockHeight)))
```

### Example

Example Output Descriptor
```

```
tr([7356e457/86'/1'/784923']tpubDCvLwbJPseNux9EtPbrbA2tgDayzptK4HNkky14Cw6msjHuqyZCE88miedZD86TZUb29Rof3sgtREU4wtzofte7QDSWDiw8ZU6ZYHmAxY9d/0/*,and_v(v:multi_a(2,[4eb5d5a1/86'/1'/784923']tpubDCLskGdzStPPo1auRQygJUfbmLMwujWr7fmekdUMD7gqSpwEcRso4CfiP5GkRqfXFYkfqTujyvuehb7inymMhBJFdbJqFyHsHVRuwLKCSe9/0/*,[f3ab64d8/86'/1'/784923']tpubDCh4uyVDVretfgTNkazUarV9ESTh7DJy8yvMSuWn5PQFbTDEsJwHGSBvTrNF92kw3x5ZLFXw91gN5LYtuSCbr1Vo6mzQmD49sF2vGpReZp2/0/*),after(840000)))
```

0 comments on commit 17f048d

Please sign in to comment.