페이지

2020년 5월 22일 금요일

Indy SDK 빌드 및 설치

Indy SDK 빌드 및 설치

Indy SDK 바이너리 파일을 설치하려면 아래의 문서를 참고하여 libindy, libnullpay, libvcx, 그리고 indy-cli를 설치할 수 있습니다.

여기서는 아래 문서들을 참고하여 Ubuntu에서 Indy SDK 소스를 빌드하고 설치하는 과정을 실습합니다.

1. 실습 환경

2. C 빌드 프로그램 설치

  1. Make를 설치합니다.

    $ sudo apt-get install make
    
  2. C/C++ 컴파일러 및 링커를 설치합니다.

    $ sudo apt-get install g++
    

3. Rust 빌드 프로그램 설치

  1. 터미널에서 아래 명령을 실행합니다.

    $ curl https://sh.rustup.rs -sSf | sh
    

    위 명령은 다음 작업을 수행합니다.

    1. 설치 스크립트 다운로드
    2. 설치 스크립트 실행
      1. rustup을 설치
      2. rustup을 사용하여 최신 버전의 Rust를 설치
      3. Rust 실행 경로 $HOME/.cargo/bin를 환경변수 PATH에 추가

    설치에 성공하면 아래의 메시지가 출력됩니다.

    Rust is installed now. Great!
    
  2. 다시 로그인하면 Rust 실행 경로 $HOME/.cargo/bin가 환경변수 PATH에 포함되어 있을 것입니다.

  3. 설치한 Rust 컴파일러의 버전을 확인합니다.

    $ rustc --version
    rustc 1.43.1 (8d69840ab 2020-05-04)
    

4. Indy SDK 빌드 및 설치

  1. 필요한 라이브러리와 도구를 설치합니다.

    $ sudo apt-get update && \
    $ sudo apt-get install -y \
       build-essential \
       pkg-config \
       cmake \
       libssl-dev \
       libsqlite3-dev \
       libzmq3-dev \
       libncursesw5-dev
    
  2. libindy가 필요로 하는 libsodium은 apt 저장소에서 제공하지 않기 때문에 소스를 다운로드하여 빌드합니다.

    $ cd /tmp && \
      curl https://download.libsodium.org/libsodium/releases/old/unsupported/libsodium-1.0.14.tar.gz | tar -xz && \
       cd /tmp/libsodium-1.0.14 && \
       ./configure --disable-shared && \
       make && \
       sudo make install && \
       rm -rf /tmp/libsodium-1.0.14
    
  3. libindy 소스를 다운로드하여 빌드합니다.

    $ cd $HOME
    $ git clone https://github.com/hyperledger/indy-sdk.git
    $ cd ./indy-sdk/libindy
    $ cargo build
    

5. 테스트

5.1 Indy 노드 풀 실행

How to start local nodes pool with docker 문서를 참고하여 Indy 노드 풀을 로컬로 실행합니다.

  1. Docker로 Indy 풀을 빌드합니다.

    $ cd $HOME/indy-sdk
    $ docker build -f ci/indy-pool.dockerfile -t indy_pool .
    Sending build context to Docker daemon  4.832GB
    Step 1/22 : FROM ubuntu:16.04
     ---> 005d2078bdfa
    Step 2/22 : ARG uid=1000
     ---> Using cache
     ---> 8e4ce2fe34c7
    Step 3/22 : RUN apt-get update -y && apt-get install -y 	git 	wget 	python3.5 	python3-pip 	python-setuptools 	python3-nacl 	apt-transport-https 	ca-certificates 	supervisor
     ---> Using cache
     ---> c4db29f53a16
    Step 4/22 : RUN pip3 install -U 	pip==9.0.3 	setuptools
     ---> Using cache
     ---> 29699d8b1bcf
    Step 5/22 : RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 || apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CE7709D068DB5E88
     ---> Using cache
     ---> 5bc97b4e8591
    Step 6/22 : ARG indy_stream=master
     ---> Using cache
     ---> 847ea83573d3
    Step 7/22 : RUN echo "deb https://repo.sovrin.org/deb xenial $indy_stream" >> /etc/apt/sources.list
     ---> Using cache
     ---> c852d95dfaec
    Step 8/22 : RUN useradd -ms /bin/bash -u $uid indy
     ---> Using cache
     ---> 066abdcbb31e
    Step 9/22 : ARG indy_plenum_ver=1.12.1~dev989
     ---> Using cache
     ---> 321047b89616
    Step 10/22 : ARG indy_node_ver=1.12.1~dev1172
     ---> Using cache
     ---> 65a940e326d2
    Step 11/22 : ARG python3_indy_crypto_ver=0.4.5
     ---> Using cache
     ---> 2c012ba0ff4c
    Step 12/22 : ARG indy_crypto_ver=0.4.5
     ---> Using cache
     ---> c5e27ff6da07
    Step 13/22 : ARG python3_pyzmq_ver=18.1.0
     ---> Using cache
     ---> daf212ffee6f
    Step 14/22 : RUN apt-get update -y && apt-get install -y         python3-pyzmq=${python3_pyzmq_ver}         indy-plenum=${indy_plenum_ver}         indy-node=${indy_node_ver}         python3-indy-crypto=${python3_indy_crypto_ver}         libindy-crypto=${indy_crypto_ver}         vim
     ---> Using cache
     ---> dd09e2535e0e
    Step 15/22 : RUN echo "[supervisord]\nlogfile = /tmp/supervisord.log\nlogfile_maxbytes = 50MB\nlogfile_backups=10\nlogLevel = error\npidfile = /tmp/supervisord.pid\nnodaemon = true\nminfds = 1024\nminprocs = 200\numask = 022\nuser = indy\nidentifier = supervisor\ndirectory = /tmp\nnocleanup = true\nchildlogdir = /tmp\nstrip_ansi = false\n\n[program:node1]\ncommand=start_indy_node Node1 0.0.0.0 9701 0.0.0.0 9702\ndirectory=/home/indy\nstdout_logfile=/tmp/node1.log\nstderr_logfile=/tmp/node1.log\n\n[program:node2]\ncommand=start_indy_node Node2 0.0.0.0 9703 0.0.0.0 9704\ndirectory=/home/indy\nstdout_logfile=/tmp/node2.log\nstderr_logfile=/tmp/node2.log\n\n[program:node3]\ncommand=start_indy_node Node3 0.0.0.0 9705 0.0.0.0 9706\ndirectory=/home/indy\nstdout_logfile=/tmp/node3.log\nstderr_logfile=/tmp/node3.log\n\n[program:node4]\ncommand=start_indy_node Node4 0.0.0.0 9707 0.0.0.0 9708\ndirectory=/home/indy\nstdout_logfile=/tmp/node4.log\nstderr_logfile=/tmp/node4.log\n">> /etc/supervisord.conf
     ---> Using cache
     ---> a293cada0e77
    Step 16/22 : USER indy
     ---> Using cache
     ---> a80b0dfc3571
    Step 17/22 : RUN awk '{if (index($1, "NETWORK_NAME") != 0) {print("NETWORK_NAME = \"sandbox\"")} else print($0)}' /etc/indy/indy_config.py> /tmp/indy_config.py
     ---> Using cache
     ---> dcb46ff2da65
    Step 18/22 : RUN mv /tmp/indy_config.py /etc/indy/indy_config.py
     ---> Using cache
     ---> e540d82dfe32
    Step 19/22 : ARG pool_ip=127.0.0.1
     ---> Using cache
     ---> fd5c44727a33
    Step 20/22 : RUN generate_indy_pool_transactions --nodes 4 --clients 5 --nodeNum 1 2 3 4 --ips="$pool_ip,$pool_ip,$pool_ip,$pool_ip"
     ---> Running in 3290618d5b14
    Generating keys for provided seed b'000000000000000000000000000Node1'
    Init local keys for client-stack
    Public key is HXrfcFWDjWusENBoXhV8mARzq51f1npWYWaA1GzfeMDG
    Verification key is Gw6pDLhcBcoQesN72qfotTgFa7cbuqZpkX3Xo6pLhPhv
    Init local keys for node-stack
    Public key is HXrfcFWDjWusENBoXhV8mARzq51f1npWYWaA1GzfeMDG
    Verification key is Gw6pDLhcBcoQesN72qfotTgFa7cbuqZpkX3Xo6pLhPhv
    BLS Public key is 4N8aUNHSgjQVgkpm8nhNEfDf6txHznoYREg9kirmJrkivgL4oSEimFF6nsQ6M41QvhM2Z33nves5vfSn9n1UwNFJBYtWVnHYMATn76vLuL3zU88KyeAYcHfsih3He6UHcXDxcaecHVz6jhCYz1P2UZn2bDVruL5wXpehgBfBaLKm3Ba
    Proof of possession for BLS key is RahHYiCvoNCtPTrVtP7nMC5eTYrsUA8WjXbdhNc8debh1agE9bGiJxWBXYNFbnJXoXhWFMvyqhqhRoq737YQemH5ik9oL7R4NTTCz2LEZhkgLJzB3QRQqJyBNyv7acbdHrAT8nQ9UkLbaVL9NBpnWXBTw4LEMePaSHEw66RzPNdAX1
    This node with name Node1 will use ports 9701 and 9702 for nodestack and clientstack respectively
    Generating keys for provided seed b'000000000000000000000000000Node2'
    Init local keys for client-stack
    Public key is Fsp2dyt7D2B4GA53hKnEmLym5Y75ExGFz2ZBzcQMNKsB
    Verification key is 8ECVSk179mjsjKRLWiQtssMLgp6EPhWXtaYyStWPSGAb
    Init local keys for node-stack
    Public key is Fsp2dyt7D2B4GA53hKnEmLym5Y75ExGFz2ZBzcQMNKsB
    Verification key is 8ECVSk179mjsjKRLWiQtssMLgp6EPhWXtaYyStWPSGAb
    BLS Public key is 37rAPpXVoxzKhz7d9gkUe52XuXryuLXoM6P6LbWDB7LSbG62Lsb33sfG7zqS8TK1MXwuCHj1FKNzVpsnafmqLG1vXN88rt38mNFs9TENzm4QHdBzsvCuoBnPH7rpYYDo9DZNJePaDvRvqJKByCabubJz3XXKbEeshzpz4Ma5QYpJqjk
    Proof of possession for BLS key is Qr658mWZ2YC8JXGXwMDQTzuZCWF7NK9EwxphGmcBvCh6ybUuLxbG65nsX4JvD4SPNtkJ2w9ug1yLTj6fgmuDg41TgECXjLCij3RMsV8CwewBVgVN67wsA45DFWvqvLtu4rjNnE9JbdFTc1Z4WCPA3Xan44K1HoHAq9EVeaRYs8zoF5
    This node with name Node2 will use ports 9703 and 9704 for nodestack and clientstack respectively
    Generating keys for provided seed b'000000000000000000000000000Node3'
    Init local keys for client-stack
    Public key is 6KTs7Q9Lng5uX6oWCkVifiJ6hSpkdHiRijAsXtAunnGN
    Verification key is DKVxG2fXXTU8yT5N7hGEbXB3dfdAnYv1JczDUHpmDxya
    Init local keys for node-stack
    Public key is 6KTs7Q9Lng5uX6oWCkVifiJ6hSpkdHiRijAsXtAunnGN
    Verification key is DKVxG2fXXTU8yT5N7hGEbXB3dfdAnYv1JczDUHpmDxya
    BLS Public key is 3WFpdbg7C5cnLYZwFZevJqhubkFALBfCBBok15GdrKMUhUjGsk3jV6QKj6MZgEubF7oqCafxNdkm7eswgA4sdKTRc82tLGzZBd6vNqU8dupzup6uYUf32KTHTPQbuUM8Yk4QFXjEf2Usu2TJcNkdgpyeUSX42u5LqdDDpNSWUK5deC5
    Proof of possession for BLS key is QwDeb2CkNSx6r8QC8vGQK3GRv7Yndn84TGNijX8YXHPiagXajyfTjoR87rXUu4G4QLk2cF8NNyqWiYMus1623dELWwx57rLCFqGh7N4ZRbGDRP4fnVcaKg1BcUxQ866Ven4gw8y4N56S5HzxXNBZtLYmhGHvDtk6PFkFwCvxYrNYjh
    This node with name Node3 will use ports 9705 and 9706 for nodestack and clientstack respectively
    Generating keys for provided seed b'000000000000000000000000000Node4'
    Init local keys for client-stack
    Public key is ECUd5UfoYa2yUBkmxNkMbkfGKcZ8Voh5Mi3JzBwWEDpm
    Verification key is 4PS3EDQ3dW1tci1Bp6543CfuuebjFrg36kLAUcskGfaA
    Init local keys for node-stack
    Public key is ECUd5UfoYa2yUBkmxNkMbkfGKcZ8Voh5Mi3JzBwWEDpm
    Verification key is 4PS3EDQ3dW1tci1Bp6543CfuuebjFrg36kLAUcskGfaA
    BLS Public key is 2zN3bHM1m4rLz54MJHYSwvqzPchYp8jkHswveCLAEJVcX6Mm1wHQD1SkPYMzUDTZvWvhuE6VNAkK3KxVeEmsanSmvjVkReDeBEMxeDaayjcZjFGPydyey1qxBHmTvAnBKoPydvuTAqx5f7YNNRAdeLmUi99gERUU7TD8KfAa6MpQ9bw
    Proof of possession for BLS key is RPLagxaR5xdimFzwmzYnz4ZhWtYQEj8iR5ZU53T2gitPCyCHQneUn2Huc4oeLd2B2HzkGnjAff4hWTJT6C7qHYB1Mv2wU5iHHGFWkhnTX9WsEAbunJCV2qcaXScKj4tTfvdDKfLiVuU2av6hbsMztirRze7LvYBkRHV3tGwyCptsrP
    This node with name Node4 will use ports 9707 and 9708 for nodestack and clientstack respectively
    BLS Public key is 4N8aUNHSgjQVgkpm8nhNEfDf6txHznoYREg9kirmJrkivgL4oSEimFF6nsQ6M41QvhM2Z33nves5vfSn9n1UwNFJBYtWVnHYMATn76vLuL3zU88KyeAYcHfsih3He6UHcXDxcaecHVz6jhCYz1P2UZn2bDVruL5wXpehgBfBaLKm3Ba
    Proof of possession for BLS key is RahHYiCvoNCtPTrVtP7nMC5eTYrsUA8WjXbdhNc8debh1agE9bGiJxWBXYNFbnJXoXhWFMvyqhqhRoq737YQemH5ik9oL7R4NTTCz2LEZhkgLJzB3QRQqJyBNyv7acbdHrAT8nQ9UkLbaVL9NBpnWXBTw4LEMePaSHEw66RzPNdAX1
    BLS Public key is 37rAPpXVoxzKhz7d9gkUe52XuXryuLXoM6P6LbWDB7LSbG62Lsb33sfG7zqS8TK1MXwuCHj1FKNzVpsnafmqLG1vXN88rt38mNFs9TENzm4QHdBzsvCuoBnPH7rpYYDo9DZNJePaDvRvqJKByCabubJz3XXKbEeshzpz4Ma5QYpJqjk
    Proof of possession for BLS key is Qr658mWZ2YC8JXGXwMDQTzuZCWF7NK9EwxphGmcBvCh6ybUuLxbG65nsX4JvD4SPNtkJ2w9ug1yLTj6fgmuDg41TgECXjLCij3RMsV8CwewBVgVN67wsA45DFWvqvLtu4rjNnE9JbdFTc1Z4WCPA3Xan44K1HoHAq9EVeaRYs8zoF5
    BLS Public key is 3WFpdbg7C5cnLYZwFZevJqhubkFALBfCBBok15GdrKMUhUjGsk3jV6QKj6MZgEubF7oqCafxNdkm7eswgA4sdKTRc82tLGzZBd6vNqU8dupzup6uYUf32KTHTPQbuUM8Yk4QFXjEf2Usu2TJcNkdgpyeUSX42u5LqdDDpNSWUK5deC5
    Proof of possession for BLS key is QwDeb2CkNSx6r8QC8vGQK3GRv7Yndn84TGNijX8YXHPiagXajyfTjoR87rXUu4G4QLk2cF8NNyqWiYMus1623dELWwx57rLCFqGh7N4ZRbGDRP4fnVcaKg1BcUxQ866Ven4gw8y4N56S5HzxXNBZtLYmhGHvDtk6PFkFwCvxYrNYjh
    BLS Public key is 2zN3bHM1m4rLz54MJHYSwvqzPchYp8jkHswveCLAEJVcX6Mm1wHQD1SkPYMzUDTZvWvhuE6VNAkK3KxVeEmsanSmvjVkReDeBEMxeDaayjcZjFGPydyey1qxBHmTvAnBKoPydvuTAqx5f7YNNRAdeLmUi99gERUU7TD8KfAa6MpQ9bw
    Proof of possession for BLS key is RPLagxaR5xdimFzwmzYnz4ZhWtYQEj8iR5ZU53T2gitPCyCHQneUn2Huc4oeLd2B2HzkGnjAff4hWTJT6C7qHYB1Mv2wU5iHHGFWkhnTX9WsEAbunJCV2qcaXScKj4tTfvdDKfLiVuU2av6hbsMztirRze7LvYBkRHV3tGwyCptsrP
    Removing intermediate container 3290618d5b14
     ---> dc14f981b386
    Step 21/22 : EXPOSE 9701 9702 9703 9704 9705 9706 9707 9708
     ---> Running in 30903fff91f4
    Removing intermediate container 30903fff91f4
     ---> 86e1e83f19c2
    Step 22/22 : CMD ["/usr/bin/supervisord"]
     ---> Running in 7a8ade3e2407
    Removing intermediate container 7a8ade3e2407
     ---> ab8792faed23
    Successfully built ab8792faed23
    Successfully tagged indy_pool:latest
    
  2. Indy 풀을 실행합니다.

    $ docker run -itd -p 9701-9708:9701-9708 indy_pool
    e5f15ad2c43e39c5c8cf4c798445da395da0b268a32f0f8fc6f642a96adb9d18
    

5.2 테스트 시작

  1. 아래의 명령으로 테스트를 시작합니다.

    $ cd $HOME/indy-sdk/libindy
    $ RUST_TEST_THREADS=1 cargo test
    

    Indy 풀의 IP를 아래와 같이 환경변수 TEST_POOL_IP에 지정하여 실행할 수 있습니다.

    $ RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test
    

5.3 Indy CLI 빌드

  1. indy-clilibindy에 의존하기 때문에 아래와 같이 libindy가 있는 위치를 지정하여 빌드합니다.

    $ cd $HOME/indy-sdk/cli/
    $ RUSTFLAGS=" -L ../libindy/target/debug" cargo build
    
  2. 환경변수 LD_LIBRARY_PATHlibindy가 있는 위치를 추가합니다.

    echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/indy-sdk/libindy/target/debug" >> ~/.bashrc
    sudo ldconfig
    source ~/.bashrc
    
  3. 아래 명령으로 indy-cli를 실행합니다.

    $ cd $HOME/indy-sdk/cli/target/debug
    $ ./indy-cli
    

Written with StackEdit.

댓글 없음:

댓글 쓰기

JWT 토큰 생성과 유효성 확인 과정

JWT 토큰 생성과 유효성 확인 과정 API 서비스를 개발하고 이에 대한 접근 권한을 제어하기 위하여 JSON Web Token(JWT)을 활용할 수 있습니다. 이 문서에서는 JWT 토큰의 생성과 유효성 확인 과정...