LoomSDKのTruffle DAppチェーンサンプルを動かしてみる

# はじめに
ブロックチェーンで何かアプリを作ってみたい！
せっかく作るならサイドチェーンを使ってみたい！

ということで、学習の一環として、Loomの「Truffle DAppチェーンサンプル」をやってみました。
結果としては上手くいきませんでした。

以下、DAppチェーンサンプルの実施時のメモです。

#環境
Mac : 10.14.3（OS X Mojave）
Node : v10.3.0
npm : 6.1.0

#LoomSDKダウンロード

[Loom SDKのインストール](https://loomx.io/developers/docs/ja/basic-install-all.html)を参考に、LoomSDKをインストール

Loom SDKダウンロード

```terminal
$ curl https://raw.githubusercontent.com/loomnetwork/loom-sdk-documentation/master/scripts/get_loom.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   615  100   615    0     0   3370      0 --:--:-- --:--:-- --:--:--  3379
Downloading loom executable...
2.0.0+b789
All done.
```

インストールと起動

```terminal
$ ./loom init
$ ./loom run
I[9036-03-09|13:27:15.699] Loading IAVL Store                           module=loom 
I[9036-03-09|13:27:15.706] Using simple log event dispatcher            
I[9036-03-09|13:27:15.719] Deployed contract                            vm=plugin location=coin:1.0.0 name=coin address=default:0xe288d6eec7150D6a22FDE33F0AA2d81E06591C4d
Init DPOS Params &dpos.DPOSInitRequest{Params:(*dpos.Params)(0xc0000cee60), Validators:[]*types.Validator{(*types.Validator)(0xc0001abd80)}, XXX_NoUnkeyedLiteral:struct {}{}, XXX_unrecognized:[]uint8(nil), XXX_sizecache:0}
I[9036-03-09|13:27:15.721] Deployed contract                            vm=plugin location=dpos:1.0.0 name=dpos address=default:0x01D10029c253fA02D76188b84b5846ab3D19510D
E[9036-03-09|13:27:15.729] Couldn't connect to any seeds                module=p2p 
I[9036-03-09|13:27:15.730] Starting RPC HTTP server on [::]:46658       module=query-server 
I[9036-03-09|13:27:15.730] Starting RPC HTTP server on 127.0.0.1:9999   module=query-server 
```

以下のエラーが発生していますが、ローカル立ち上げで他に接続先のノードが無いためエラーっぽいので無視して進む。http://loom-network.blogspot.com/

```
E[9036-03-09|13:27:15.729] Couldn't connect to any seeds                module=p2p 
```

# "Truffle DAppチェーンサンプル" のチュートリアルをやってみる


[Truffle DAppチェーンサンプル](https://loomx.io/developers/docs/ja/truffle-deploy.html)を参考に、実施。

サンプルをダウンロードしてサンプル配下に移動

```terminal
$ git clone https://github.com/loomnetwork/truffle-dappchain-example
$ cd truffle-dappchain-example
```

yarnでインストール

```terminal
$ yarn install
yarn install v1.13.0
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning " > request-promise@4.2.2" has unmet peer dependency "request@^2.34".
warning "request-promise > request-promise-core@1.1.1" has unmet peer dependency "request@^2.34".
[4/4] 🔨  Building fresh packages...
[-/7] ⠐ waiting...
[-/7] ⠐ waiting...
[3/7] ⠈ scrypt
[-/7] ⠈ waiting...
error /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/scrypt: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/scrypt
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@10.3.0 | darwin | x64
gyp info spawn /usr/bin/python
gyp info spawn args [ '/Users/h-kane/.nodebrew/node/v10.3.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/scrypt/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/h-kane/.nodebrew/node/v10.3.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/h-kane/.node-gyp/10.3.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/h-kane/.node-gyp/10.3.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/h-kane/.nodebrew/node/v10.3.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/h-kane/.node-gyp/10.3.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/scrypt',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  SOLINK_MODULE(target) Release/copied_files.node
  CC(target) Release/obj.target/scrypt_wrapper/src/util/memlimit.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/keyderivation.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/pickparams.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/hash.o
  LIBTOOL-STATIC Release/scrypt_wrapper.a
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/crypto/crypto_scrypt.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/crypto/crypto_scrypt_smix.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/util/warnp.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/alg/sha256.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/util/insecure_memzero.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/scryptenc/scryptenc_cpuperf.o
  LIBTOOL-STATIC Release/scrypt_lib.a
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_common.o
In file included from ../src/node-boilerplate/scrypt_common.cc:28:
../../nan/nan.h:1081:96: error: too many arguments to function call, expected at most 4, have 5
        length_ = string->WriteUtf8(v8::Isolate::GetCurrent(), str_, static_cast<int>(len), 0, flags);
                  ~~~~~~~~~~~~~~~~~                                                            ^~~~~
/Users/h-kane/.node-gyp/10.3.0/include/node/v8.h:2592:3: note: 'WriteUtf8' declared here
  int WriteUtf8(char* buffer,
  ^
1 error generated.
make: *** [Release/obj.target/scrypt/src/node-boilerplate/scrypt_common.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/h-kane/.nodebrew/node/v10.3.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/Users/h-kane/.nodebrew/node/v10.3.0/bin/node" "/Users/h-kane/.nodebrew/node/v10.3.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/scrypt
 with ok
gyp info using node-gyp@3.6.2
gyp info using node@10.3.0 | darwin | x64
gyp info spawn /usr/bin/python
gyp info spawn args [ '/Users/h-kane/.nodebrew/node/v10.3.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/scrypt/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/h-kane/.nodebrew/node/v10.3.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/h-kane/.node-gyp/10.3.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/h-kane/.node-gyp/10.3.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/h-kane/.nodebrew/node/v10.3.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/h-kane/.node-gyp/10.3.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/scrypt',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  SOLINK_MODULE(target) Release/copied_files.node
  CC(target) Release/obj.target/scrypt_wrapper/src/util/memlimit.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/keyderivation.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/pickparams.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/hash.o
  LIBTOOL-STATIC Release/scrypt_wrapper.a
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/crypto/crypto_scrypt.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/crypto/crypto_scrypt_smix.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/util/warnp.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/alg/sha256.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/util/insecure_memzero.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/scryptenc/scryptenc_cpuperf.o
  LIBTOOL-STATIC Release/scrypt_lib.a
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_common.o
In file included from ../src/node-boilerplate/scrypt_common.cc:28:
../../nan/nan.h:1081:96: error: too many arguments to function call, expected at most 4, have 5
        length_ = string->WriteUtf8(v8::Isolate::GetCurrent(), str_, static_cast<int>(len), 0, flags);
                  ~~~~~~~~~~~~~~~~~                                                            ^~~~~
/Users/h-kane/.node-gyp/10.3.0/include/node/v8.h:2592:3: note: 'WriteUtf8' declared here
  int WriteUtf8(char* buffer,
  ^
1 error generated.
make: *** [Release/obj.target/scrypt/src/node-boilerplate/scrypt_common.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/h-kane/.nodebrew/node/v10.3.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/Users/h-kane/.nodebrew/node/v10.3.0/bin/node" "/Users/h-kane/.nodebrew/node/v10.3.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/scrypt
```

いきなりエラー。
上手く行かないので、npm でインストール。

```terminal
$ npm install
npm WARN rm not removing /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/.bin/regjsparser as it wasn't installed by /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/regjsparser
npm WARN rm not removing /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/.bin/json5 as it wasn't installed by /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/json5
npm WARN rm not removing /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/.bin/jsesc as it wasn't installed by /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/jsesc
npm WARN rm not removing /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/fsevents/node_modules/.bin/node-pre-gyp as it wasn't installed by /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/fsevents/node_modules/node-pre-gyp

> scrypt@6.0.3 preinstall /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/scrypt
> node node-scrypt-preinstall.js


> fsevents@1.2.7 install /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/fsevents
> node install

node-pre-gyp WARN Using request for node-pre-gyp https download 
[fsevents] Success: "/Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" is installed via remote

> keccak@1.4.0 install /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/keccak
> npm run rebuild || echo "Keccak bindings compilation fail. Pure JS implementation will be used."


> keccak@1.4.0 rebuild /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/keccak
> node-gyp rebuild

  CXX(target) Release/obj.target/keccak/src/addon.o
  CC(target) Release/obj.target/keccak/src/libkeccak/KeccakSponge.o
  CC(target) Release/obj.target/keccak/src/libkeccak/KeccakP-1600-reference.o
../src/libkeccak/KeccakP-1600-reference.c:231:13: warning: unused function 'fromBytesToWords' [-Wunused-function]
static void fromBytesToWords(tKeccakLane *stateAsWords, const unsigned char *state)
            ^
../src/libkeccak/KeccakP-1600-reference.c:242:13: warning: unused function 'fromWordsToBytes' [-Wunused-function]
static void fromWordsToBytes(unsigned char *state, const tKeccakLane *stateAsWords)
            ^
2 warnings generated.
  SOLINK_MODULE(target) Release/keccak.node

> scrypt@6.0.3 install /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/scrypt
> node-gyp rebuild

  SOLINK_MODULE(target) Release/copied_files.node
  CC(target) Release/obj.target/scrypt_wrapper/src/util/memlimit.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/keyderivation.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/pickparams.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/hash.o
  LIBTOOL-STATIC Release/scrypt_wrapper.a
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/crypto/crypto_scrypt.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/crypto/crypto_scrypt_smix.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/util/warnp.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/alg/sha256.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/util/insecure_memzero.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/scryptenc/scryptenc_cpuperf.o
  LIBTOOL-STATIC Release/scrypt_lib.a
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_common.o
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_params_async.o
In file included from ../src/node-boilerplate/scrypt_params_async.cc:4:
In file included from ../src/node-boilerplate/inc/scrypt_params_async.h:28:
../src/node-boilerplate/inc/scrypt_async.h:53:17: warning: 'Call' is deprecated [-Wdeprecated-declarations]
      callback->Call(1, argv);
                ^
../../nan/nan.h:1673:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:103:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
../src/node-boilerplate/scrypt_params_async.cc:32:13: warning: 'Call' is deprecated [-Wdeprecated-declarations]
  callback->Call(2, argv);
            ^
../../nan/nan.h:1673:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:103:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
2 warnings generated.
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_params_sync.o
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_kdf_async.o
In file included from ../src/node-boilerplate/scrypt_kdf_async.cc:4:
In file included from ../src/node-boilerplate/inc/scrypt_kdf_async.h:28:
../src/node-boilerplate/inc/scrypt_async.h:53:17: warning: 'Call' is deprecated [-Wdeprecated-declarations]
      callback->Call(1, argv);
                ^
../../nan/nan.h:1673:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:103:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
../src/node-boilerplate/scrypt_kdf_async.cc:28:15: warning: 'Call' is deprecated [-Wdeprecated-declarations]
    callback->Call(2, argv);
              ^
../../nan/nan.h:1673:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:103:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
2 warnings generated.
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_kdf_sync.o
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_kdf-verify_sync.o
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_kdf-verify_async.o
In file included from ../src/node-boilerplate/scrypt_kdf-verify_async.cc:4:
In file included from ../src/node-boilerplate/inc/scrypt_kdf-verify_async.h:28:
../src/node-boilerplate/inc/scrypt_async.h:53:17: warning: 'Call' is deprecated [-Wdeprecated-declarations]
      callback->Call(1, argv);
                ^
../../nan/nan.h:1673:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:103:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
../src/node-boilerplate/scrypt_kdf-verify_async.cc:30:13: warning: 'Call' is deprecated [-Wdeprecated-declarations]
  callback->Call(2, argv);
            ^
../../nan/nan.h:1673:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:103:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
2 warnings generated.
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_hash_sync.o
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_hash_async.o
In file included from ../src/node-boilerplate/scrypt_hash_async.cc:28:
In file included from ../src/node-boilerplate/inc/scrypt_hash_async.h:28:
../src/node-boilerplate/inc/scrypt_async.h:53:17: warning: 'Call' is deprecated [-Wdeprecated-declarations]
      callback->Call(1, argv);
                ^
../../nan/nan.h:1673:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:103:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
../src/node-boilerplate/scrypt_hash_async.cc:52:13: warning: 'Call' is deprecated [-Wdeprecated-declarations]
  callback->Call(2, argv);
            ^
../../nan/nan.h:1673:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:103:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
2 warnings generated.
  CXX(target) Release/obj.target/scrypt/scrypt_node.o
  SOLINK_MODULE(target) Release/scrypt.node

> secp256k1@3.6.2 install /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/secp256k1
> npm run rebuild || echo "Secp256k1 bindings compilation fail. Pure JS implementation will be used."


> secp256k1@3.6.2 rebuild /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/secp256k1
> node-gyp rebuild

  CXX(target) Release/obj.target/secp256k1/src/addon.o
  CXX(target) Release/obj.target/secp256k1/src/privatekey.o
../src/privatekey.cc:73:3: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
  secp256k1_ec_privkey_negate(secp256k1ctx, &private_key[0]);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/privatekey.cc:4:
In file included from ../src/secp256k1-src/src/scalar_impl.h:10:
In file included from ../src/secp256k1-src/src/group.h:11:
../src/secp256k1-src/src/field.h:36:13: warning: unused function 'secp256k1_fe_normalize' [-Wunused-function]
static void secp256k1_fe_normalize(secp256k1_fe *r);
            ^
../src/secp256k1-src/src/field.h:39:13: warning: unused function 'secp256k1_fe_normalize_weak' [-Wunused-function]
static void secp256k1_fe_normalize_weak(secp256k1_fe *r);
            ^
../src/secp256k1-src/src/field.h:42:13: warning: unused function 'secp256k1_fe_normalize_var' [-Wunused-function]
static void secp256k1_fe_normalize_var(secp256k1_fe *r);
            ^
../src/secp256k1-src/src/field.h:46:12: warning: unused function 'secp256k1_fe_normalizes_to_zero' [-Wunused-function]
static int secp256k1_fe_normalizes_to_zero(secp256k1_fe *r);
           ^
../src/secp256k1-src/src/field.h:50:12: warning: unused function 'secp256k1_fe_normalizes_to_zero_var' [-Wunused-function]
static int secp256k1_fe_normalizes_to_zero_var(secp256k1_fe *r);
           ^
../src/secp256k1-src/src/field.h:53:13: warning: unused function 'secp256k1_fe_set_int' [-Wunused-function]
static void secp256k1_fe_set_int(secp256k1_fe *r, int a);
            ^
../src/secp256k1-src/src/field.h:56:13: warning: unused function 'secp256k1_fe_clear' [-Wunused-function]
static void secp256k1_fe_clear(secp256k1_fe *a);
            ^
../src/secp256k1-src/src/field.h:59:12: warning: unused function 'secp256k1_fe_is_zero' [-Wunused-function]
static int secp256k1_fe_is_zero(const secp256k1_fe *a);
           ^
../src/secp256k1-src/src/field.h:62:12: warning: unused function 'secp256k1_fe_is_odd' [-Wunused-function]
static int secp256k1_fe_is_odd(const secp256k1_fe *a);
           ^
../src/secp256k1-src/src/field.h:65:12: warning: unused function 'secp256k1_fe_equal' [-Wunused-function]
static int secp256k1_fe_equal(const secp256k1_fe *a, const secp256k1_fe *b);
           ^
../src/secp256k1-src/src/field.h:68:12: warning: unused function 'secp256k1_fe_equal_var' [-Wunused-function]
static int secp256k1_fe_equal_var(const secp256k1_fe *a, const secp256k1_fe *b);
           ^
../src/secp256k1-src/src/field.h:71:12: warning: unused function 'secp256k1_fe_cmp_var' [-Wunused-function]
static int secp256k1_fe_cmp_var(const secp256k1_fe *a, const secp256k1_fe *b);
           ^
../src/secp256k1-src/src/field.h:74:12: warning: unused function 'secp256k1_fe_set_b32' [-Wunused-function]
static int secp256k1_fe_set_b32(secp256k1_fe *r, const unsigned char *a);
           ^
../src/secp256k1-src/src/field.h:77:13: warning: unused function 'secp256k1_fe_get_b32' [-Wunused-function]
static void secp256k1_fe_get_b32(unsigned char *r, const secp256k1_fe *a);
            ^
../src/secp256k1-src/src/field.h:81:13: warning: unused function 'secp256k1_fe_negate' [-Wunused-function]
static void secp256k1_fe_negate(secp256k1_fe *r, const secp256k1_fe *a, int m);
            ^
../src/secp256k1-src/src/field.h:85:13: warning: unused function 'secp256k1_fe_mul_int' [-Wunused-function]
static void secp256k1_fe_mul_int(secp256k1_fe *r, int a);
            ^
../src/secp256k1-src/src/field.h:88:13: warning: unused function 'secp256k1_fe_add' [-Wunused-function]
static void secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a);
            ^
../src/secp256k1-src/src/field.h:92:13: warning: unused function 'secp256k1_fe_mul' [-Wunused-function]
static void secp256k1_fe_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe * SECP256K1_RESTRICT b);
            ^
../src/secp256k1-src/src/field.h:96:13: warning: unused function 'secp256k1_fe_sqr' [-Wunused-function]
static void secp256k1_fe_sqr(secp256k1_fe *r, const secp256k1_fe *a);
            ^
../src/secp256k1-src/src/field.h:103:12: warning: unused function 'secp256k1_fe_sqrt' [-Wunused-function]
static int secp256k1_fe_sqrt(secp256k1_fe *r, const secp256k1_fe *a);
           ^
../src/secp256k1-src/src/field.h:106:12: warning: unused function 'secp256k1_fe_is_quad_var' [-Wunused-function]
static int secp256k1_fe_is_quad_var(const secp256k1_fe *a);
           ^
../src/secp256k1-src/src/field.h:110:13: warning: unused function 'secp256k1_fe_inv' [-Wunused-function]
static void secp256k1_fe_inv(secp256k1_fe *r, const secp256k1_fe *a);
            ^
../src/secp256k1-src/src/field.h:113:13: warning: unused function 'secp256k1_fe_inv_var' [-Wunused-function]
static void secp256k1_fe_inv_var(secp256k1_fe *r, const secp256k1_fe *a);
            ^
../src/secp256k1-src/src/field.h:118:13: warning: unused function 'secp256k1_fe_inv_all_var' [-Wunused-function]
static void secp256k1_fe_inv_all_var(secp256k1_fe *r, const secp256k1_fe *a, size_t len);
            ^
../src/secp256k1-src/src/field.h:121:13: warning: unused function 'secp256k1_fe_to_storage' [-Wunused-function]
static void secp256k1_fe_to_storage(secp256k1_fe_storage *r, const secp256k1_fe *a);
            ^
../src/secp256k1-src/src/field.h:124:13: warning: unused function 'secp256k1_fe_from_storage' [-Wunused-function]
static void secp256k1_fe_from_storage(secp256k1_fe *r, const secp256k1_fe_storage *a);
            ^
../src/secp256k1-src/src/field.h:127:13: warning: unused function 'secp256k1_fe_storage_cmov' [-Wunused-function]
static void secp256k1_fe_storage_cmov(secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag);
            ^
../src/secp256k1-src/src/field.h:130:13: warning: unused function 'secp256k1_fe_cmov' [-Wunused-function]
static void secp256k1_fe_cmov(secp256k1_fe *r, const secp256k1_fe *a, int flag);
            ^
In file included from ../src/privatekey.cc:4:
In file included from ../src/secp256k1-src/src/scalar_impl.h:10:
../src/secp256k1-src/src/group.h:44:13: warning: unused function 'secp256k1_ge_set_xy' [-Wunused-function]
static void secp256k1_ge_set_xy(secp256k1_ge *r, const secp256k1_fe *x, const secp256k1_fe *y);
            ^
../src/secp256k1-src/src/group.h:50:12: warning: unused function 'secp256k1_ge_set_xquad' [-Wunused-function]
static int secp256k1_ge_set_xquad(secp256k1_ge *r, const secp256k1_fe *x);
           ^
../src/secp256k1-src/src/group.h:54:12: warning: unused function 'secp256k1_ge_set_xo_var' [-Wunused-function]
static int secp256k1_ge_set_xo_var(secp256k1_ge *r, const secp256k1_fe *x, int odd);
           ^
../src/secp256k1-src/src/group.h:57:12: warning: unused function 'secp256k1_ge_is_infinity' [-Wunused-function]
static int secp256k1_ge_is_infinity(const secp256k1_ge *a);
           ^
../src/secp256k1-src/src/group.h:60:12: warning: unused function 'secp256k1_ge_is_valid_var' [-Wunused-function]
static int secp256k1_ge_is_valid_var(const secp256k1_ge *a);
           ^
../src/secp256k1-src/src/group.h:62:13: warning: unused function 'secp256k1_ge_neg' [-Wunused-function]
static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a);
            ^
../src/secp256k1-src/src/group.h:65:13: warning: unused function 'secp256k1_ge_set_gej' [-Wunused-function]
static void secp256k1_ge_set_gej(secp256k1_ge *r, secp256k1_gej *a);
            ^
../src/secp256k1-src/src/group.h:68:13: warning: unused function 'secp256k1_ge_set_all_gej_var' [-Wunused-function]
static void secp256k1_ge_set_all_gej_var(secp256k1_ge *r, const secp256k1_gej *a, size_t len);
            ^
../src/secp256k1-src/src/group.h:75:13: warning: unused function 'secp256k1_ge_globalz_set_table_gej' [-Wunused-function]
static void secp256k1_ge_globalz_set_table_gej(size_t len, secp256k1_ge *r, secp256k1_fe *globalz, const secp256k1_gej *a, const secp256k1_fe *zr);
            ^
../src/secp256k1-src/src/group.h:78:13: warning: unused function 'secp256k1_ge_set_infinity' [-Wunused-function]
static void secp256k1_ge_set_infinity(secp256k1_ge *r);
            ^
../src/secp256k1-src/src/group.h:81:13: warning: unused function 'secp256k1_gej_set_infinity' [-Wunused-function]
static void secp256k1_gej_set_infinity(secp256k1_gej *r);
            ^
../src/secp256k1-src/src/group.h:84:13: warning: unused function 'secp256k1_gej_set_ge' [-Wunused-function]
static void secp256k1_gej_set_ge(secp256k1_gej *r, const secp256k1_ge *a);
            ^
../src/secp256k1-src/src/group.h:87:12: warning: unused function 'secp256k1_gej_eq_x_var' [-Wunused-function]
static int secp256k1_gej_eq_x_var(const secp256k1_fe *x, const secp256k1_gej *a);
           ^
../src/secp256k1-src/src/group.h:90:13: warning: unused function 'secp256k1_gej_neg' [-Wunused-function]
static void secp256k1_gej_neg(secp256k1_gej *r, const secp256k1_gej *a);
            ^
../src/secp256k1-src/src/group.h:93:12: warning: unused function 'secp256k1_gej_is_infinity' [-Wunused-function]
static int secp256k1_gej_is_infinity(const secp256k1_gej *a);
           ^
../src/secp256k1-src/src/group.h:96:12: warning: unused function 'secp256k1_gej_has_quad_y_var' [-Wunused-function]
static int secp256k1_gej_has_quad_y_var(const secp256k1_gej *a);
           ^
../src/secp256k1-src/src/group.h:100:13: warning: unused function 'secp256k1_gej_double_nonzero' [-Wunused-function]
static void secp256k1_gej_double_nonzero(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr);
            ^
../src/secp256k1-src/src/group.h:103:13: warning: unused function 'secp256k1_gej_double_var' [-Wunused-function]
static void secp256k1_gej_double_var(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr);
            ^
../src/secp256k1-src/src/group.h:106:13: warning: unused function 'secp256k1_gej_add_var' [-Wunused-function]
static void secp256k1_gej_add_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_gej *b, secp256k1_fe *rzr);
            ^
../src/secp256k1-src/src/group.h:109:13: warning: unused function 'secp256k1_gej_add_ge' [-Wunused-function]
static void secp256k1_gej_add_ge(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b);
            ^
../src/secp256k1-src/src/group.h:114:13: warning: unused function 'secp256k1_gej_add_ge_var' [-Wunused-function]
static void secp256k1_gej_add_ge_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, secp256k1_fe *rzr);
            ^
../src/secp256k1-src/src/group.h:117:13: warning: unused function 'secp256k1_gej_add_zinv_var' [-Wunused-function]
static void secp256k1_gej_add_zinv_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, const secp256k1_fe *bzinv);
            ^
../src/secp256k1-src/src/group.h:125:13: warning: unused function 'secp256k1_gej_clear' [-Wunused-function]
static void secp256k1_gej_clear(secp256k1_gej *r);
            ^
../src/secp256k1-src/src/group.h:128:13: warning: unused function 'secp256k1_ge_clear' [-Wunused-function]
static void secp256k1_ge_clear(secp256k1_ge *r);
            ^
../src/secp256k1-src/src/group.h:131:13: warning: unused function 'secp256k1_ge_to_storage' [-Wunused-function]
static void secp256k1_ge_to_storage(secp256k1_ge_storage *r, const secp256k1_ge *a);
            ^
../src/secp256k1-src/src/group.h:134:13: warning: unused function 'secp256k1_ge_from_storage' [-Wunused-function]
static void secp256k1_ge_from_storage(secp256k1_ge *r, const secp256k1_ge_storage *a);
            ^
../src/secp256k1-src/src/group.h:137:13: warning: unused function 'secp256k1_ge_storage_cmov' [-Wunused-function]
static void secp256k1_ge_storage_cmov(secp256k1_ge_storage *r, const secp256k1_ge_storage *a, int flag);
            ^
../src/secp256k1-src/src/group.h:140:13: warning: unused function 'secp256k1_gej_rescale' [-Wunused-function]
static void secp256k1_gej_rescale(secp256k1_gej *r, const secp256k1_fe *b);
            ^
In file included from ../src/privatekey.cc:4:
In file included from ../src/secp256k1-src/src/scalar_impl.h:20:
../src/secp256k1-src/src/scalar_4x64_impl.h:83:12: warning: unused function 'secp256k1_scalar_add' [-Wunused-function]
static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) {
           ^
../src/secp256k1-src/src/scalar_4x64_impl.h:897:12: warning: unused function 'secp256k1_scalar_shr_int' [-Wunused-function]
static int secp256k1_scalar_shr_int(secp256k1_scalar *r, int n) {
           ^
In file included from ../src/privatekey.cc:4:
../src/secp256k1-src/src/scalar_impl.h:225:13: warning: unused function 'secp256k1_scalar_inverse_var' [-Wunused-function]
static void secp256k1_scalar_inverse_var(secp256k1_scalar *r, const secp256k1_scalar *x) {
            ^
In file included from ../src/privatekey.cc:4:
In file included from ../src/secp256k1-src/src/scalar_impl.h:20:
../src/secp256k1-src/src/scalar_4x64_impl.h:140:13: warning: unused function 'secp256k1_scalar_negate' [-Wunused-function]
static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a) {
            ^
../src/secp256k1-src/src/scalar_4x64_impl.h:156:12: warning: unused function 'secp256k1_scalar_is_high' [-Wunused-function]
static int secp256k1_scalar_is_high(const secp256k1_scalar *a) {
           ^
../src/secp256k1-src/src/scalar_4x64_impl.h:168:12: warning: unused function 'secp256k1_scalar_cond_negate' [-Wunused-function]
static int secp256k1_scalar_cond_negate(secp256k1_scalar *r, int flag) {
           ^
63 warnings generated.
  CXX(target) Release/obj.target/secp256k1/src/publickey.o
  CXX(target) Release/obj.target/secp256k1/src/signature.o
  CXX(target) Release/obj.target/secp256k1/src/ecdsa.o
  CXX(target) Release/obj.target/secp256k1/src/ecdh.o
  CC(target) Release/obj.target/secp256k1/src/secp256k1-src/src/secp256k1.o
In file included from ../src/secp256k1-src/src/secp256k1.c:11:
../src/secp256k1-src/src/field_impl.h:263:13: warning: unused function 'secp256k1_fe_inv_all_var' [-Wunused-function]
static void secp256k1_fe_inv_all_var(secp256k1_fe *r, const secp256k1_fe *a, size_t len) {
            ^
In file included from ../src/secp256k1-src/src/secp256k1.c:13:
../src/secp256k1-src/src/group_impl.h:200:13: warning: unused function 'secp256k1_ge_set_infinity' [-Wunused-function]
static void secp256k1_ge_set_infinity(secp256k1_ge *r) {
            ^
../src/secp256k1-src/src/group_impl.h:689:12: warning: unused function 'secp256k1_gej_has_quad_y_var' [-Wunused-function]
static int secp256k1_gej_has_quad_y_var(const secp256k1_gej *a) {
           ^
../src/secp256k1-src/src/group_impl.h:270:12: warning: unused function 'secp256k1_gej_is_valid_var' [-Wunused-function]
static int secp256k1_gej_is_valid_var(const secp256k1_gej *a) {
           ^
In file included from ../src/secp256k1-src/src/secp256k1.c:14:
../src/secp256k1-src/src/ecmult_impl.h:1087:12: warning: unused function 'secp256k1_ecmult_multi_var' [-Wunused-function]
static int secp256k1_ecmult_multi_var(const secp256k1_ecmult_context *ctx, secp256k1_scratch *scratch, secp256k1_gej *r, const secp256k1_scalar *...
           ^
../src/secp256k1-src/src/ecmult_impl.h:668:12: warning: unused function 'secp256k1_ecmult_strauss_batch_single' [-Wunused-function]
static int secp256k1_ecmult_strauss_batch_single(const secp256k1_ecmult_context *actx, secp256k1_scratch *scratch, secp256k1_gej *r, const secp25...
           ^
../src/secp256k1-src/src/ecmult_impl.h:1041:12: warning: unused function 'secp256k1_ecmult_pippenger_batch_single' [-Wunused-function]
static int secp256k1_ecmult_pippenger_batch_single(const secp256k1_ecmult_context *actx, secp256k1_scratch *scratch, secp256k1_gej *r, const secp...
           ^
7 warnings generated.
  CC(target) Release/obj.target/secp256k1/src/secp256k1-src/contrib/lax_der_parsing.o
  CC(target) Release/obj.target/secp256k1/src/secp256k1-src/contrib/lax_der_privatekey_parsing.o
  SOLINK_MODULE(target) Release/secp256k1.node

> sha3@1.2.2 install /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/sha3
> node-gyp rebuild

  CXX(target) Release/obj.target/sha3/src/addon.o
  CXX(target) Release/obj.target/sha3/src/displayIntermediateValues.o
  CXX(target) Release/obj.target/sha3/src/KeccakF-1600-reference.o
  CXX(target) Release/obj.target/sha3/src/KeccakNISTInterface.o
  CXX(target) Release/obj.target/sha3/src/KeccakSponge.o
  SOLINK_MODULE(target) Release/sha3.node

> websocket@1.0.28 install /User<img width="1429" alt="sample.png" src="https://qiita-image-store.s3.amazonaws.com/0/359665/8d82350a-5e51-9ecf-31d0-d437a1358190.png">
s/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/truffle-hdwallet-provider/node_modules/websocket
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node

> websocket@1.0.26 install /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/web3-providers-ws/node_modules/websocket
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node

> websocket@1.0.26 install /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/web3-providers/node_modules/websocket
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node

> web3@1.0.0-beta.48 postinstall /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/node_modules/web3
> node angular-patch.js

(node:74112) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added. Use emitter.setMaxListeners() to increase limit
npm WARN truffle-dappchain-example@ No repository field.
npm WARN truffle-dappchain-example@ No license field.

added 377 packages from 105 contributors, removed 219 packages, updated 1232 packages and audited 233684 packages in 83.52s
found 3 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details 

```
上手くいった。

DAppチェーンを起動して、deployを実施。

```terminal
./loom run
$ yarn deploy
yarn run v1.13.0
$ truffle deploy --network loom_dapp_chain

Compiling your contracts...
===========================
> Compiling ./contracts/Migrations.sol
> Compiling ./contracts/MyCoin.sol
> Compiling ./contracts/MyRinkebyCoin.sol
> Compiling ./contracts/MyRinkebyToken.sol
> Compiling ./contracts/MyToken.sol
> Compiling ./contracts/SimpleStore.sol
> Compiling openzeppelin-solidity/contracts/AddressUtils.sol
> Compiling openzeppelin-solidity/contracts/introspection/ERC165.sol
> Compiling openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol
> Compiling openzeppelin-solidity/contracts/math/SafeMath.sol
> Compiling openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol
> Compiling openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
> Compiling openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
> Compiling openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol
> Compiling openzeppelin-solidity/contracts/token/ERC721/ERC721.sol
> Compiling openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol
> Compiling openzeppelin-solidity/contracts/token/ERC721/ERC721BasicToken.sol
> Compiling openzeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol
> Compiling openzeppelin-solidity/contracts/token/ERC721/ERC721Token.sol
> Artifacts written to /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/src/contracts
> Compiled successfully using:
   - solc: 0.4.24+commit.e67f0147.Emscripten.clang


Starting migrations...
======================
> Network name:    'loom_dapp_chain'
> Network id:      13654820909954
> Block gas limit: 0


1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------
   > transaction hash:    0xd3edaa2ba732cd4f5763299c70db5ece8b6394af270350c9688dd43d0d7db261
   > Blocks: 0            Seconds: 0
   > contract address:    0x36601199014D7DbE92c5b1142457a4B2dac021d6
   > account:             0xcDCE3C555d8309eb7442c8bc7eaEdce8A4922922
   > balance:             0
   > gas used:            0
   > gas price:           0 gwei
   > value sent:          0 ETH
   > total cost:          0 ETH


   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:                   0 ETH


2_simple_store.js
=================

   Deploying 'SimpleStore'
   -----------------------
   > transaction hash:    0xcb557506cfba0b8dfdb5e9f6efc6321c11a504e42139f080c3baa9c5e40e6444
   > Blocks: 0            Seconds: 0
   > contract address:    0xaBA7692fb3a0A98A1Af38f5e878917B996BAFDA4
   > account:             0xcDCE3C555d8309eb7442c8bc7eaEdce8A4922922
   > balance:             0
   > gas used:            0
   > gas price:           0 gwei
   > value sent:          0 ETH
   > total cost:          0 ETH


   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:                   0 ETH


3_token_contracts.js
====================

   Deploying 'MyToken'
   -------------------
   > transaction hash:    0x554521a7ef8f83cddfb883525e033ec175db3940d7805a9adee921b533ef5889
   > Blocks: 0            Seconds: 0
   > contract address:    0x725bE02c1B96834cFDA0DdBB3aFfe1E792597BDa
   > account:             0xcDCE3C555d8309eb7442c8bc7eaEdce8A4922922
   > balance:             0
   > gas used:            0
   > gas price:           0 gwei
   > value sent:          0 ETH
   > total cost:          0 ETH


   Deploying 'MyCoin'
   ------------------
   > transaction hash:    0xbc6ae6802c606eac4bc429d85ad4954258f949a76fe7356ddb091bee9031c584
   > Blocks: 0            Seconds: 0
   > contract address:    0x03937f68696cd351E5eBD33823bB88A2516e360B
   > account:             0xcDCE3C555d8309eb7442c8bc7eaEdce8A4922922
   > balance:             0
   > gas used:            0
   > gas price:           0 gwei
   > value sent:          0 ETH
   > total cost:          0 ETH


*************************************************************************

MyToken Contract Address: 0x725bE02c1B96834cFDA0DdBB3aFfe1E792597BDa
MyCoin Contract Address: 0x03937f68696cd351E5eBD33823bB88A2516e360B

*************************************************************************


   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:                   0 ETH


4_rinkeby_contracts.js
======================

   > Saving migration to chain.
   -------------------------------------
   > Total cost:                   0 ETH


Summary
=======
> Total deployments:   4
> Final cost:          0 ETH

✨  Done in 31.44s.
kanekohBookpuro:truffle-dappchain-example h-kane$ 


kanekohBookpuro:truffle-dappchain-example h-kane$ yarn test
yarn run v1.13.0
$ truffle test --network loom_dapp_chain
Using network 'loom_dapp_chain'.


Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.


*************************************************************************

MyToken Contract Address: 0xbEab3b0245a56cCF56733F2909D61Cd4c8c1263F
MyCoin Contract Address: 0x228cb5118DAf0d7816D6337e0c473e6bd98d0Eab

*************************************************************************



  Contract: SimpleStore
    ✓ Should have an address for SimpleStore
    ✓ Should set a value (1389ms)


  2 passing (4s)

✨  Done in 23.62s.
```

テスト実行。

```terminal
$ yarn test
yarn run v1.13.0
$ truffle test --network loom_dapp_chain
Using network 'loom_dapp_chain'.


Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.


*************************************************************************

MyToken Contract Address: 0xbEab3b0245a56cCF56733F2909D61Cd4c8c1263F
MyCoin Contract Address: 0x228cb5118DAf0d7816D6337e0c473e6bd98d0Eab

*************************************************************************



  Contract: SimpleStore
    ✓ Should have an address for SimpleStore
    ✓ Should set a value (1389ms)


  2 passing (4s)

✨  Done in 23.62s.
```

これでDAppチェーンにデプロイできているはずなので、次はブラウザで動かしてみる

```terminal
$ yarn run serve 
yarn run v1.13.0
$ webpack-dev-server --hot --content-base ./dist
ℹ ｢wds｣: Project is running at http://localhost:8080/
ℹ ｢wds｣: webpack output is served from /
ℹ ｢wds｣: Content not from webpack is served from /Users/h-kane/Work/Program/ethreum/loom-dapp/truffle-dappchain-example/dist
ℹ ｢wds｣: 404s will fallback to /index.html
ℹ ｢wdm｣: Hash: 41b983e23458286d7f01
Version: webpack 4.19.1
Time: 4239ms
Built at: 2019-03-09 15:30:02
    Asset      Size  Chunks             Chunk Names
bundle.js  7.69 MiB    main  [emitted]  main
Entrypoint main = bundle.js
[../node_modules/loglevel/lib/loglevel.js] 7.68 KiB {main} [built]
[../node_modules/querystring-es3/index.js] 127 bytes {main} [built]
[../node_modules/react-dom/index.js] 1.33 KiB {main} [built]
[../node_modules/react/index.js] 190 bytes {main} [built]
[../node_modules/regenerator-runtime/runtime.js] 23.6 KiB {main} [built]
[../node_modules/url/url.js] 22.8 KiB {main} [built]
[0] multi ../node_modules/webpack-dev-server/client?http://localhost:8080 ../node_modules/webpack/hot/dev-server.js regenerator-runtime/runtime ./index 64 bytes {main} [built]
[../node_modules/webpack-dev-server/client/index.js?http://localhost:8080] ../node_modules/webpack-dev-server/client?http://localhost:8080 8.1 KiB {main} [built]
[../node_modules/webpack-dev-server/client/overlay.js] 3.59 KiB {main} [built]
[../node_modules/webpack/hot/dev-server.js] 1.61 KiB {main} [built]
[../node_modules/webpack/hot/emitter.js] 75 bytes {main} [built]
[../node_modules/webpack/hot/log-apply-result.js] 1.27 KiB {main} [built]
[../node_modules/webpack/hot/log.js] 1.11 KiB {main} [built]
[./contract.js] 2.91 KiB {main} [built]
[./index.js] 2.51 KiB {main} [built]
    + 930 hidden modules
ℹ ｢wdm｣: Compiled successfully.
```

ブラウザ確認。

<img width="1429" alt="sample.png" src="https://qiita-image-store.s3.amazonaws.com/0/359665/2c879acb-ef38-82f2-3dcf-dc12951f988d.png">

表示はされたけど動かない...
Chrome DevToolsでコンソールをみると、以下のエラーが発生している。

```
Uncaught (in promise) Error: Contract not deployed on DAppChain
    at Contract._createContractInstance (webpack:///./contract.js?:58)
```
エラー個所確認。

```js:contract.js
    const networkId = await this._getCurrentNetwork()
    this.currentNetwork = SimpleStore.networks[networkId]

    if (!this.currentNetwork) {
      throw Error('Contract not deployed on DAppChain')
    }
```

デバッグで見ると、neworkIdに"default"が設定されている。
SimpleStore.jsonにnetworksでdefaultがないことが原因?


```json:SimpleStore.json
  "networks": {
    "13654820909954": {
      "events": {},
      "links": {},
      "address": "0x1378595861E095bC2531120c371AA1108c28B449",
      "transactionHash": "0x5c69eda2b4d1d97f10f3ea6d736e2ecaba525d729daee236edf3d9dc76700ca7"
    }
```

SimpleStore.jsonに設定されているIDを取得するように変更して再実行。

```js:contract.js
  async _getCurrentNetwork() {
    //return Promise.resolve('default')
    return Promise.resolve('13654820909954')
  }
```
さっきの所は通ったけど、別の所でエラーが発生。

```js
web3-providers.umd.js:1136 Uncaught (in promise) Error: Subscriptions are not supported with the CustomProvider.
    at CustomProvider.subscribe (web3-providers.umd.js:1136)
    at EventLogSubscription.subscribe (web3-core-subscriptions.umd.js:49)
    at EventLogSubscription.subscribe (web3-core-subscriptions.umd.js:124)
    at EventSubscriptionsProxy.subscribe (web3-eth-contract.umd.js:606)
    at Proxy.eval (web3-eth-contract.umd.js:587)
    at Contract._createContractInstance (contract.js:65)
```
CustomProviderではサブスクリプションはサポートされていません。

上手く動かないので、一旦諦め...

# 参考
https://loomx.io/developers/docs/ja/basic-install-all.html
https://loomx.io/developers/docs/ja/truffle-deploy.html