-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc38387
commit 8fcaeb3
Showing
10 changed files
with
618 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,46 @@ | ||
# Miniscript Templates | ||
|
||
|[![](https://avatars.githubusercontent.com/u/7424983?s=30)](https://github.com/Blockstream/miniscript-templates)|[000](mint-000.md)|[001](mint-001.md)|[002](mint-002.md)| | ||
|----------|----------|----------|----------| | ||
|
||
## About | ||
|
||
[Miniscript](https://bitcoin.sipa.be/miniscript/) is a language for composing Bitcoin Scripts in a structured way, facilitating analysis, composition, and generic signing. It's a simplified, composable subset of Bitcoin's Script language. Developed to overcome limitations in writing complex spending conditions directly in Bitcoin Script, it enables formal verification and offers a more human-friendly interface. | ||
[MiniScript](https://bitcoin.sipa.be/miniscript/) is a language for | ||
composing Bitcoin [Script](https://en.bitcoin.it/wiki/Script) in a | ||
structured way, facilitating analysis, composition, and generic signing. | ||
It\'s a simplified, composable subset of the Bitcoin | ||
[Script](https://en.bitcoin.it/wiki/Script) language. Developed to | ||
overcome limitations in writing complex spending conditions directly in | ||
Bitcoin [Script](https://en.bitcoin.it/wiki/Script), it enables formal | ||
verification and offers a more human-friendly interface. | ||
|
||
## Objectives | ||
|
||
1. Each `MinT` (MiniScript Template) [^mint] [^mintt] will provide a common MiniScript policy. | ||
|
||
2. Curate high quality example templates that demonstrate common use cases of | ||
[MiniScript](https://raw.githubusercontent.com/bitcoin/bitcoin/master/src/script/miniscript.h) | ||
policies. | ||
|
||
3. Standardized implementations will establish best practices as well as promote uniform on-chain usage for better privacy. | ||
|
||
4. Each `MinT` will be provided as is. While care is taken to ensure a high degree of quality. Developers and enthusiasts assume full responsibility for their usage [^use-at-your-own-risk]. | ||
|
||
<!-- | ||
Submission policy question: | ||
Can a developer submit a template | ||
under a different license? | ||
--> | ||
|
||
### Additional Resources | ||
|
||
## Goals | ||
[github.com/sipa/miniscript/tree/master](https://github.com/sipa/miniscript/tree/master ) | ||
|
||
- Have reviewed templates that leverage miniscript to assure there are not unintended ways of executing a valid spend beyond the intended miniscript policy. | ||
- Have standardized usages of miniscript to streamline software and hardware wallet integrations. | ||
- Have uniform on-chain usage of miniscript templates for better privacy. | ||
[bitcoin.sipa.be/miniscript](https://bitcoin.sipa.be/miniscript ) | ||
|
||
## Submission Format | ||
<!-- footnotes --> | ||
|
||
1. Name of Template | ||
2. Goal to be achieved by template | ||
3. Example Miniscript Output Descriptor | ||
[^mint]: MiniScript Template | ||
[^mintt]: MiniTapScript Template | ||
[^use-at-your-own-risk]: Use at your own risk. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# mint-000 | ||
|
||
## Proposed Timelock Usage | ||
|
||
## Motivation | ||
|
||
[Miniscript](https://bitcoin.sipa.be/miniscript/) facilitates easier | ||
access to utilizing timelocks in Bitcoin, it opens a new frontier in | ||
Bitcoin security concerning the construction of more advanced Scripts. | ||
This document aims to standardize timelock application across different | ||
wallet solutions, focusing on wallet recovery and standardizing expected | ||
timelock usage for streamlined hardware and software wallet interfaces. | ||
|
||
In the event an output descriptor has been partially or fully lost, | ||
minimizing the overall search space for expected timestamp values can | ||
expedite recovery. General Miniscript usage supports any valid timelock | ||
value, this proposal seeks to guide implementation to more user-friendly | ||
practices. | ||
|
||
# Block height based Timelocks: | ||
|
||
## Absolute block height based Timelocks | ||
|
||
**Guideline**: Set absolute block height-based timelocks as multiples of | ||
100, always ending in 00. | ||
|
||
##### Examples of valid Block Height Absolute Timelocks | ||
|
||
**<code>after(1000)</code>** | ||
|
||
**<code>after(50700)</code>** | ||
|
||
**<code>after(82800)</code>** | ||
|
||
**<code>after(615000)</code>** | ||
|
||
|
||
## Relative block height based Timelocks | ||
|
||
**Guideline**: Make relative block height-based timelocks multiples of | ||
100, except for the maximum value, 65,536 (2\^16). | ||
|
||
**<code>older(100)</code>** | ||
|
||
**<code>older(1500)</code>** | ||
|
||
**<code>older(65535)</code>** | ||
|
||
# Epoch timestamp based Timelocks: | ||
|
||
## Absolute Epochtime based Timelocks | ||
|
||
**Guideline**: To synchronize with real-world time rather than block | ||
time, employ epoch timestamps that are divisible by 43200 (Noon GMT) or | ||
86400 (Midnight GMT). Optimally, use multiples of 604800 for Thursday at | ||
Midnight GMT. | ||
|
||
**Limitation**: Avoid setting epoch timestamps beyond 2105 (4291704000) | ||
to prevent any possible issue with related to its 32 bit unsigned | ||
integer used for timestamps to happen in in February of 2106. | ||
|
||
##### Examples of valid Epoch Timestamp Absolute Timelocks | ||
|
||
**<code>after(1694476800)</code>** ***September 12th, 2023 Midnight GMT*** | ||
|
||
**<code>after(1694520000)</code>** ***September 12th, 2023 Moon GMT*** | ||
|
||
**<code>after(2160172800)</code>** ***June 15th, 2038 Midnight GMT*** | ||
|
||
**<code>after(2234779200)</code>** ***October 25th, 2040 Noon GMT*** | ||
|
||
## Relative Epochtime based Timelocks | ||
|
||
##### Examples of valid Block Height Relative Timelocks: | ||
|
||
Background: | ||
|
||
- Following | ||
[BIP68](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki), | ||
relative epoch timestamp timelocks can only go as far out as | ||
33,554,431 seconds (1.06 years), as it is constrained by the same | ||
units as relative block height timelocks, 65,536 (2\^16), where each | ||
unit represents 512 seconds (8 minutes and 32 seconds) of time | ||
(65,356 units \* 512 seconds = 33,554,432 seconds). | ||
|
||
- An Epoch Timestamp is not valid until the network\'s MTP (Median | ||
Time Past) of the past 11 blocks is greater than the epoch | ||
timestamp, MTP is defined in: | ||
[BIP113](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki). | ||
|
||
- The smallest value that can be used to have the miniscript compiler | ||
interpret a relative timelock is older(4194305) (calculated by | ||
following the BIP68 spec of: 1 \|= (1 \<\< 22)). This is a 1 unit | ||
timelock of duration 512 seconds. | ||
|
||
- The maximum value for a relative epoch timelock is older(4259839) | ||
which is 65,535 unit timelock, resulting in 33,554,431 seconds, or | ||
388 days. | ||
|
||
- The 512 second incrementor is a common multiple for the amount of | ||
seconds in 4 days, which is 675 units. To encourage intuitive usage | ||
of relative timelocks, they should be multiples of 675. | ||
|
||
An exception should be made<br> | ||
- for the largest possible epoch timestamp relative timelock. | ||
|
||
**Proposal**: Starting at 4194304, increment by 675 (4 days), for | ||
relative epochtime timelocks, the maximum value being 4259839. | ||
|
||
##### Examples of valid Epoch Timestamp Absolute Timelocks | ||
|
||
**<code>older(4194979)</code>** ***4 days, minimum value*** | ||
|
||
**<code>older(4214554)</code>** ***120 days*** | ||
|
||
**<code>older(4224679)</code>** ***180 days*** | ||
|
||
**<code>older(4255729)</code>** ***364 days*** | ||
|
||
**<code>older(4259839)</code>** ***388 days, maximum value*** |
Oops, something went wrong.