読者です 読者をやめる 読者になる 読者になる

Intel Sawtooth Lake Distributed LedgerのTutorial

blockchain

チュートリアルに沿ってインストールとかをしてみた。

http://intelledger.github.io/tutorial.html

Windows 10
VirtualBox 5.0.14 r105127
Vagrant 1.8.1

エラー1

vagrant upでエラー。
とりあえずvagrant sshで接続はできる。

$ vagrant up
Proxyconf plugin not found
Install: vagrant plugin install vagrant-proxyconf
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/trusty64'
    default: URL: https://atlas.hashicorp.com/ubuntu/trusty64
==> default: Adding box 'ubuntu/trusty64' (v20160406.0.0) for provider: virtualbox
    default: Downloading: https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/20160406.0.0/providers/virtualbox.box
    default:
==> default: Successfully added box 'ubuntu/trusty64' (v20160406.0.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Setting the name of the VM: sawtooth-dev-tools_default_1461906409727_13217
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 8800 (guest) => 8800 (host) (adapter 1)
    default: 8900 (guest) => 8900 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 4.3.36
    default: VirtualBox Version: 5.0
==> default: Mounting shared folders...
    default: /project => C:/intelledger/project
    default: /vagrant => C:/intelledger/project/sawtooth-dev-tools
==> default: Running provisioner: shell...
    default: Running: C:/Users/kubo1/AppData/Local/Temp/vagrant-shell20160429-4716-y0i00a.sh
==> default: stdin: is not a tty
==> default: + cd /vagrant
==> default: ++ sort -n
==> default: ++ ls -1 bootstrap.d/10-setup.sh bootstrap.d/12-dotfiles.sh bootstrap.d/14-setup_stl_environment.sh bootstrap.d/20-apt-get-install.sh bootstrap.d/22-zypper-install.sh bootstrap.d/30-python-lib-install.sh bootstrap.d/40-etc-hosts.sh bootstrap.d/70-install-via-deb.sh bootstrap.d/80-blockchain-install.sh bootstrap.d/90-start-txnvalidator.sh bootstrap.d/95-run-plugins.sh
==> default: + for script in '$(ls -1 bootstrap.d/*.sh | sort -n)'
==> default: + echo 'Running: ./bootstrap.d/10-setup.sh'
==> default: Running: ./bootstrap.d/10-setup.sh
==> default: + ./bootstrap.d/10-setup.sh
==> default: /bin/bash:
: invalid option
==> default: Usage:     /bin/bash [GNU long option] [option] ...
==> default:    /bin/bash [GNU long option] [option] script-file ...
==> default: GNU long options:
==> default:    --debug
==> default:    --debugger
==> default:    --dump-po-strings
==> default:    --dump-strings
==> default:    --help
==> default:    --init-file
==> default:    --login
==> default:    --noediting
==> default:    --noprofile
==> default:    --norc
==> default:    --posix
==> default:    --rcfile
==> default:    --restricted
==> default:    --verbose
==> default:    --version
==> default: Shell options:
==> default:    -ilrsD or -c command or -O shopt_option         (invocation only)
==> default:    -abefhkmnptuvxBCHP or -o option
==> default: + exit 1
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

error2

vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-core$ python setup.py build
Traceback (most recent call last):
  File "setup.py", line 21, in <module>
    from setuptools import setup, Extension, find_packages
ImportError: No module named setuptools

何かがおかしい。とりあえずsetuptoolsを入れる。

sudo wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python

wgetのsudoは要らないかもしれない。

別のエラー

vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-core$ python setup.py build

/usr/local/lib/python2.7/dist-packages/setuptools-20.10.1-py2.7.egg/setuptools/dist.py:285: UserWarning: Normalizing '1.1.1-dev1' to '1.1.1.dev1'
running build
running build_py
file journal/consensus/poet/poet_enclave_simulator/poet_enclave_simulator.py (for module journal.consensus.poet.poet_enclave_simulator.poet_enclave_simulator) not found
file gossip/ECDSA/ECDSARecoverModule.py (for module gossip.ECDSA.ECDSARecoverModule) not found
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/journal
creating build/lib.linux-x86_64-2.7/journal/consensus
creating build/lib.linux-x86_64-2.7/journal/consensus/poet
creating build/lib.linux-x86_64-2.7/journal/consensus/poet/poet_enclave_simulator
copying journal/consensus/poet/poet_enclave_simulator/__init__.py -> build/lib.linux-x86_64-2.7/journal/consensus/poet/poet_enclave_simulator
creating build/lib.linux-x86_64-2.7/gossip
creating build/lib.linux-x86_64-2.7/gossip/ECDSA
copying gossip/ECDSA/__init__.py -> build/lib.linux-x86_64-2.7/gossip/ECDSA
copying gossip/common.py -> build/lib.linux-x86_64-2.7/gossip
copying gossip/config.py -> build/lib.linux-x86_64-2.7/gossip
copying gossip/event_handler.py -> build/lib.linux-x86_64-2.7/gossip
copying gossip/gossip_core.py -> build/lib.linux-x86_64-2.7/gossip
copying gossip/message.py -> build/lib.linux-x86_64-2.7/gossip
copying gossip/node.py -> build/lib.linux-x86_64-2.7/gossip
copying gossip/signed_object.py -> build/lib.linux-x86_64-2.7/gossip
copying gossip/stats.py -> build/lib.linux-x86_64-2.7/gossip
copying gossip/token_bucket.py -> build/lib.linux-x86_64-2.7/gossip
copying gossip/__init__.py -> build/lib.linux-x86_64-2.7/gossip
copying journal/global_store_manager.py -> build/lib.linux-x86_64-2.7/journal
copying journal/journal_core.py -> build/lib.linux-x86_64-2.7/journal
copying journal/transaction.py -> build/lib.linux-x86_64-2.7/journal
copying journal/transaction_block.py -> build/lib.linux-x86_64-2.7/journal
copying journal/__init__.py -> build/lib.linux-x86_64-2.7/journal
creating build/lib.linux-x86_64-2.7/ledger
copying ledger/__init__.py -> build/lib.linux-x86_64-2.7/ledger
creating build/lib.linux-x86_64-2.7/gossip/messages
copying gossip/messages/connect_message.py -> build/lib.linux-x86_64-2.7/gossip/messages
copying gossip/messages/gossip_debug.py -> build/lib.linux-x86_64-2.7/gossip/messages
copying gossip/messages/random_walk_message.py -> build/lib.linux-x86_64-2.7/gossip/messages
copying gossip/messages/shutdown_message.py -> build/lib.linux-x86_64-2.7/gossip/messages
copying gossip/messages/topology_message.py -> build/lib.linux-x86_64-2.7/gossip/messages
copying gossip/messages/__init__.py -> build/lib.linux-x86_64-2.7/gossip/messages
creating build/lib.linux-x86_64-2.7/gossip/topology
copying gossip/topology/barabasi_albert.py -> build/lib.linux-x86_64-2.7/gossip/topology
copying gossip/topology/random_walk.py -> build/lib.linux-x86_64-2.7/gossip/topology
copying gossip/topology/__init__.py -> build/lib.linux-x86_64-2.7/gossip/topology
copying journal/consensus/__init__.py -> build/lib.linux-x86_64-2.7/journal/consensus
creating build/lib.linux-x86_64-2.7/journal/messages
copying journal/messages/journal_debug.py -> build/lib.linux-x86_64-2.7/journal/messages
copying journal/messages/journal_transfer.py -> build/lib.linux-x86_64-2.7/journal/messages
copying journal/messages/transaction_block_message.py -> build/lib.linux-x86_64-2.7/journal/messages
copying journal/messages/transaction_message.py -> build/lib.linux-x86_64-2.7/journal/messages
copying journal/messages/__init__.py -> build/lib.linux-x86_64-2.7/journal/messages
creating build/lib.linux-x86_64-2.7/journal/protocol
copying journal/protocol/journal_transfer.py -> build/lib.linux-x86_64-2.7/journal/protocol
copying journal/protocol/__init__.py -> build/lib.linux-x86_64-2.7/journal/protocol
copying journal/consensus/poet/poet_journal.py -> build/lib.linux-x86_64-2.7/journal/consensus/poet
copying journal/consensus/poet/poet_transaction_block.py -> build/lib.linux-x86_64-2.7/journal/consensus/poet
copying journal/consensus/poet/wait_certificate.py -> build/lib.linux-x86_64-2.7/journal/consensus/poet
copying journal/consensus/poet/wait_timer.py -> build/lib.linux-x86_64-2.7/journal/consensus/poet
copying journal/consensus/poet/__init__.py -> build/lib.linux-x86_64-2.7/journal/consensus/poet
creating build/lib.linux-x86_64-2.7/journal/consensus/quorum
copying journal/consensus/quorum/quorum_journal.py -> build/lib.linux-x86_64-2.7/journal/consensus/quorum
copying journal/consensus/quorum/quorum_transaction_block.py -> build/lib.linux-x86_64-2.7/journal/consensus/quorum
copying journal/consensus/quorum/__init__.py -> build/lib.linux-x86_64-2.7/journal/consensus/quorum
creating build/lib.linux-x86_64-2.7/journal/consensus/quorum/messages
copying journal/consensus/quorum/messages/quorum_advertisement.py -> build/lib.linux-x86_64-2.7/journal/consensus/quorum/messages
copying journal/consensus/quorum/messages/quorum_ballot.py -> build/lib.linux-x86_64-2.7/journal/consensus/quorum/messages
copying journal/consensus/quorum/messages/quorum_debug.py -> build/lib.linux-x86_64-2.7/journal/consensus/quorum/messages
copying journal/consensus/quorum/messages/__init__.py -> build/lib.linux-x86_64-2.7/journal/consensus/quorum/messages
creating build/lib.linux-x86_64-2.7/journal/consensus/quorum/protocols
copying journal/consensus/quorum/protocols/quorum_vote.py -> build/lib.linux-x86_64-2.7/journal/consensus/quorum/protocols
copying journal/consensus/quorum/protocols/__init__.py -> build/lib.linux-x86_64-2.7/journal/consensus/quorum/protocols
creating build/lib.linux-x86_64-2.7/ledger/transaction
copying ledger/transaction/asset_registry.py -> build/lib.linux-x86_64-2.7/ledger/transaction
copying ledger/transaction/endpoint_registry.py -> build/lib.linux-x86_64-2.7/ledger/transaction
copying ledger/transaction/integer_key.py -> build/lib.linux-x86_64-2.7/ledger/transaction
copying ledger/transaction/__init__.py -> build/lib.linux-x86_64-2.7/ledger/transaction
file journal/consensus/poet/poet_enclave_simulator/poet_enclave_simulator.py (for module journal.consensus.poet.poet_enclave_simulator.poet_enclave_simulator) not found
file gossip/ECDSA/ECDSARecoverModule.py (for module gossip.ECDSA.ECDSARecoverModule) not found
running build_ext
building '_poet_enclave_simulator' extension
swigging journal/consensus/poet/poet_enclave_simulator/poet_enclave_simulator.i to journal/consensus/poet/poet_enclave_simulator/poet_enclave_simulator_wrap.cpp
swig -python -c++ -o journal/consensus/poet/poet_enclave_simulator/poet_enclave_simulator_wrap.cpp journal/consensus/poet/poet_enclave_simulator/poet_enclave_simulator.i
unable to execute 'swig': No such file or directory
error: command 'swig' failed with exit status 1

先頭の行に -xというオプションがついている.shファイルがある。

#!/bin/bash -x
#!/bin/bash

install_sphinx.sh

エラー3

==> default: /tmp/vagrant-shell: ./bootstrap.d/10-setup.sh: /bin/bash^M: bad interpreter: No such file or directory
==> default: + exit 1

Windows 改行のコードだとエラーになるので、保存しなおした。

エラー4

==> default: Skipping: ./bootstrap.d/90-start-txnvalidator.sh
==> default: + for script in '$(ls -1 bootstrap.d/*.sh | sort -n)'
==> default: + echo 'Running: ./bootstrap.d/95-run-plugins.sh'
==> default: Running: ./bootstrap.d/95-run-plugins.sh
==> default: + ./bootstrap.d/95-run-plugins.sh
==> default: /vagrant/conf.sh: line 1: $'\r': command not found
==> default: /vagrant/conf.sh: line 7: syntax error: unexpected end of file

Windows 改行のコードだとエラーになるので、保存しなおした。

project\sawtooth-dev-tools\plugins
の中にある.shも改行コードの変換が必要だった。

==> default: ./bootstrap.d/95-run-plugins.sh: ./build_ubuntu_deps.sh: /bin/bash^M: bad interpreter: No such file or directory
==> default: + exit 1
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

https://www.seeds-std.co.jp/seedsblog/2551.html
.gitconfig

[core]
    autoCRLF = false

という設定をするといいらしい。

エラー5

==> default: Setting up python-colorlog (2.6.0-1) ...
==> default: Setting up python-pybitcointools (1.1.15-1) ...
.sh default: Running: ./install_sphinx
.sh: No such file or directoryrun-plugins.sh: line 11: ./install_sphinx
==> default: + exit 1
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

default: Running: ./install_sphinx.sh
となるべきところが
.sh default: Running: ./install_sphinx
になってる。
conf-defaults.shで配列?が定義されている。

[[ -z "$PLUGINS" ]] && export PLUGINS="build_ubuntu_deps install_ubuntu_deps install_sphinx"

conf-defaults.shの改行コードをUNIX用にしたら直った。
他のエラーもほぼ改行コードの問題だった。

やっと動いた。

$ vagrant ssh
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-85-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Fri Apr 29 12:02:03 UTC 2016

  System load:  0.36              Processes:           93
  Usage of /:   3.5% of 39.34GB   Users logged in:     0
  Memory usage: 6%                IP address for eth0: 10.0.2.15
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.


vagrant@vagrant-ubuntu-trusty-64:/project$

validator 実行

./bin/txnvalidator --logfile=__screen__ --http 8800
: No such file or directory

txnvalidatorの中身を見たら、明らかにpythonのコードなのに、
チュートリアルではなぜか./bin/txnvalidatorで実行しようとしている。
設定すると動くのか・・・?

pythonのプログラムとして実行したら、、エラーが出た。

vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-validator$ python bin/txnvalidator  --logfile=__screen__ --http 8800

ImportError: cannot import name ECDSARecoverModule

エラー6

vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-core$ sudo python setup.py install
vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-mktplace$ sudo python setup.py install
vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-validator$ sudo python setup.py install
$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from gossip import node, signed_object, token_bucket
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/gossip/__init__.py", line 19, in <module>
  File "build/bdist.linux-x86_64/egg/gossip/gossip_core.py", line 29, in <module>
  File "build/bdist.linux-x86_64/egg/gossip/message.py", line 26, in <module>
  File "build/bdist.linux-x86_64/egg/gossip/signed_object.py", line 26, in <module>
ImportError: cannot import name ECDSARecoverModule
>>>

循環参照のエラーになってるっぽい。

もう1回sudo python setup.py installしたりしてエラーが出たけど、ECDSARecoverModuleのエラーは直った。
txnvalidatorが起動できた。謎。

vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-core$ sudo python setup.py install


creating /usr/local/lib/python2.7/dist-packages/sawtooth_core-1.1.1_dev1-py2.7-linux-x86_64.egg
Extracting sawtooth_core-1.1.1_dev1-py2.7-linux-x86_64.egg to /usr/local/lib/python2.7/dist-packages
sawtooth-core 1.1.1-dev1 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.7/dist-packages/sawtooth_core-1.1.1_dev1-py2.7-linux-x86_64.egg
Processing dependencies for sawtooth-core==1.1.1-dev1
Traceback (most recent call last):
  File "setup.py", line 117, in <module>
    'gossip.ECDSA.ECDSARecoverModule'])
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 73, in run
    self.do_egg_install()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 96, in do_egg_install
    cmd.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 381, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 597, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 648, in install_item
    self.process_distribution(spec, dist, deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 694, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 633, in resolve
    requirements.extend(dist.requires(req.extras)[::-1])
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2291, in requires
    dm = self._dep_map
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2277, in _dep_map
    for extra,reqs in split_sections(self._get_metadata(name)):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2715, in split_sections
    for line in yield_lines(s):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1989, in yield_lines
    for ss in strs:
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2305, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1369, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1361, in get_metadata
    return self._get(self._fn(self.egg_info,name))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1425, in _get
    return self.loader.get_data(path)
zipimport.ZipImportError: bad local file header in /usr/local/lib/python2.7/dist-packages/sawtooth_core-1.1.1_dev1-py2.7-linux-x86_64.egg
vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-core$

python bin/txnvalidator

vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-validator$ python bin/txnvalidator  --logfile=__screen__ --http 8800
[12:55:54 INFO    validator_cli] validator started with arguments: ['bin/txnvalidator', '--logfile=__screen__', '--http', '8800']
[12:55:54 WARNING validator_cli] validator pid is 9307
[12:55:54 WARNING validator_cli] unable to find locate key file /project/sawtooth-validator//keys/base000.wif
[12:55:54 INFO    gossip_core] listening on IPv4Address(UDP, '127.0.0.1', 46631)
[12:55:55 INFO    global_store_manager] create blockstore from file /project/sawtooth-validator//data/base000_gs with flag n
[12:55:55 INFO    validator] starting ledger base000 with id 1MpeLMuC at network address ('127.0.0.1', 46631)
[12:55:55 INFO    validator] ledger initialization complete
[12:55:55 INFO    journal_core] process initial transactions and blocks
[12:55:55 WARNING journal_core] node base000 claims the genesis block
[12:55:55 INFO    poet_journal] build transaction block to extend 00000000 with 0 transactions
[12:55:55 INFO    wait_timer] wait timer created; TIMER, 30.00, 9.40, 0000000000000000
[12:55:55 INFO    poet_journal] node base000 validates block with 0 transactions
[12:55:55 INFO    wait_certificate] wait certificate created; CERT, 30.00, 9.40, 589p6qapepnv4ztx, 0000000000000000
[12:55:55 INFO    journal_core] finished processing initial transactions and blocks
[12:55:55 INFO    lottery_validator] register endpoint 1MpeLMuC with name base000
[12:55:55 INFO    journal_core] commit block 388a844f from base000 with previous id 00000000
[12:55:55 INFO    journal_core] compress global state for block number 0
[12:55:55 INFO    poet_journal] build transaction block to extend 388a844f with 1 transactions
[12:55:55 INFO    wait_timer] wait timer created; TIMER, 30.80, 132.51, 589p6qapepnv4ztx

key gen

cd sawtooth-validator/
python bin/txnkeygen  --keydir keys mkt
python bin/txnkeygen  --keydir keys alice
python bin/txnkeygen --keydir keys bob

run txnvalidator

edit project/sawtooth-docs/source/tutorial/txnvalidator.js
run

python bin/txnvalidator --logfile=__screen__ --config /project/sawtooth-docs/source/tutorial/txnvalidator.js

run marketplace client

vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-mktplace$ python bin/mktclient --name mkt
Unable to locate the following configuration files: mktclient.js (search path: /project/sawtooth-validator//etc, /home/vagrant/.sawtooth, ., /usr/local/lib/python2.7/dist-packages/sawtooth_mktplace-1.1.1_dev1-py2.7.egg/mktplace/../etc)

sawtooth-validator/etc/txnclient.js
をコピーして
sawtooth-validator/etc/mktclient.js
を作った。

{
    "Host" : "localhost",
    "NodeName" : "base000",
    "LedgerURL" : "http://localhost:8800/",

    ## configuration of logging
    "LogLevel" : "INFO",
    "LogFile"  : "{log_dir}/lottery-{node}.log",

     ## key file
    "KeyFile" : "{home}/keys/{node}.wif",
    "SigningKey" : "5JKCNb7pTpzScV9SCf3NKYofDQDboc6tc4hha7VpycEwggYnKyV"
vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-mktplace$ python bin/mktclient --name mkt
missing required configuration parameter 'SigningKey'
vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-mktplace$ python bin/mktclient --name mkt
Traceback (most recent call last):
  File "bin/mktclient", line 23, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/sawtooth_mktplace-1.1.1_dev1-py2.7.egg/mktmain/client_cli.py", line 1492, in main
    local_main(cfg)
  File "/usr/local/lib/python2.7/dist-packages/sawtooth_mktplace-1.1.1_dev1-py2.7.egg/mktmain/client_cli.py", line 1367, in local_main
    state=state)
  File "/usr/local/lib/python2.7/dist-packages/sawtooth_mktplace-1.1.1_dev1-py2.7.egg/mktplace/mktplace_client.py", line 109, in __init__
    signingkey = signed_object.generate_signing_key(wifstr=keystring)
  File "/usr/local/lib/python2.7/dist-packages/sawtooth_core-1.1.1_dev1-py2.7-linux-x86_64.egg/gossip/signed_object.py", line 56, in generate_signing_key
    return pybitcointools.decode_privkey(wifstr, 'wif')
  File "/usr/lib/python2.7/dist-packages/pybitcointools/main.py", line 298, in decode_privkey
    bin_p = b58check_to_bin(priv)
  File "/usr/lib/python2.7/dist-packages/pybitcointools/main.py", line 473, in b58check_to_bin
    assert bin_dbl_sha256(data[:-4])[:4] == data[-4:]
AssertionError
vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-mktplace$ python bin/mktclient --name mkt --loglevel DEBUG --logfile __screen__

[14:16:35 WARNING client_cli] unable to find locate key file /project/sawtooth-validator//keys/base000.wif
[14:16:35 DEBUG   mktplace_state] fetch state from http://localhost:8800/MarketPlaceTransaction/*
[14:16:35 DEBUG   mktplace_communication] get content from url <http://localhost:8800/block?blockcount=10>
[14:16:35 DEBUG   mktplace_state] full fetch of state for block 545076bc97489b3b
[14:16:35 DEBUG   mktplace_communication] get content from url <http://localhost:8800/store/MarketPlaceTransaction/*?blockid=545076bc97489b3b>
[14:16:35 DEBUG   mktplace_state] fetch state from http://localhost:8800/MarketPlaceTransaction/*
[14:16:35 DEBUG   mktplace_communication] get content from url <http://localhost:8800/block?blockcount=10>
[14:16:35 DEBUG   mktplace_client] set signing key from string
/project/sawtooth-validator/keys/mkt.wif
Traceback (most recent call last):
  File "bin/mktclient", line 23, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/sawtooth_mktplace-1.1.1_dev1-py2.7.egg/mktmain/client_cli.py", line 1492, in main
    local_main(cfg)
  File "/usr/local/lib/python2.7/dist-packages/sawtooth_mktplace-1.1.1_dev1-py2.7.egg/mktmain/client_cli.py", line 1367, in local_main
    state=state)
  File "/usr/local/lib/python2.7/dist-packages/sawtooth_mktplace-1.1.1_dev1-py2.7.egg/mktplace/mktplace_client.py", line 109, in __init__
    signingkey = signed_object.generate_signing_key(wifstr=keystring)
  File "/usr/local/lib/python2.7/dist-packages/sawtooth_core-1.1.1_dev1-py2.7-linux-x86_64.egg/gossip/signed_object.py", line 56, in generate_signing_key
    return pybitcointools.decode_privkey(wifstr, 'wif')
  File "/usr/lib/python2.7/dist-packages/pybitcointools/main.py", line 298, in decode_privkey
    bin_p = b58check_to_bin(priv)
  File "/usr/lib/python2.7/dist-packages/pybitcointools/main.py", line 473, in b58check_to_bin
    assert bin_dbl_sha256(data[:-4])[:4] == data[-4:]
AssertionError

先に進んだ。
SigningKeyにはpathを指定するんじゃなくて生成したkeyの値を入れるようだった。

python bin/txnkeygen --keydir keys mkt
で生成した、keys/mkt.wif の値を設定した。

vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-mktplace$ python bin/mktclient --name mkt --loglevel DEBUG --logfile __screen__
[14:21:36 WARNING client_cli] unable to find locate key file /project/sawtooth-validator//keys/base000.wif
[14:21:36 DEBUG   mktplace_state] fetch state from http://localhost:8800/MarketPlaceTransaction/*
[14:21:36 DEBUG   mktplace_communication] get content from url <http://localhost:8800/block?blockcount=10>
[14:21:36 DEBUG   mktplace_state] full fetch of state for block 545076bc97489b3b
[14:21:36 DEBUG   mktplace_communication] get content from url <http://localhost:8800/store/MarketPlaceTransaction/*?blockid=545076bc97489b3b>
[14:21:36 DEBUG   mktplace_state] fetch state from http://localhost:8800/MarketPlaceTransaction/*
[14:21:36 DEBUG   mktplace_communication] get content from url <http://localhost:8800/block?blockcount=10>
[14:21:36 DEBUG   mktplace_client] set signing key from string
5JKCNb7pTpzScV9SCf3NKYofDQDboc6tc4hha7VpycEwggYnKyV
//UNKNOWN>
//UNKNOWN>
//UNKNOWN>

登録?

チュートリアルに従ってコマンド実行。
エラーもなく実行できたようなのでチュートリアル完了。

//mkt> assettype reg --name /asset-type/cookie --no-restricted
[14:32:56 DEBUG   market_place_object_update] market update: (/mktplace.transactions.AssetTypeUpdate/Register, 16Nt5XxYMJkNge5PsDLYwT4CdcmEEytJGb, ae30d49ced5b3b5e)
[14:32:56 DEBUG   mktplace_communication] {"Transaction": {"Dependencies": ["3a882acebe7255f5"], "Nonce": 1461940376.456207, "Signature": "HM3jRxNrafWbSiGwiDm96YtY3WgrDGPEQVICREUHxZgBU7fiZ+oLb3s9VVRI6QK42xN8joTKy0/gFB6K/ffBpfM=", "TransactionType": "/MarketPlaceTransaction", "Update": {"CreatorID": "3a882acebe7255f5", "Description": "", "Name": "/asset-type/cookie", "Restricted": false, "UpdateType": "/mktplace.transactions.AssetTypeUpdate/Register"}}, "__NONCE__": 1461940376.466166, "__SIGNATURE__": "G4dMEIWUtxrWA+1rLgkE1xRP+9y+2rXcOZISSRWZQynGxvaiH+K+QYOWlJ4MGLEDwulT9EGYpxdBDl/IdIjHf4o=", "__TYPE__": "/mktplace.transactions.MarketPlace/Transaction"}
[14:32:56 DEBUG   mktplace_communication] post transaction to http://localhost:8800/mktplace.transactions.MarketPlace/Transaction with DATALEN=524, DATA=<▒kTransaction▒lDependencies▒p3a882acebe7255f5eNonce▒A▒▒▒&2iSignaturexXHM3jRxNrafWbSiGwiDm96YtY3WgrDGPEQVICREUHxZgBU7fiZ+oLb3s9VVRI6QK42xN8joTKy0/gFB6K/ffBpfM=oTransactionTypew/MarketPlaceTransactionfUpdate▒iCreatorIDp3a882acebe7255f5kDescription`dNamer/asset-type/cookiejRestricted▒jUpdateTypex//mktplace.transactions.AssetTypeUpdate/Registeri__NONCE__▒A▒▒▒&ժm__SIGNATURE__xXG4dMEIWUtxrWA+1rLgkE1xRP+9y+2rXcOZISSRWZQynGxvaiH+K+QYOWlJ4MGLEDwulT9EGYpxdBDl/IdIjHf4o=h__TYPE__x./mktplace.transactions.MarketPlace/Transaction>
[14:32:56 DEBUG   mktplace_communication] {
  "Transaction": {
    "Dependencies": [
      "3a882acebe7255f5"
    ],
    "Nonce": 1461940376.456207,
    "Signature": "HM3jRxNrafWbSiGwiDm96YtY3WgrDGPEQVICREUHxZgBU7fiZ+oLb3s9VVRI6QK42xN8joTKy0/gFB6K/ffBpfM=",
    "TransactionType": "/MarketPlaceTransaction",
    "Update": {
      "CreatorID": "3a882acebe7255f5",
      "Description": "",
      "Name": "/asset-type/cookie",
      "Restricted": false,
      "UpdateType": "/mktplace.transactions.AssetTypeUpdate/Register"
    }
  },
  "__NONCE__": 1461940376.466166,
  "__SIGNATURE__": "G4dMEIWUtxrWA+1rLgkE1xRP+9y+2rXcOZISSRWZQynGxvaiH+K+QYOWlJ4MGLEDwulT9EGYpxdBDl/IdIjHf4o=",
  "__TYPE__": "/mktplace.transactions.MarketPlace/Transaction"
}
transaction ae30d49ced5b3b5e submitted
vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-mktplace$ python bin/mktclient --name bob
//UNKNOWN>
//UNKNOWN>
//UNKNOWN> participant reg --name bob
transaction ca1c91405fe47e0f submitted
//bob>
transaction b3e00deecf484f5a submitted
//bob> acount reg --name /account
*** Unknown syntax: acount reg --name /account
//bob> account reg --name /account
transaction 680f01297a7dd21e submitted
//bob> holding reg --name /USD --account /account --asset //mkt/asset/currency/USD
transaction ec6fc7bdae430cee submitted
//bob> holding reg --name /holding/token --count 1 --account /account --asset //marketplace/asset/token
transaction ad44cf0d00babc48 submitted
//bob> waitforcommit
Waiting for ad44cf0d00babc48.
Transaction committed.
//bob> exchange --src /holding/token --dst /USD --offers //mkt/offer/provision/USD --count 1
transaction cb4bef62ca3e59d5 submitted
//bob> holding reg --name /jars/choc_chip --account /account --asset //mkt/asset/cookie/choc_chip
transaction 1b18e06ec811653f submitted
//bob> waitforcommit
Waiting for 1b18e06ec811653f.
Transaction committed.
//bob>
//bob> exchangeoffer reg --output /batches/choc_chip001 --input /USD --ratio 2 1 --name /choc_chip_sale
transaction 30b477ce4899108e submitted
//bob> waitforcommit
Waiting for 30b477ce4899108e.
Transaction committed.
//bob> holdings --creator //bob
1000     //bob/USD
24       //bob/batches/choc_chip001
1        //bob/holding/token
0        //bob/jars/choc_chip
//bob> offers --creator //bob
Ratio    Input Asset (What You Pay)          Output Asset (What You Get)         Name
0.5      //mkt/asset/currency/USD            //mkt/asset/cookie/choc_chip        //bob/choc_chip_sale
//bob>
Ratio    Input Asset (What You Pay)          Output Asset (What You Get)         Name
0.5      //mkt/asset/currency/USD            //mkt/asset/cookie/choc_chip        //bob/choc_chip_sale
//bob> exit

vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-mktplace$
vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-mktplace$
vagrant@vagrant-ubuntu-trusty-64:/project/sawtooth-mktplace$ python bin/mktclient --name alice
//alice> exchange --src /USD --dst /jars/choc_chip --offers //bob/choc_chip_sale --count 23
transaction 38ac6d99981731f5 submitted
//alice> waitforcommit
Waiting for 38ac6d99981731f5.
Transaction committed.
//alice>
Waiting for 38ac6d99981731f5.
Transaction committed.
//alice>  holdings --creator //bob
1023     //bob/USD
13       //bob/batches/choc_chip001
1        //bob/holding/token
0        //bob/jars/choc_chip
//alice> holdings --creator //alice
977      //alice/USD
1        //alice/holding/token
11       //alice/jars/choc_chip
//alice>