Solidity(Remix)とgitを連携させ、Ethereumの開発をする

Macにgitを連携させたEthereumの開発環境を構築します。
Macで構築していますが、Linux等でも大きな流れは変わりません。

<スポンサードリンク>

前提条件

・nodeとnpmがinstallされている。
 installされていなければ下記のurlを参考にinstallしてください。

 nodejs、npmインストール手順 徹底解説

 

・remixがinstallされている。

 されていない場合は、下記のurlからzipファイルを落としてきて、index.htmlを開いてください。
 https://github.com/ethereum/browser-solidity

構築手順

1.お好きな場所に、プロジェクト用のディレクトリを作成

% mkdir project

2.remixdをinstall

長いので無視していただいて構いませんが、成功すると下記のようなログが出ます。

% npm isntall -g remixd

npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated tar.gz@1.0.7: ⚠️  WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar

> scrypt@6.0.3 preinstall /Users/xxxx/.nodebrew/node/v10.0.0/lib/node_modules/remixd/node_modules/scrypt
> node node-scrypt-preinstall.js

/Users/xxxx/.nodebrew/node/v10.0.0/bin/remixd -> /Users/xxxx/.nodebrew/node/v10.0.0/lib/node_modules/remixd/bin/remixd

> fsevents@1.2.4 install /Users/xxxx/.nodebrew/node/v10.0.0/lib/node_modules/remixd/node_modules/fsevents
> node install

[fsevents] Success: "/Users/xxxx/.nodebrew/node/v10.0.0/lib/node_modules/remixd/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> scrypt@6.0.3 install /Users/xxxx/.nodebrew/node/v10.0.0/lib/node_modules/remixd/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:1618:3: note: 'Call' has been explicitly marked deprecated here
  Call(int argc, v8::Local<v8::Value> argv[]) const {
  ^
../src/node-boilerplate/scrypt_params_async.cc:32:13: warning: 'Call' is deprecated [-Wdeprecated-declarations]
  callback->Call(2, argv);
            ^
../../nan/nan.h:1618:3: note: 'Call' has been explicitly marked deprecated here
  Call(int argc, v8::Local<v8::Value> argv[]) const {
  ^
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:1618:3: note: 'Call' has been explicitly marked deprecated here
  Call(int argc, v8::Local<v8::Value> argv[]) const {
  ^
../src/node-boilerplate/scrypt_kdf_async.cc:28:15: warning: 'Call' is deprecated [-Wdeprecated-declarations]
    callback->Call(2, argv);
              ^
../../nan/nan.h:1618:3: note: 'Call' has been explicitly marked deprecated here
  Call(int argc, v8::Local<v8::Value> argv[]) const {
  ^
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:1618:3: note: 'Call' has been explicitly marked deprecated here
  Call(int argc, v8::Local<v8::Value> argv[]) const {
  ^
../src/node-boilerplate/scrypt_kdf-verify_async.cc:30:13: warning: 'Call' is deprecated [-Wdeprecated-declarations]
  callback->Call(2, argv);
            ^
../../nan/nan.h:1618:3: note: 'Call' has been explicitly marked deprecated here
  Call(int argc, v8::Local<v8::Value> argv[]) const {
  ^
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:1618:3: note: 'Call' has been explicitly marked deprecated here
  Call(int argc, v8::Local<v8::Value> argv[]) const {
  ^
../src/node-boilerplate/scrypt_hash_async.cc:52:13: warning: 'Call' is deprecated [-Wdeprecated-declarations]
  callback->Call(2, argv);
            ^
../../nan/nan.h:1618:3: note: 'Call' has been explicitly marked deprecated here
  Call(int argc, v8::Local<v8::Value> argv[]) const {
  ^
2 warnings generated.
  CXX(target) Release/obj.target/scrypt/scrypt_node.o
  SOLINK_MODULE(target) Release/scrypt.node

> sha3@1.2.2 install /Users/xxxx/.nodebrew/node/v10.0.0/lib/node_modules/remixd/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.26 install /Users/xxxx/.nodebrew/node/v10.0.0/lib/node_modules/remixd/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/xxxx/.nodebrew/node/v10.0.0/lib/node_modules/remixd/node_modules/websocket
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bufferutil/src/bufgferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node
+ remixd@0.1.8-alpha.4
added 839 packages from 405 contributors in 166.19s

 

3.インストールされていることを確認

 

% remixd -h


  Usage: remixd -s <shared folder>

  Provide a two ways connection between the local computer and Remix IDE

  Options:

    -s, --shared-folder <path>            Folder to share with Remix IDE
    -m, --mist                            start mist
    -g, --geth                            start geth
    -p, --dev-path <dev-path>             Folder used by mist/geth to start the development instance
    -f, --frontend <front-end>            Folder that should be served by remixd
    -p, --frontend-port <front-end-port>  Http port used by the frontend (default 8082)
    -a, --auto-mine                       mine pending transactions
    -r, --rpc <cors-domains>              start rpc server. Values are CORS domain
    -rp, --rpc-port                       rpc server port (default 8545)
    -h, --help                            output usage information

 

<スポンサードリンク>


4.remixdコマンドを作業ディレクトリを指定し、実行

% remixd -s /path/to/work/dir

example: --dev-path /home/devchains/chain1 --mist --geth --frontend /home/frontend --frontend-port 8084 --auto-mine

  Usage: remixd -s <shared folder>

  Provide a two ways connection between the local computer and Remix IDE

  Options:

    -s, --shared-folder <path>            Folder to share with Remix IDE
    -m, --mist                            start mist
    -g, --geth                            start geth
    -p, --dev-path <dev-path>             Folder used by mist/geth to start the development instance
    -f, --frontend <front-end>            Folder that should be served by remixd
    -p, --frontend-port <front-end-port>  Http port used by the frontend (default 8082)
    -a, --auto-mine                       mine pending transactions
    -r, --rpc <cors-domains>              start rpc server. Values are CORS domain
    -rp, --rpc-port                       rpc server port (default 8545)
    -h, --help                            output usage information
[WARN] Any application that runs on your computer can potentially read from and write to all files in the directory.
[WARN] Symbolinc links are not forwarded to Remix IDE

[WARN] Symbolic link modification not allowed : project | /Users/xxxx/project
Shared folder : project
Tue Jun 05 2018 23:56:23 GMT+0900 (JST) Remixd is listening on 127.0.0.1:65520

 

5.remixにアクセス

今回はローカル版で実施します。
ローカルに落としたremix(index.html)を開いてください。

少しわかりにくいですが、左上にある5個のアイコンのうち、
左から5個目の鎖マークのアイコンをクリックしてください。

次に「connect」ボタンをクリックしてください。

 

成功すると左側のペインにlocalのファイルが出てきます。

以上で、local(git)とremixの連携は完了です。

 

関連

Ethereum Solidityの最強の開発環境を構築 これだけ!

【solidity】業務ロジックとデータロジックを分断するコントラクト設計

【初心者向け】solidity基礎 modifierの使い方を徹底解説

【初心者向け】Solidity 外部コントラクトの呼び出し方法を徹底解説

Ethereum プライベートネットワークでgeth起動時にnodeを自動接続する方法

スポンサードリンク



コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

CAPTCHA