2

Could anyone kindly help me with this: I understand that there is no "compiling" and "deploying of contracts in hyperledger sawtooth as such. I tried working with the tuna-chain supply chain and there it seemed like one command $docker-composer up did it all. But how exactly does that work? I mean, say if I was making my own network on sawtooth, and I have written all the business logic (ie transaction processors), what are the docker files I need to make, how to make them?

The tuna supply chain code can be found here: https://github.com/hyperledger/education/tree/master/LFS171x/sawtooth-material

THANKS!

3 Answers3

5

The analogy of contracts in sawtooth are called Transaction Processors (TPs). Sawtooth can be deployed to a native machine as executables or interpreted code, or deployed as docker images. Docker compose files allow for bringing up a network of docker images that may/may not interact with each other.

There are a number of language development kits for sawtooth. For information on developing sawtooth TPs you should read through and understand the architecture, components, API, etc.: https://sawtooth.hyperledger.org/docs/core/releases/latest/

There is also the github repo that is chock full of example TPs: https://github.com/hyperledger/sawtooth-core

Frank C.
  • 7,758
  • 4
  • 35
  • 45
4

As Frank rightly said, Sawtooth provides interfaces to write your smart contract in any language. You can define how the transaction will be defined and how will they be processed to change the state of blockchain.

These smart contracts will be executed by transaction processors, which depends on transaction families. All the validation part will be handled by validators, Once validation is done, validator will forward the contracts for a particular transaction family to their transaction processor.

All the serialization is done on Protobuf to save space and add speed.

There is a great example which will clear your concepts. https://github.com/askmish/sawtooth-simplewallet In order to understand above repo, you need to have clear understanding of Transaction families, Transaction processors, Apply method.

GraphicalDot
  • 2,644
  • 2
  • 28
  • 43
1

The post is old however if you have discovered a better solution please share, otherwise here is what I discovered.

You need to run the transaction processor and connect it to validator in order to submit your transactions.

In reality it will be rare to have all the validators on the same machine which is the case in most of the examples available on Hyperledger Sawtooth documentation for Docker, Ubuntu and AWS. In a real life scenario, on a business network companies will be running their own systems within their own networks with a couple of validators, settings-tp, rest-api and custom transaction processors. These validators will be connecting to other validators on the business network and that’s why only validator’s port is advised to open for world.

I wish there could be an easy way to register custom transaction processor on a running network possiby something like a cli similar to azure or aws, a native sawtooth cli that could connect to any sawtooth validator, upload transaction processor using a certificate and that transaction family become available for all future transactions.

Farrukh
  • 11
  • 1