Skip to content

Commit b761513

Browse files
committed
import from docs repo
0 parents  commit b761513

14 files changed

+771
-0
lines changed

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#SatoshiLabs Improvement Proposals
2+
3+
SatoshiLabs projects need a way how to document their technical decisions and features.
4+
For some of them Bitcoin Improvement Proposal (BIP) is not a right place because
5+
their range and implications are outside of the scope of Bitcoin and cryptocurrencies.
6+
7+
SLIP repository is an extension to Bitcoin Improvement Proposal (BIP) process
8+
and contains the documents that are unsuitable for submission to BIP repository.
9+
10+
Each SLIP should provide a concise technical specification of the feature and a rationale for the feature.
11+
12+
| Number | Title | Type | Status |
13+
|---------------------------|-----------------------------------------------------------------------|---------------|----------|
14+
| [SLIP-0000](slip-0000.md) | SLIP Template | Informational | Accepted |
15+
| [SLIP-0010](slip-0010.md) | Universal private key derivation from master private key | Standard | Draft |
16+
| [SLIP-0011](slip-0011.md) | Symmetric encryption of key-value pairs using deterministic hierarchy | Standard | Draft |
17+
| [SLIP-0012](slip-0012.md) | Public key encryption using deterministic hierarchy | Standard | Draft |
18+
| [SLIP-0013](slip-0013.md) | Authentication using deterministic hierarchy | Standard | Draft |
19+
| [SLIP-0014](slip-0014.md) | Stress Test Deterministic Wallet | Informational | Draft |
20+
| [SLIP-0015](slip-0015.md) | Format for Bitcoin metadata and its encryption in HD wallets | Standard | Draft |
21+
| [SLIP-0044](slip-0044.md) | Registered coin types for BIP-0044 | Standard | Draft |

slip-0000.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#SLIP-0000 : SLIP Template
2+
3+
```
4+
Number: SLIP-0000
5+
Title: SLIP Template
6+
Type: Informational
7+
Status: Accepted
8+
Authors: SatoshiLabs <[email protected]>
9+
Created: 2014-06-06
10+
```
11+
12+
##Abstract
13+
14+
This is a section for an abstract.
15+
16+
##Motivation
17+
18+
This is a section for a motivation.
19+
20+
##Body
21+
22+
This is a section for a body. The title of the section should be changed
23+
and the section can be split into multiple sections and subsections.
24+
25+
##References
26+
27+
This is a section for references such as links to other documents (BIP or SLIP)
28+
or to reference implementations.

slip-0010.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#SLIP-0010 : Universal private key derivation from master private key
2+
3+
```
4+
Number: SLIP-0010
5+
Title: Universal private key derivation from master private key
6+
Type: Standard
7+
Status: Draft
8+
Authors: Pavol Rusnak <[email protected]>
9+
Jochen Hoenicke <[email protected]>
10+
Created: 2015-12-25
11+
```
12+
13+
##Abstract
14+
15+
This is a section for an abstract.
16+
17+
##Motivation
18+
19+
This is a section for a motivation.
20+
21+
##Body
22+
23+
This is a section for a body. The title of the section should be changed
24+
and the section can be split into multiple sections and subsections.
25+
26+
##References
27+
28+
This is a section for references such as links to other documents (BIP or SLIP)
29+
or to reference implementations.

slip-0010/test.py

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env python2
2+
3+
import binascii
4+
import hashlib
5+
import hmac
6+
import struct
7+
8+
9+
def int_to_string(x, pad):
10+
result = ['\x00'] * pad
11+
while x > 0:
12+
pad -= 1
13+
ordinal = x & 0xFF
14+
result[pad] = (chr(ordinal))
15+
x >>= 8
16+
return ''.join(result)
17+
18+
def string_to_int(s):
19+
result = 0
20+
for c in s:
21+
if not isinstance(c, int):
22+
c = ord(c)
23+
result = (result << 8) + c
24+
return result
25+
26+
27+
# mode 0 - compatible with BIP32 private derivation
28+
def derive(parent_key, parent_chaincode, i):
29+
assert len(parent_key) == 32
30+
assert len(parent_chaincode) == 32
31+
secp256k1_n = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
32+
k = parent_chaincode
33+
d = '\x00' + parent_key + struct.pack('>L', i)
34+
h = hmac.new(k, d, hashlib.sha512).digest()
35+
key, chaincode = h[:32], h[32:]
36+
key = (string_to_int(key) + string_to_int(parent_key)) % secp256k1_n
37+
key = int_to_string(key, 32)
38+
return (key, chaincode)
39+
40+
# mode 1 - universal
41+
def derive_universal(parent_key, parent_chaincode, i, n, curveid, data):
42+
assert len(parent_key) == 32
43+
assert len(parent_chaincode) == 32
44+
ctr = 0
45+
while True:
46+
k = parent_chaincode
47+
d = '\x01' + parent_key + struct.pack('>L', i) + curveid + struct.pack('>L', ctr) + data
48+
h = hmac.new(k, d, hashlib.sha512).digest()
49+
key, chaincode = h[:32], h[32:]
50+
if string_to_int(key) >= n:
51+
ctr += 1
52+
else:
53+
return (key, chaincode)
54+
55+
56+
master_key = binascii.unhexlify('e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35')
57+
master_chaincode = binascii.unhexlify('873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d508')
58+
59+
60+
k, c = derive(master_key, master_chaincode, 0x80000000 + 44)
61+
assert binascii.hexlify(k) == '8a8e34c835bceec0213d542623158811d5686d931d51efbf8e3ea8f62edc703f'
62+
assert binascii.hexlify(c) == '4681a20841656292a6f6fda184811ace2c5fa67de53c47eb9d0cc557bae2dea4'
63+
print 'ok'
64+
65+
66+
k, c = derive_universal(master_key, master_chaincode, 1337, n=(2**255 - 19), curveid='ed25519', data='https://www.example.com')
67+
assert binascii.hexlify(k) == '51e7ccf5c5fd11301926ccdf195f6c02b2696a2b9e5a95a930f7e527654b5d03'
68+
assert binascii.hexlify(c) == 'b45f2b67f218223833f5607d1a26b030e6a1ebc7fdd7b3bc9481e1d78ee2c728'
69+
print 'ok'

slip-0011.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#SLIP-0011 : Symmetric encryption of key-value pairs using deterministic hierarchy
2+
3+
```
4+
Number: SLIP-0011
5+
Title: Symmetric encryption of key-value pairs using deterministic hierarchy
6+
Type: Standard
7+
Status: Draft
8+
Authors: Pavol Rusnak <[email protected]>
9+
Marek Palatinus <[email protected]>
10+
Created: 2014-06-12
11+
```
12+
13+
##Abstract
14+
15+
This is a section for an abstract.
16+
17+
##Motivation
18+
19+
This is a section for a motivation.
20+
21+
##Body
22+
23+
This is a section for a body. The title of the section should be changed
24+
and the section can be split into multiple sections and subsections.
25+
26+
##References
27+
28+
This is a section for references such as links to other documents (BIP or SLIP)
29+
or to reference implementations.

slip-0012.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#SLIP-0012 : Public key encryption using deterministic hierarchy
2+
3+
```
4+
Number: SLIP-0012
5+
Title: Public key encryption using deterministic hierarchy
6+
Type: Standard
7+
Status: Draft
8+
Authors: Pavol Rusnak <[email protected]>
9+
Marek Palatinus <[email protected]>
10+
Created: 2014-06-12
11+
```
12+
13+
##Abstract
14+
15+
This is a section for an abstract.
16+
17+
##Motivation
18+
19+
This is a section for a motivation.
20+
21+
##Body
22+
23+
This is a section for a body. The title of the section should be changed
24+
and the section can be split into multiple sections and subsections.
25+
26+
##References
27+
28+
This is a section for references such as links to other documents (BIP or SLIP)
29+
or to reference implementations.

slip-0013.md

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#SLIP-0013 : Authentication using deterministic hierarchy
2+
3+
```
4+
Number: SLIP-0013
5+
Title: Authentication using deterministic hierarchy
6+
Type: Standard
7+
Status: Draft
8+
Authors: Pavol Rusnak <[email protected]>
9+
Created: 2015-03-12
10+
```
11+
12+
##Abstract
13+
14+
This document describes a method that is used for authenticating
15+
to various services such as websites or remote shells using a determinstic
16+
hierarchy.
17+
18+
##Motivation
19+
20+
Using Deterministic Hierarchy for authenticating into systems is ideal,
21+
because the same concepts of easy backup that relate to backing up
22+
deterministic wallets can be applied to backing up user identities.
23+
24+
##Service Identity
25+
26+
Let's introduce the service identity. It consists of two elements:
27+
28+
a) RFC 3986 URI `proto://[user@]host[:port][/path]`
29+
30+
Examples:
31+
32+
- https://example.com
33+
- ftp://[email protected]/pub
34+
- ssh://[email protected]:2222
35+
36+
b) index (32-bit unsigned integer)
37+
38+
The index is used so one can generate more keys corresponding to the same URI.
39+
40+
##HD Structure
41+
42+
1. Let's concatenate the little endian representation of index with the URI.
43+
44+
2. Compute the SHA256 hash of the result.
45+
46+
3. Let's take first 128 bits of the hash and split it into four 32-bit numbers A, B, C, D.
47+
48+
4. Set highest bits of numbers A, B, C, D to 1.
49+
50+
5. Derive the HD node m/13'/A'/B'/C'/D' according to BIP32.
51+
52+
##Challenge - Response
53+
54+
Service issues the challenge consisting of three parts:
55+
56+
a) service identity described above (e.g. https://example.com 0)
57+
58+
b) hidden challenge
59+
- random bytes sequence of maximum length 64
60+
- this won't be shown to the user
61+
62+
c) visual challenge
63+
- arbitrary string of text of maximum length 64
64+
- this will be shown to the user and we recommend using timestamp in `YYYY-MM-DD HH:MM:SS` format or similar
65+
66+
Signer takes this data and computes the private key according to section HD Structure.
67+
Then it concatenates sha256 hashes of challenge hidden and challenge visual and
68+
signs the result using the standard Bitcoin message signing.
69+
Finally, the signature is returned together with the node public key and node address.
70+
71+
It's up to service operator to take this message and react in three possible ways:
72+
73+
1. signature is invalid or not present -> show error to user
74+
2. signature is valid, address/public key seen for the first time -> create user account
75+
3. signature is valid, address/public key known -> login to user account
76+
77+
##References
78+
79+
- [BIP-0032: Hierarchical Deterministic Wallets](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)
80+
- [BIP-0043: Purpose Field for Deterministic Wallets](https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki)
81+
- [RFC 3986: Uniform Resource Identifier (URI): Generic Syntax](https://tools.ietf.org/html/rfc3986)

slip-0014.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#SLIP-0014 : Stress Test Deterministic Wallet
2+
3+
```
4+
Number: SLIP-0014
5+
Title: Stress Test Deterministic Wallet
6+
Type: Informational
7+
Status: Draft
8+
Authors: Pavol Rusnak <[email protected]>
9+
Created: 2015-01-12
10+
```
11+
12+
##Abstract
13+
14+
SLIP-0014 describes a stress test deterministic wallet, which can be used
15+
to test various cornercases that such wallet can encounter.
16+
17+
##Motivation
18+
19+
During the development of myTREZOR deterministic wallet we realized there
20+
are quite a lot of different types of transactions in the network. In order
21+
to simplify testing of transaction history we came up with the idea to create
22+
a special xpub that will contain these various types of transactions.
23+
24+
##xpubs, xprvs, mnemonics, etc.
25+
26+
```
27+
mnemonic: all all all all all all all all all all all all
28+
29+
m/0/i account:
30+
xprv9xj9UhHNKHr6kJKJBVj82ZxFrbfhczBDUHyVj7kHGAiZqAeUenz2JhrphnMMYVKcWcVPFJESngtKsVa4FYEvFfWUTtZThCoZdwDeS9qQnqm
31+
xpub6BiVtCpG9fQPxnPmHXG8PhtzQdWC2Su4qWu6XW9tpWFYhxydCLJGrWBJZ5H6qTAHdPQ7pQhtpjiYZVZARo14qHiay2fvrX996oEP42u8wZy
32+
33+
m/i account:
34+
xprvA1xn6h6qAwinYq5P37sJsEY39ntjzDpueQPAX9dBQcU81dqZrfBJBVMVuyqnVrMRViPxriZkdLd2vTtpnJaoaomJ67JBk3G1xMagp89w2XX
35+
xpub6Ex8WCdj1KH5mK9r99QKENUmhpjEPgYm1dJmKY2nxx16tSAiQCVYjHfymFdzfpYDAHGtWYTif7WkUKLMULRJFPeV1hvEbeXqrM11K85yPjp
36+
```
37+
38+
[link to blockchain.info](https://blockchain.info/xpub/xpub6BiVtCpG9fQPxnPmHXG8PhtzQdWC2Su4qWu6XW9tpWFYhxydCLJGrWBJZ5H6qTAHdPQ7pQhtpjiYZVZARo14qHiay2fvrX996oEP42u8wZy)
39+
40+
##Addresses
41+
42+
index | address | private key
43+
------|------------------------------------|-----------------------------------------------------
44+
0 | 1JAd7XCBzGudGpJQSDSfpmJhiygtLQWaGL | L1KjqxZkUwdXaKNL15F2jJZVZpgi2HkHPHGyqTrQNNegyZez3A7Z
45+
1 | 1GWFxtwWmNVqotUPXLcKVL2mUKpshuJYo | KyBcuurcaJw6NqnZsmtpDqjbsS67PTXEZAK9QyFEDsyYjmNJJozj
46+
2 | 1Eni8JFS4yA2wJkicc3yx3QzCNzopLybCM | L3yYwqub7bYq6qKkPf9UAE7uuZYV8adAHvEaceXY9fKX8G7FDCoZ
47+
3 | 124dT55Jqpj9AKTyJnTX6G8RkUs7ReTzun | L2SNnZeTNHwgr9mayyHLZxmpyQN4SNbrxjBf9Rwq5Fvu2wwTm476
48+
4 | 15T9DSqc6wjkPxcr2MNVSzF9JAePdvS3n1 | L4jzKXRhQXesPeUSUNi7EMHAEBFzwJuAkZsNi5tja9rLxgGajwPv
49+
5 | 1GA9u9TfCG7SWmKCveBumdA1TZpfom6ZdJ | L1N67rzEMn6fqvhkFeDnt11LMxYdGZtGQgdYVuASNpmQRawgbJEN
50+
6 | 1PogPE3bXc84abzEuM2rJEZf2vCbCEZzXz | L3Y5pgT2ewKqdqh6kcGDQ7YHFoW5Vh4xErrPqb4Yjb5re9QYZw7D
51+
7 | 176U2WABbj4h5PCrxE963wmxzXd2Mw6bP4 | L2RpVajejxusxUXqLHTFJAyp1nzJnT2xuJpfm7Uah4GGUHz7XD58
52+
8 | 1HRZDR7CmLnq59w6mtzNa7SHtVWPSxdgKA | Kx8nBDjAkXkykD62AF8XjP8W5Z4a79iZC8Z7axyDWXsZTcn5agzM
53+
9 | 1MPdvYLzcekvEzAB7DmiHa1oU8Foh4KUw8 | L1xWyxmCkjsB2Z9wnjoZ5TGabeg8KbpZt1PjgVsKA9pn3L7JCiTs
54+
55+
##Transactions
56+
57+
# | block | transaction id | description
58+
----|--------|------------------------------------------------------------------|---------------------------------
59+
1 | 338841 | 350eebc1012ce2339b71b5fca317a0d174abc3a633684bc65a71845deb596539 | regular incoming transaction
60+
2 | 338841 | 1869cdbb3a86ab8b71a3e4a0d11135926b18f62bc0ebeb8e8a56635135616f00 | regular outgoing transaction
61+
3 | 341049 | 485579924ce684df7aa7a9861abb4b2858a8d917aa1df94bf3a234368a250516 | coinbase transaction
62+
4 | 341650 | a831a97917a3ae58a3c0cd700ed7ef08529b8218d3f71ed16152c7898c3d909e | regular outgoing transaction
63+
5 | 342246 | f54fae106758ffa17822b0f959f267eb9514b2fd7e15b89a98dad6e319e2af0c | sent to myself (in same account)
64+
65+
##References
66+
67+
- [BIP-0032: Hierarchical Deterministic Wallets](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)
68+
- [BIP-0039: Mnemonic code for generating deterministic keys](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki)
69+
- [BIP-0044: Multi-Account Hierarchy for Deterministic Wallets](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)

0 commit comments

Comments
 (0)