|
1 | 1 | # State Transition SDK |
2 | 2 |
|
3 | | -An SDK for managing assets on the Unicity Protocol, supporting off-chain state with on-chain security guarantees. |
4 | | - |
5 | 3 | ## Overview |
6 | 4 |
|
7 | 5 | The State Transition SDK is a TypeScript library that provides an off-chain token transaction framework. Tokens are managed, stored, and transferred off-chain with only cryptographic commitments published on-chain, ensuring privacy while preventing double-spending through single-spend proofs. |
8 | | - |
| 6 | +This is a low-level SDK, that supports transferring tokens, making payments, and splitting tokens. |
9 | 7 | In this system, tokens are self-contained entities containing complete transaction history and cryptographic proofs attesting to their current state (ownership, value, etc.). State transitions are verified through consultation with blockchain infrastructure (Unicity) to produce proof of single spend. |
10 | 8 |
|
11 | 9 | ### Key Features |
@@ -63,6 +61,35 @@ I --> J[End] |
63 | 61 |
|
64 | 62 | ### Token Structure |
65 | 63 |
|
| 64 | +``` |
| 65 | +Token { |
| 66 | + genesis: CertifiedMintTransaction { |
| 67 | + transaction: MintTransaction { |
| 68 | + sourceStateHash: MintTransactionState, |
| 69 | + lockScript: IPredicate, |
| 70 | + recipient: PayToScriptHash, |
| 71 | + tokenId: TokenId, |
| 72 | + tokenType: TokenType, |
| 73 | + data: Uint8Array |
| 74 | + }, |
| 75 | + inclusionProof: InclusionProof |
| 76 | + }, |
| 77 | + transactions: [ |
| 78 | + CertifiedTransferTransaction { |
| 79 | + transaction: TransferTransaction { |
| 80 | + sourceStateHash: DataHash, |
| 81 | + lockScript: IPredicate, |
| 82 | + recipient: PayToScriptHash, |
| 83 | + x: Uint8Array, |
| 84 | + data: Uint8Array |
| 85 | + }, |
| 86 | + inclusionProof: InclusionProof |
| 87 | + }, |
| 88 | + ... |
| 89 | + ] |
| 90 | +} |
| 91 | +``` |
| 92 | + |
66 | 93 | ### Privacy Model |
67 | 94 | - **Commitment-based**: Only cryptographic commitments published on-chain |
68 | 95 | - **Self-contained**: Tokens include complete transaction history |
@@ -129,16 +156,14 @@ npm run lint:fix |
129 | 156 |
|
130 | 157 | ## Examples |
131 | 158 |
|
132 | | -### Minting Tokens |
133 | | - |
134 | | -Note that the examples here are using some utility functions and classes that are defined below in a separate section. |
135 | | - |
136 | | -```typescript |
137 | | -``` |
| 159 | +### Minting Tokens |
| 160 | +`tests/examples/mint/ExampleTest.ts` |
138 | 161 |
|
139 | 162 | ### Token Transfer |
| 163 | +`tests/examples/transfer/ExampleTest.ts` |
140 | 164 |
|
141 | | -### Checking Token Status |
| 165 | +### Token Splitting |
| 166 | +`tests/examples/split/ExampleTest.ts` |
142 | 167 |
|
143 | 168 | ## Unicity Signature Standard |
144 | 169 |
|
|
0 commit comments