Indy-sdk error running python sample: Invalid claim_offer_json: missing field `schema_seq_no`


#1

I’m trying to setup an indy-sdk development environment to get some hands-on experience in developing using indy. So far it had been an uphill battle.

After I went through the dev setup steps (https://github.com/hyperledger/indy-node/blob/master/docs/setup-dev.md) I tried running the indy-sdk python samples using pyCharm (found some help on setting this up elsewhere on the forum). When I run the sample all seems well until step CreateAndStoreClaimRequest command received. It then pauses for a while and eventually gives error:

src/errors/indy.rs:63 | Casting error to ErrorCode: Invalid structure: Invalid claim_offer_json: missing field schema_seq_no at line 1 column 158

It looks like there is a mismatch between these samples and indy-anoncreds but I’m not sure. How to resolve this error? Any help getting the samples up and running would be much appreciated.

It might be related to this earlier forum post by indy.indian who also has trouble running the python samples, but got a different error:
https://sovrin.discoursehosting.net/t/error-executing-indy-sdk-in-python-help-required/481

sidenote:
After this initial run subsequent runs give errors about wallets and master_secrets that already exist. I commented out these lines to reproduce the initial error but it would be nice if the code would be repeatable (check if creating them is needed).

Output:
…/indy-sdk/samples/python/src/main.py
INFO:src.anoncreds:Anoncreds sample -> started
INFO|command_executor | src/commands/mod.rs:71 | Worker thread started
INFO|indy::commands | src/commands/mod.rs:115 | WalletCommand command received
INFO|wallet_command_executor | src/commands/wallet.rs:81 | Open command received
INFO|indy::commands | src/commands/mod.rs:115 | WalletCommand command received
INFO|wallet_command_executor | src/commands/wallet.rs:81 | Open command received
INFO|indy::commands | src/commands/mod.rs:95 | AnoncredsCommand command received
INFO|anoncreds_command_executor | src/commands/anoncreds/mod.rs:44 | Issuer command received
INFO|issuer_command_executor | src/commands/anoncreds/issuer.rs:73 | CreateAndStoreClaim command received
INFO|anoncreds_service | src/services/anoncreds/issuer.rs:24 | Issuer generate claim definition for Schema Schema { seq_no: 1, data: SchemaData { name: “gvt”, version: “1.0”, attr_names: {“sex”, “age”, “name”, “height”} } } -> start
INFO|anoncreds_service | src/services/anoncreds/issuer.rs:46 | Issuer generate primary keys for Schema Schema { seq_no: 1, data: SchemaData { name: “gvt”, version: “1.0”, attr_names: {“sex”, “age”, “name”, “height”} } } -> start
INFO|anoncreds_service | src/services/anoncreds/issuer.rs:53 | Issuer generate_safe_prime
INFO|anoncreds_service | src/services/anoncreds/issuer.rs:56 | Issuer generate_safe_prime -> done
INFO|anoncreds_service | src/services/anoncreds/issuer.rs:79 | Issuer generate primary keys for Schema Schema { seq_no: 1, data: SchemaData { name: “gvt”, version: “1.0”, attr_names: {“sex”, “age”, “name”, “height”} } } -> done
INFO|anoncreds_service | src/services/anoncreds/issuer.rs:41 | Issuer generate claim definition for Schema Schema { seq_no: 1, data: SchemaData { name: “gvt”, version: “1.0”, attr_names: {“sex”, “age”, “name”, “height”} } } -> done
INFO|indy::commands | src/commands/mod.rs:95 | AnoncredsCommand command received
INFO|anoncreds_command_executor | src/commands/anoncreds/mod.rs:48 | Prover command received
INFO|prover_command_executor | src/commands/anoncreds/prover.rs:110 | CreateAndStoreClaimRequest command received
ERROR|indy::errors::indy | src/errors/indy.rs:63 | Casting error to ErrorCode: Invalid structure: Invalid claim_offer_json: missing field schema_seq_no at line 1 column 158
WARNING:indy.libindy:_indy_loop_callback: Function returned error 113
Traceback (most recent call last):
File “/home/dev/indy-sdk/samples/python/src/main.py”, line 15, in
loop.run_until_complete(main())
File “/usr/lib/python3.5/asyncio/base_events.py”, line 387, in run_until_complete
return future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 274, in result
raise self._exception
File “/usr/lib/python3.5/asyncio/tasks.py”, line 241, in _step
result = coro.throw(exc)
File “/home/dev/indy-sdk/samples/python/src/main.py”, line 8, in main
await anoncreds.demo()
File “/home/dev/indy-sdk/samples/python/src/anoncreds.py”, line 62, in demo
claim_def_json, master_secret_name)
File “/home/dev/.virtualenvs/quintor/lib/python3.5/site-packages/indy/anoncreds.py”, line 380, in prover_create_and_store_claim_req
prover_create_and_store_claim_req.cb)
File “/usr/lib/python3.5/asyncio/futures.py”, line 361, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 296, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 274, in result
raise self._exception
indy.error.IndyError: ErrorCode.CommonInvalidStructure

Process finished with exit code 1


#2

I’ve reached out to some developers who are closer to this. Hopefully they will see this and respond by Monday.


#3

That would be great. Thanks!


#4

Hi enijboer.
It looks like you have Libindy stable version installed. Current samples code aren`t compatible with this version.
Please try to install latest Libiny-Master version and re-run samples.

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88
sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial master"
sudo apt-get update
sudo apt-get install -y libindy


#5

Hi @Artem.ivanov,

Thanks for your response. I removed libindy, removed the sovrin repositories (from sources.list) and then followed your instructions. Did a reboot of the machine just to be sure, started the node and ran the sample code again. Unfortunately with the same result (Error: Invalid structure: Invalid claim_offer_json: missing fieldschema_seq_noat line 1 column 158).

So I’m wondering if the correct version was installed. Current libindy version 1.3.0~337 is installed. Is that the version I should be using?

Etienne


#6

Additionally I also repeated the same steps but then tried it with the libindy version from the RC repository (1.3.0~9). Unfortunately again with the same outcome except that the error now came a lot faster (response from seconds to within the second).

Etienne


#7

I checked it on my local machine. Samples from master-branch with libindy_1.3.0~337_amd64.deb work well.
I also checked it in docker.
Try run samples in docker too (Ubuntu testing chapter): https://github.com/hyperledger/indy-sdk/blob/e78792c1518b24ce9915caa410ebcf90ffbd9e73/doc/test-design.md


#8

Thanks for the additional info. It looks like I got the python sample working.

I also found out how to resolve the errors about wallets (etc…) that already existed. What I tried to resolve it was reset (read delete) the node data by removing /var/lib/indy and re-run generate_indy_pool_transactions. But that didn’t help. Only after removing ~/.indy_client/wallet I was (finally) able to re-run the python sample without any errors :relieved:.

As I’m not well experienced with python I’ll hopefully be able to get the java or otherwise .net sample running as well. But for now, thanks for helping out with getting the python sample running.

Etienne


#9

@enijboer
You can join us in RocketChat (https://chat.hyperledger.org/channel/indy-sdk) and ask there any questions (for faster our reaction).


#10

@Artem.ivanov Thanks, will do.