forked from hyperledger-archives/indy-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.py
52 lines (36 loc) · 1.35 KB
/
template.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Example demonstrating how to write Schema and Cred Definition on the ledger
As a setup, Steward (already on the ledger) adds Trust Anchor to the ledger.
After that, Steward builds the SCHEMA request to add new schema to the ledger.
Once that succeeds, Trust Anchor uses anonymous credentials to issue and store
claim definition for the Schema added by Steward.
"""
import asyncio
import json
import pprint
from indy import pool, ledger, wallet, did, anoncreds
from indy.error import ErrorCode, IndyError
from utils import get_pool_genesis_txn_path, PROTOCOL_VERSION
pool_name = 'pool'
genesis_file_path = get_pool_genesis_txn_path(pool_name)
wallet_config = json.dumps({"id": "wallet"})
wallet_credentials = json.dumps({"key": "wallet_key"})
def print_log(value_color="", value_noncolor=""):
"""set the colors for text."""
HEADER = '\033[92m'
ENDC = '\033[0m'
print(HEADER + value_color + ENDC + str(value_noncolor))
async def write_schema_and_cred_def():
try:
await pool.set_protocol_version(PROTOCOL_VERSION)
# Step 2 code goes here.
# Step 3 code goes here.
# Step 4 code goes here.
except IndyError as e:
print('Error occurred: %s' % e)
def main():
loop = asyncio.get_event_loop()
loop.run_until_complete(write_schema_and_cred_def())
loop.close()
if __name__ == '__main__':
main()