Skip to content
arthurgreef edited this page Jan 27, 2018 · 31 revisions

Overviews, notes, etc. for sawtooth-uom development

Housekeeping

How I reset my environment to get to version 1.0 of HL/ST.

Sawtooth platform

  1. Remove all docker images using this command docker rmi -f $(docker images -a -q)
  2. Bring down the latest sawtooth compose file sawtooth-default.yaml
  3. Execute compose docker-compose -f ~/sawtooth.misc/sawtooth-default.yaml up

Sawtooth repo development

  1. Clone the latest repository
  2. Go to the root directory of the repo cd ~\sawtooth-core
  3. At a minimum do bin\build_all -l python
  4. I am using java so I do a bin\build_all -l java as well

Sawtooth development

Contrary to previous beliefs, one does not need to develop from within a sawtooth sdk image.

uomkey example (java, macos)

Building the uomkey image

$ cd ~/sawtooth/core/sdk/java
$ mvn install
$ cd ~/sawtooth-uom/examples/uom_intkey
$ mvn package
$ docker build . -t uomkey

Incorporating uomkey as part of the sawtooth composition

A sawtooth-uom ready composition is in this repos example directory

Start the local composition

$ cd ~/sawtooth-uom/examples
$ docker-compose -f sawtooth-local.yaml up

# You will see this beautiful line in the log being produced

sawtooth-validator-local | [2018-01-22 08:45:38.652 INFO     processor_handlers] registered transaction processor: connection_id=307972120e668399cd386bd106076e5d19f1512b1a7b0232098cd65bc9ba980ef189090455599a1a901cf4980c61c15c33ceae5c4077878e5b89cea9d7fd6cab, family=uomkey, version=1.0, namespaces=['f526a9']
uomkey-local        | UOM TP Ready for execution. Entering event thread

Drive transactions (hijacked intkey)

# log into the client image

$ cd ~/sawtooth-uom/examples

$ docker-compose -f sawtooth-local.yaml exec client bash

# Generate and run a transaction batch
root@a0d42cccf53a:~# intkey create_batch --count 10 --key-count 5
root@a0d42cccf53a:~# intkey load -f batches.intkey -U http://rest-api:8008

At this point you will see something like the following in the sawtooth screen:

uomkey-local   | UOM in apply!!!
uomkey-local   | UOM decodePayload called
uomkey-local   | OyAHTT
uomkey-local   | apply verb dec
uomkey-local   | UOM decodeState called
uomkey-local   | UOM encodeState called
uomkey-local   | Jan 22, 2018 10:54:16 AM sawtooth.uom.intkey.IntegerKeyHandler apply
uomkey-local   | INFO: Verb: dec Name: OyAHTT value: 8
uomkey-local   | UOM family name requested
uomkey-local   | UOM version requested
uomkey-local   | UOM in apply!!!
uomkey-local   | UOM decodePayload called
uomkey-local   | OyAHTT
uomkey-local   | apply verb dec
uomkey-local   | UOM decodeState called
uomkey-local   | UOM encodeState called
uomkey-local   | Jan 22, 2018 10:54:16 AM sawtooth.uom.intkey.IntegerKeyHandler apply
uomkey-local   | INFO: Verb: dec Name: OyAHTT value: 1
uomkey-local   | UOM family name requested
uomkey-local   | UOM version requested
uomkey-local   | UOM in apply!!!
uomkey-local   | UOM decodePayload called
uomkey-local   | OyAHTT
uomkey-local   | apply verb inc
uomkey-local   | UOM decodeState called
uomkey-local   | UOM encodeState called
uomkey-local   | Jan 22, 2018 10:54:16 AM sawtooth.uom.intkey.IntegerKeyHandler apply
uomkey-local   | INFO: Verb: inc Name: OyAHTT value: 1
uomkey-local   | UOM family name requested
uomkey-local   | UOM version requested
uomkey-local   | UOM in apply!!!
uomkey-local   | UOM decodePayload called
uomkey-local   | LMlmkn
uomkey-local   | apply verb inc
uomkey-local   | UOM decodeState called
uomkey-local   | UOM encodeState called
uomkey-local   | Jan 22, 2018 10:54:16 AM sawtooth.uom.intkey.IntegerKeyHandler apply
uomkey-local   | INFO: Verb: inc Name: LMlmkn value: 9
uomkey-local   | UOM family name requested
uomkey-local   | UOM version requested
uomkey-local   | UOM in apply!!!
uomkey-local   | UOM decodePayload called
uomkey-local   | zVtdht
uomkey-local   | apply verb inc
uomkey-local   | UOM decodeState called
uomkey-local   | UOM encodeState called
uomkey-local   | Jan 22, 2018 10:54:16 AM sawtooth.uom.intkey.IntegerKeyHandler apply
uomkey-local   | INFO: Verb: inc Name: zVtdht value: 4
uomkey-local   | UOM family name requested
uomkey-local   | UOM version requested
uomkey-local   | UOM in apply!!!
uomkey-local   | UOM decodePayload called
uomkey-local   | LMlmkn
uomkey-local   | apply verb inc
uomkey-local   | UOM decodeState called
uomkey-local   | UOM encodeState called
uomkey-local   | Jan 22, 2018 10:54:16 AM sawtooth.uom.intkey.IntegerKeyHandler apply
uomkey-local   | INFO: Verb: inc Name: LMlmkn value: 2

Python Development

Unit Testing

Running sawtooth settings tests

export PYTHONPATH=${PYTHONPATH}:/project/sawtooth-core/families/settings:/project/sawtooth-core/families/settings/sawtooth_settings:/project/sawtooth-core/sdkpythonbuildlib:/project/sawtooth-core/sdk/python/build/lib:/project/sawtooth-core/signing/build/lib
Clone this wiki locally