0

I successfully built and ran the transaction processor for supply chain on ubuntu 16.04. Now I would like to create a client transaction using the python sdk. I referred to
https://sawtooth.hyperledger.org/docs/core/nightly/1-2/_autogen/sdk_submit_tutorial_python.html and https://sawtooth.hyperledger.org/docs/supply-chain/nightly/master/family_specification.html#transactions as reference.

But so far the validator always rejects my transaction and calls it invalid. My TP is running correctly and is receiving the transaction but is unable to deserialize the payload.

Does anyone have an example script in python for creating a transaction? For example creating a new agent or fish?

Arun
  • 592
  • 3
  • 13
Razorneck
  • 65
  • 6
  • Here is one easy to understand example client in Python https://github.com/danintel/sawtooth-cookiejar/tree/master/pyclient – Arun Nov 12 '19 at 08:35
  • I just realized we have to serialize our payload with proto for the supply-chain-tp. But I am now struggling to get the generated python class from proto (payload_pb2.py). In the supply chain repo [link](https://github.com/hyperledger/sawtooth-supply-chain/blob/master/tests/sawtooth_sc_test/supply_chain_message_factory.py) the payload_pb2 file was imported. But I can't find or generate it. – Razorneck Nov 12 '19 at 12:48
  • you can generate proto class with shell protoc -I=./ --python_out=./ proto_name.proto or you can get a script here: https://github.com/hyperledger/education-sawtooth-simple-supply/blob/master/bin/simple-supply-protogen – Harun-Ur-Rashid Nov 13 '19 at 06:41
  • follow the latest documentation instead of nighty https://sawtooth.hyperledger.org/docs/core/releases/latest/app_developers_guide/ubuntu.html – Harun-Ur-Rashid Nov 13 '19 at 06:45

1 Answers1

0

Now it works. I was able to generate the .proto files from https://github.com/hyperledger/sawtooth-supply-chain/tree/master/protos for python. After installing the supply-rest-api the validator accepts my payload.

Razorneck
  • 65
  • 6