You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Learn/products/btc-staking/design.md
+13-13Lines changed: 13 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -4,23 +4,23 @@ hide_table_of_contents: false
4
4
sidebar_position: 2
5
5
---
6
6
7
-
# Design of Non-Custodial BTC Staking
7
+
# Non-Custodial Bitcoin Staking Design
8
8
---
9
9
10
10
## Background
11
11
12
-
Core Chain’s methodology for integrating bitcoin staking centers on [CLTV timelock](https://en.bitcoin.it/wiki/Timelock#CheckLockTimeVerify). The `OP_CHECKLOCKTIMEVERIFY` (CLTV) timelock is a specific opcode used in Bitcoin's scripting language that allows for creating conditions based on time or block height before bitcoins can be spent from a transaction output. This provides a way to create outputs that are time-locked, meaning they cannot be spent until a certain condition related to time or block height is met.
12
+
The methodology for integrating bitcoin staking centers on [CLTV timelock](https://en.bitcoin.it/wiki/Timelock#CheckLockTimeVerify). The `OP_CHECKLOCKTIMEVERIFY` (CLTV) timelock is a specific opcode used in Bitcoin's scripting language that allows for creating conditions based on time or block height before bitcoins can be spent from a transaction output. This provides a way to create outputs that are time-locked, meaning they cannot be spent until a certain condition related to time or block height is met.
A BTC staking transaction should have two/three outputs, which are
20
+
A Bitcoin staking transaction should have two/three outputs, which are
21
21
22
22
-`P2SH/P2WSH` type output, with time-lock enabled redeem script
23
-
-`OP_RETURN` type output, with Core chain staking information
23
+
-`OP_RETURN` type output, with Core staking information
24
24
- (_Optional_) Change address
25
25
26
26
Note that there are **no** restrictions on inputs.
@@ -37,7 +37,7 @@ When the time-lock ends, the locked UTXO can be spent using the redeem script
37
37
38
38
### P2SH/P2WSH Output
39
39
40
-
* Core supports both `P2SH` and `P2WSH` outputs for BTC staking.
40
+
* Core supports both `P2SH` and `P2WSH` outputs for Bitcoin staking.
41
41
42
42
* The construction of `P2SH` type output is as follows
43
43
@@ -55,10 +55,10 @@ The `RedeemScript` should start with a CLTV time lock. Here are a few common ty
55
55
56
56
* When using a public key hash (most recommended) `<CLTV timelock> OP_CLTV OP_DROP OP_DUP OP_HASH160 <pubKey Hash> OP_EQUALVERIFY OP_CHECKSIG` and the corresponding unlocking script in the withdrawal transaction is `<sig> <pubKey> <RedeepScript>`
57
57
58
-
* When using multi signature address `<CLTV timelock> OP_CLTV OP_DROP M <pubKey1> <pubKey1> ... <pubKeyN> N OP_CHECKMULTISIG` and the corresponding unlocking script in the withdrawal transaction is `OP_0 <sig1> ... <sigM> <RedeemScript>` The amount and duration of BTC locked in this output will be used for the calculation of validator election and reward distribution on the Core chain.
58
+
* When using multi signature address `<CLTV timelock> OP_CLTV OP_DROP M <pubKey1> <pubKey1> ... <pubKeyN> N OP_CHECKMULTISIG` and the corresponding unlocking script in the withdrawal transaction is `OP_0 <sig1> ... <sigM> <RedeemScript>` The amount and duration of Bitcoin locked in this output will be used for the calculation of validator election and reward distribution on Core.
59
59
60
60
> **Note**
61
-
> There are _minimal requirements_ on both **amount** and **duration** to make the staking eligible on Core. A user should at least stake **0.01 BTC** (less transaction fees) for at least **10 days** (`CLTV timestamp - transaction confirmation timestamp > 10 days`).
61
+
> There are _minimal requirements_ on both **amount** and **duration** to make the staking eligible on Core. A user should at least stake **0.01 Bitcoin** (less transaction fees) for at least **10 days** (`CLTV timestamp - transaction confirmation timestamp > 10 days`).
62
62
63
63
## OP_RETURN Output
64
64
@@ -75,14 +75,14 @@ The `OP_RETURN` output should contain all staking information in order, and be c
75
75
- (_Optional_) **`RedeemScript`**
76
76
- (_Optional_) **`Timelock`:** 4 bytes
77
77
78
-
#### Key Points to Ensure
78
+
#### Key Points
79
79
- Any bytes that can translate to a number should use `OP_number` (`{0}` should use `OP_0` instead of `0x0100`, `{16}` should use `OP_16` instead of `0x0110`)
80
80
- Any bytes with lengths smaller than `0x4c (76)` is pushed with 1 byte equal to the size `(byte[10] -> 10 + byte[10]; byte[70] -> 70 + byte[70])`
81
81
- Any bytes bigger than or equal to `0x4c` is pushed by using `0x4c` (ie. `OP_PUSHDATA`) followed by the length followed by the data `(byte[80] -> OP_PUSHDATA + 80 + byte[80])`
82
82
- Any bytes with length bigger than `255` uses `0x4d` (`OP_PUSHDATA2`)
83
83
- Any bytes with length bigger than `65535` (`0xffff`) uses `0x4e` (`OP_PUSHDATA4`)
84
84
85
-
Either `RedeemScript` or `Timelock` must be available, the purpose is to allow relayer to obtain the `RedeemScript` and submit transactions on the Core chain. If a `RedeemScript` is provided, relayer will use it directly. Otherwise, relayer will construct the redeem script based on the timelock and the information in the transaction inputs. You can find more information about the relayer role in the [below section](#role-of-relayers).
85
+
Either `RedeemScript` or `Timelock` must be available, the purpose is to allow relayer to obtain the `RedeemScript` and submit transactions on Core. If a `RedeemScript` is provided, relayer will use it directly. Otherwise, relayer will construct the redeem script based on the timelock and the information in the transaction inputs. You can find more information about the relayer role in the [below section](#role-of-relayers).
86
86
87
87
## Transaction Examples
88
88
@@ -144,14 +144,14 @@ In the input, the redeem script `041f5e0e66b17576a914c4b8ae927ff2b9ce218e20bf06d
144
144
145
145
## Role of Relayers
146
146
147
-
In a strict sense, the Non-Custodial BTC Staking process consists of two steps
147
+
In a strict sense, the Non-Custodial Bitcoin Staking process consists of two steps
148
148
149
149
1. Stake on the Bitcoin network
150
-
2. Submit the confirmed BTC staking transaction to the Core chain
150
+
2. Submit the confirmed Bitcoin staking transaction to Core
151
151
152
-
To make the entire process more convenient, Core Chain introduces the role of relayers. Relayers can help users submit transactions to the Core network after the staking transaction is confirmed on the Bitcoin network. Since it is necessary to verify the transaction on the Core network with the embedded Bitcoin light client, relayers needs to obtain the corresponding `RedeemScript` of the `P2SH/P2WSH` output. To meet this requirement, we suggest users to either
152
+
To make the entire process more convenient, Core introduces the role of relayers. Relayers can help users submit transactions to the Core network after the staking transaction is confirmed on the Bitcoin network. Since it is necessary to verify the transaction on the Core network with the embedded Bitcoin light client, relayers needs to obtain the corresponding `RedeemScript` of the `P2SH/P2WSH` output. To meet this requirement, we suggest users to either
153
153
154
154
- Put the entire `RedeemScript` at the end of the `OP_RETURN` output, if the script is short. e.g. a `RedeemScript` constructed using public key hash as shown in the sample above.
155
155
- Set the receiving address of the staking transaction as their own so relayers can extract useful information from the transaction input and compose the `RedeemScript` by themselves. E.g.
156
156
- If it's a normal address, the `pubkey` or `pubkey hash` should be set as the input's corresponding public key when constructing the `RedeemScript`.
157
-
- If it is a multi-signature address, the corresponding multi-signature address's public key should be set when constructing the `RedeemScript`.
157
+
- If it is a multi-signature address, the corresponding multi-signature address's public key should be set when constructing the `RedeemScript`.
0 commit comments