10
10
[ ![ unsafe forbidden] ( https://img.shields.io/badge/unsafe-forbidden-success.svg )] ( https://github.com/rust-secure-code/safety-dance/ )
11
11
[ ![ Apache-2 licensed] ( https://img.shields.io/crates/l/single_use_seals )] ( ./LICENSE )
12
12
13
- This is an implementation of [ LNPBP-4 ] multi-commitment standard and [ LNPBP-9 ]
14
- standard, defining to cryptographic commitment schemes used in
15
- client-side-validation. It is a part of more generic [ ` client_side_validation ` ]
16
- library covering other client-side-validation standards .
13
+ This is an implementation of [ LNPBP-8 ] single-use-seal abstraction.
14
+ Specifically, it provides a set of traits that allow to implement Peter's Todd
15
+ ** single-use seal ** paradigm. Information in this file partially contains
16
+ extracts from Peter's works listed in "Further reading" section .
17
17
18
- Client-side-validation is a paradigm for distributed computing, based on top of
19
- proof-of-publication/commitment medium layer, which may be a bitcoin blockchain
20
- or other type of distributed consensus system.
18
+ The library is a part of more generic [ ` client_side_validation ` ] library
19
+ covering other client-side-validation standards. Client-side-validation is a
20
+ paradigm for distributed computing, based on top of proof-of-publication/
21
+ commitment medium layer, which may be a bitcoin blockchain or other type of
22
+ distributed consensus system.
21
23
22
24
The development of the library is supported by [ LNP/BP Standards Association] ( https://lnp-bp.org ) .
23
- The original idea of client-side-validation was proposed by Peter Todd with its
24
- possible applications designed by Giacomo Zucco. It was shaped into a protocol-
25
- level design by Dr Maxim Orlovsky with a big input from the community and
26
- implemented by him as this set of libraries.
27
25
28
26
29
27
## Documentation
@@ -38,7 +36,7 @@ and [LNP/BP tech talks videos](https://www.youtube.com/channel/UCK_Q3xcQ-H3ERwAr
38
36
39
37
## Usage
40
38
41
- To use the library, you just need to reference a latest version, in
39
+ To use the library, you just need to reference the latest version, in
42
40
` [dependencies] ` section of your project ` Cargo.toml ` .
43
41
44
42
``` toml
@@ -52,6 +50,81 @@ including the current one.
52
50
The library does not expose any feature flags and have only a single dependency
53
51
on ` amplify_derive ` crate, also created and supported by the LNP/BP Association.
54
52
53
+ ## More information
54
+
55
+ ### Single-use-seals definition
56
+
57
+ Analogous to the real-world, physical, single-use-seals used to secure
58
+ shipping containers, a single-use-seal primitive is a unique object that can
59
+ be closed over a message exactly once. In short, a single-use-seal is an
60
+ abstract mechanism to prevent double-spends.
61
+
62
+ A single-use-seal implementation supports two fundamental operations:
63
+ * ` Close(l,m) → w ` — Close seal l over message m, producing a witness ` w ` .
64
+ * ` Verify(l,w,m) → bool ` — Verify that the seal l was closed over message ` m ` .
65
+
66
+ A single-use-seal implementation is secure if it is impossible for an
67
+ attacker to cause the Verify function to return true for two distinct
68
+ messages m1, m2, when applied to the same seal (it is acceptable, although
69
+ non-ideal, for there to exist multiple witnesses for the same seal/message
70
+ pair).
71
+
72
+ Practical single-use-seal implementations will also obviously require some
73
+ way of generating new single-use-seals:
74
+ * ` Gen(p)→l ` — Generate a new seal basing on some seal definition data ` p ` .
75
+
76
+ ### Terminology
77
+
78
+ ** Single-use-seal** : a commitment to commit to some (potentially unknown)
79
+ message. The first commitment (i.e. single-use-seal) must be a
80
+ well-defined (i.e. fully specified and unequally identifiable
81
+ in some space, like in time/place or within a given formal informational
82
+ system).
83
+ ** Closing of a single-use-seal over message** : a fulfilment of the first
84
+ commitment: creation of the actual commitment to some message in a form
85
+ unequally defined by the seal.
86
+ ** Witness** : data produced with closing of a single use seal which are
87
+ required and sufficient for an independent party to verify that the seal
88
+ was indeed closed over a given message (i.e. the commitment to the message
89
+ had being created according to the seal definition).
90
+
91
+ NB: It's important to note, that while its possible to deterministically
92
+ define was a given seal closed it yet may be not possible to find out
93
+ if the seal is open; i.e. seal status may be either "closed over message"
94
+ or "unknown". Some specific implementations of single-use-seals may define
95
+ procedure to deterministically prove that a given seal is not closed (i.e.
96
+ opened), however this is not a part of the specification and we should
97
+ not rely on the existence of such possibility in all cases.
98
+
99
+ ### Trait structure
100
+
101
+ The module defines trait ` SealProtocol ` that can be used for
102
+ implementation of single-use-seals with methods for seal close and
103
+ verification. A type implementing this trait operates only with messages
104
+ (which is represented by any type that implements ` AsRef<[u8]> ` ,i.e. can be
105
+ represented as a sequence of bytes) and witnesses (which is represented by
106
+ an associated type ` SealProtocol::Witness ` ). At the same time,
107
+ ` SealProtocol ` can't define seals by itself.
108
+
109
+ Seal protocol operates with a * seal medium * : a proof of publication medium
110
+ on which the seals are defined.
111
+
112
+ The module provides two options of implementing such medium: synchronous
113
+ ` SealProtocol ` and asynchronous ` SealProtocolAsync ` .
114
+
115
+ ### Sample implementation
116
+
117
+ Examples of implementations can be found in ` bp::seals ` module of ` bp-core `
118
+ crate.
119
+
120
+ ### Further reading
121
+
122
+ * Peter Todd. Preventing Consensus Fraud with Commitments and
123
+ Single-Use-Seals.
124
+ < https://petertodd.org/2016/commitments-and-single-use-seals > .
125
+ * Peter Todd. Scalable Semi-Trustless Asset Transfer via Single-Use-Seals
126
+ and Proof-of-Publication. 1. Single-Use-Seal Definition.
127
+ < https://petertodd.org/2017/scalable-single-use-seal-asset-transfer >
55
128
56
129
## Contributing
57
130
@@ -64,3 +137,4 @@ The libraries are distributed on the terms of Apache 2.0 opensource license.
64
137
See [ LICENCE] ( LICENSE ) file for the license details.
65
138
66
139
[ `client_side_validation` ] : https://crates.io/crates/client_side_validation
140
+ [ LNPBP-8 ] : https://github.com/LNP-BP/LNPBPs/blob/master/lnpbp-0008.md
0 commit comments