1
1
# Introduction
2
2
3
3
Not being able to persist data across calls would limit the utility of smart
4
- contracts. How could a smart contract
4
+ contracts. Think of these problems:
5
5
6
- - implement a token if it could not keep track of balances,
7
- - implement a voting system if it could not keep track of votes, or
8
- - implement a game if it could not keep track of scores?
6
+ - How could a smart contract implement a token if it could not keep track of
7
+ balances?
8
+ - How could a smart contract implement a voting system if it could not keep
9
+ track of votes?
10
+ - How could a smart contract implement a game if it could not keep track of
11
+ scores?
9
12
10
13
This is why a _ CosmWasm_ smart contract has access to the storage facilities
11
14
offered by the _ Cosmos SDK_ . These facilities are essentially a binary key-value
@@ -16,9 +19,9 @@ store, with records stored on-chain.
16
19
While developing smart contracts, it's important to remember on-chain storage
17
20
is, as always, pricey. Conventionally, developers often draw the line at a
18
21
"small logo image" (think a few KBs). If you need to store bigger things, it's
19
- likely time to consider off-chain storage (like IPFS or some centralized storage).
20
- Techniques for securely and reliably storing large data off-chain are beyond the
21
- scope of this document.
22
+ likely time to consider off-chain storage (like IPFS or some centralized
23
+ storage). Techniques for securely and reliably storing large data off-chain are
24
+ beyond the scope of this document.
22
25
23
26
Trying to minimize bloat is always good practice when it comes to on-chain
24
27
storage.
@@ -31,11 +34,12 @@ storing and retrieving data. If you're curious, you can check it out right
31
34
32
35
This API is raw in that it exposes the ** binary** key-value store. While you're
33
36
free to use it directly, you're likely to find that finicky and error-prone.
34
- _ cw-storage-plus_ is a library that builds on top of this API to
37
+ _ cw-storage-plus_ is a library that builds on top of this API to do the
38
+ following:
35
39
36
- - eliminate the need to manually serialize and deserialize data,
37
- - provide a type-safe interface for storing and retrieving data,
38
- - help manage keys, and
39
- - provide featureful persistent data structures.
40
+ - eliminate the need to manually serialize and deserialize data
41
+ - provide a type-safe interface for storing and retrieving data
42
+ - help manage keys
43
+ - provide featureful persistent data structures
40
44
41
45
Let's explore!
0 commit comments