Skip to content

Commit 21f718d

Browse files
author
Oleksandr Anyshchenko
committed
Added example how to use tx hash
1 parent 2c58a70 commit 21f718d

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

work.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from uuid import uuid4
2-
1+
import json
32
import exonum.transactions as tx
43
import exonum.datatypes as exonum
54

5+
from uuid import uuid4
66
from pysodium import crypto_sign_keypair
77

88
from importlib import reload
@@ -24,21 +24,18 @@
2424
# a.tx(secret_key)
2525

2626
public_key = bytes.fromhex(
27-
"0f17189c062e7f3fbb47a21834d41e4d5c5388dd7db38c4de1ce732971a38ef9"
28-
)
27+
"0f17189c062e7f3fbb47a21834d41e4d5c5388dd7db38c4de1ce732971a38ef9")
2928
secret_key = bytes.fromhex(
30-
"5520c351b7760aedeef32687918eb2587ab515e4ae0eeef271a0f0a99f1df3710f17189c062e7f3fbb47a21834d41e4d5c5388dd7db38c4de1ce732971a38ef9"
31-
)
29+
"5520c351b7760aedeef32687918eb2587ab515e4ae0eeef271a0f0a99f1df3710f17189c062e7f3fbb47a21834d41e4d5c5388dd7db38c4de1ce732971a38ef9")
3230

3331

3432
@transactions
3533
class CreateUser(metaclass=exonum.EncodingStruct):
36-
public_key = exonum.PublicKey
37-
name = exonum.Str
34+
public_key = exonum.PublicKey()
35+
name = exonum.Str()
3836

3937

4038
a = CreateUser(public_key=public_key, name="Me")
4139

42-
import json
43-
4440
print(json.dumps(a.tx(secret_key), indent=2))
41+
print('tx hash:', a.hash(secret_key))

0 commit comments

Comments
 (0)