mirror of
https://github.com/aljazceru/nutshell.git
synced 2026-02-04 16:24:21 +01:00
update readme
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
**The author is NOT a cryptographer and has not tested the libraries used or the code nor has anyone reviewed the work. This means it's very likely a fatal flaw somewhere. This is meant only as educational and is not production ready.**
|
||||
|
||||
Ecash implementation based on David Wagner's variant of Chaumian blinding. Token logic based on [minicash](https://github.com/phyro/minicash) ([description](https://gist.github.com/phyro/935badc682057f418842c72961cf096c)) which implements a [Blind Diffie-Hellman Key Exchange](https://cypherpunks.venona.com/date/1996/03/msg01848.html) scheme written down by Ruben Somsen [here](https://gist.github.com/RubenSomsen/be7a4760dd4596d06963d67baf140406).
|
||||
Ecash implementation based on David Wagner's variant of Chaumian blinding. Token logic based on [minicash](https://github.com/phyro/minicash) ([description](https://gist.github.com/phyro/935badc682057f418842c72961cf096c)) which implements a [Blind Diffie-Hellman Key Exchange](https://cypherpunks.venona.com/date/1996/03/msg01848.html) scheme written down by Ruben Somsen [here](https://gist.github.com/RubenSomsen/be7a4760dd4596d06963d67baf140406). The database mechanics and the Lightning backend is inspired by [LNbits](https://github.com/lnbits/lnbits-legend).
|
||||
|
||||
Big thanks to [phyro](https://github.com/phyro) for their work and further discussions and improvements.
|
||||
|
||||
## Install
|
||||
|
||||
|
||||
@@ -63,8 +63,7 @@ class LedgerAPI:
|
||||
json={"x": str(B_.x), "y": str(B_.y)},
|
||||
).json()
|
||||
if "error" in promises:
|
||||
print("Error: {}".format(promises["error"]))
|
||||
return []
|
||||
raise Exception("Error: {}".format(promises["error"]))
|
||||
return self._construct_proofs(promises, [(r, secret)])
|
||||
|
||||
def split(self, proofs, amount):
|
||||
@@ -94,8 +93,7 @@ class LedgerAPI:
|
||||
json={"proofs": proofs, "amount": amount, "output_data": output_data},
|
||||
).json()
|
||||
if "error" in promises:
|
||||
print("Error: {}".format(promises["error"]))
|
||||
return [], []
|
||||
raise Exception("Error: {}".format(promises["error"]))
|
||||
|
||||
# Obtain proofs from promises
|
||||
fst_proofs = self._construct_proofs(
|
||||
@@ -129,7 +127,7 @@ class Wallet(LedgerAPI):
|
||||
for amount in split:
|
||||
proofs = super().mint(amount)
|
||||
if proofs == []:
|
||||
return []
|
||||
raise Exception("received no proofs")
|
||||
new_proofs += proofs
|
||||
await self._store_proofs(proofs)
|
||||
self.proofs += new_proofs
|
||||
@@ -141,7 +139,7 @@ class Wallet(LedgerAPI):
|
||||
async def split(self, proofs, amount):
|
||||
fst_proofs, snd_proofs = super().split(proofs, amount)
|
||||
if len(fst_proofs) == 0 and len(snd_proofs) == 0:
|
||||
return [], []
|
||||
raise Exception("received no splits")
|
||||
used_secrets = [p["secret"] for p in proofs]
|
||||
self.proofs = list(
|
||||
filter(lambda p: p["secret"] not in used_secrets, self.proofs)
|
||||
|
||||
Reference in New Issue
Block a user