|
| 1 | +# Guide to Subspaces |
| 2 | + |
| 3 | +## Operating a Space |
| 4 | + |
| 5 | +### 1. Initialize the Space |
| 6 | + |
| 7 | +Initialize your space for operation: |
| 8 | + |
| 9 | +```bash |
| 10 | +$ space-cli operate @bitcoin |
| 11 | +``` |
| 12 | + |
| 13 | +### 2. Issue Subspaces |
| 14 | + |
| 15 | +Use [subs](https://github.com/spacesprotocol/subs) to issue subspaces off-chain and create commitments. |
| 16 | + |
| 17 | + |
| 18 | +An **end-user** can generate a key pair like this: |
| 19 | + |
| 20 | +``` |
| 21 | +$ subs request alice@bitcoin |
| 22 | +✔ Created handle request |
| 23 | + |
| 24 | + → Private key saved: [email protected] |
| 25 | +``` |
| 26 | + |
| 27 | +An **operator** such as @bitcoin, can accept requests into their tree: |
| 28 | + |
| 29 | +``` |
| 30 | + |
| 31 | +``` |
| 32 | + |
| 33 | + |
| 34 | +For this example, we will commit just one handle, but it's more efficient to add a large batch of handles before making a commitment. |
| 35 | + |
| 36 | +``` |
| 37 | +$ subs commit |
| 38 | +✔ Committed batch |
| 39 | + → Tree root: 79d39952ac5a8d6daedd48e59c0a58d12d10644c09f2fa3c70e9fe76e72f866a |
| 40 | +``` |
| 41 | + |
| 42 | + |
| 43 | +### 3. Submit Commitments |
| 44 | + |
| 45 | +After your tree is updated, commit it's root hash. Each commitment is cryptographically bound to all previous commitments you made on-chain. |
| 46 | + |
| 47 | +**Example:** To submit a commitment for `@bitcoin` with root hash `79d39952ac5a8d6daedd48e59c0a58d12d10644c09f2fa3c70e9fe76e72f866a`: |
| 48 | + |
| 49 | +```bash |
| 50 | +$ space-cli commit @bitcoin 79d39952ac5a8d6daedd48e59c0a58d12d10644c09f2fa3c70e9fe76e72f866a |
| 51 | +``` |
| 52 | + |
| 53 | +**Retrieve commitments** for a space: |
| 54 | + |
| 55 | +```bash |
| 56 | +$ space-cli getcommitment @bitcoin |
| 57 | +``` |
| 58 | + |
| 59 | + |
| 60 | +### Delegating Operational Control |
| 61 | + |
| 62 | +You can authorize another party to make commitments on your behalf: |
| 63 | + |
| 64 | +```bash |
| 65 | +$ space-cli delegate @bitcoin --to <operator-address> |
| 66 | +``` |
| 67 | + |
| 68 | +## Binding Handles On-Chain |
| 69 | + |
| 70 | +Handles like `alice@bitcoin` are bound to unique script pubkeys off-chain and are designed to remain off-chain by default. However, when on-chain interactivity is required, handles can be bound to UTXOs with minimal on-chain footprint. |
| 71 | + |
| 72 | +### Creating a Space Pointer |
| 73 | + |
| 74 | +Given a handle with its associated script pubkey: |
| 75 | + |
| 76 | +```json |
| 77 | +{ |
| 78 | + "handle": "alice@bitcoin", |
| 79 | + "script_pubkey": "5120d3c3196cb3ed7fa79c882ed62f8e5942e546130d5ae5983da67dbb6c9bdd2e79" |
| 80 | +} |
| 81 | +``` |
| 82 | + |
| 83 | +You can create an on-chain identifier that only the controller of the script pubkey can use, without requiring additional metadata on-chain: |
| 84 | + |
| 85 | +```bash |
| 86 | +$ space-cli createptr 5120d3c3196cb3ed7fa79c882ed62f8e5942e546130d5ae5983da67dbb6c9bdd2e79 |
| 87 | +``` |
| 88 | + |
| 89 | +This command creates a UTXO with the same script pubkey and "mints" a space pointer (sptr) derived from it: |
| 90 | + |
| 91 | +``` |
| 92 | +sptr13thcluavwywaktvv466wr6hykf7x5avg49hgdh7w8hh8chsqvwcskmtxpd |
| 93 | +``` |
| 94 | + |
| 95 | +The space pointer serves as a permanent, transferable on-chain reference for the handle that can be sold and transferred like any other space UTXO. |
0 commit comments