欢迎光临
我们一直在努力

Ubuntu下HyperLedger fabric开发环境搭建

本站教程收集整理的这篇文章主要介绍了Ubuntu下HyperLedger fabric开发环境搭建,本站教程本站觉得挺不错的,现在分享给大家,也给大家做个参考。

转自:https://www.ibm.com/developerworks/community/blogs/8d277a63-4204-4fd3-8cb8-b7cb222cd522/entry/Steps_to_setup_Blockchain_Hyperledger_Fabric_0_6_development_environment_on_Ubuntu?lang=zh

We heard about Blockchain technology and understand its value to business. Here we would want to share our learnings with you all,acquired during setTing up a single node Hyperledger blockchain dev environment during a client engagement. This entire installation & configuration takes 120-150 minutes. This blog is co-authored with@Krishna Harshaand@PriyaVasudevan.?


  • If you arenew to Blockchain,please visit -https://www.ibm.com/blockchain/what-is-blockchain.htmlandhttps://www.hyperledger.org/.
  • If you are a developer and looking for a systematicfree online self-learning course,please visit -https://developer.ibm.com/courses/all-courses/blockchain-for-developers/
  • If you want to useblockchain without installing & managing it,IBM Bluemix platform as a service (PaaS) provides convenient ways to test an IBM Blockchain network on the cloud –https://www.ibm.com/blockchain/bluemix.html.
  • IBMBluemix garages for blockchainHelp businesses accelerate the design and development of blockchain applications,For more info -https://www.ibm.com/blockchain/garage.html.

Let’s get started. As you can see from below snapshot,I am using Ubuntu 16.04.1 LTS machine with 8 core processor and 32 GB RAm. Using Putty I am accessing it as superuser.

@H_897_3@make sure network is configured properly and internet is accessible. You can check /etc/hosts and /etc/resolv.conf. Try to ping any web address to make sure everything is alright.

As a next step,you should update Runapt updateto updates the list of available packages and their versions. Upgrade the packages to make sure they are up to date usingapt-get upgrade. If required,update/etc/apt/sources.listusingvi.

Since the Hyperledger Fabric project is a ‘Go’project,you’ll need to install it first. Make sure its version is 1.6 or higher.

apt install vps云服务器 golang-go

Once Go is installed. You can create necessary local folder and clone fabric fromgerrit.hyperledger.orgusing below commands –

@H_70_15@mkdir -p /opt/gopath/src/github.com/hyperledger

cd /opt/gopath/src/github.com/hyperledger/

git clonehttp://gerrit.hyperledger.org/r/fabric

Now we need to set following environment variables in order to move forWARD. Alternatively you can write.bash_profilefile instead of setTing variables every time.

export PATH=/usr/lib/go-1.6/bin:$PATH

export GOPATH=/opt/gopath/

export GOROOT=/usr/lib/go-1.6/

export PATH=/opt/gopath/src/github.com/hyperledger/fabric/build/bin/:$PATH

you would also need couple of libraries so run below command –

apt-get install -y cpp gccgo "build-essential" libsnappy-dev zlib1g-dev libbz2-dev docker.io curl

Next we’ll install and build RocksDB 4.1 along with its dependencies as we are not using Vagrant based setup.

cd /tmp

git clonehttps://github.com/facebook/rocksdb.git

cd rocksdb

git checkout v4.1

PORTABLE=1 make shared_lib

INSTall_PATH=/usr/local make install-shared

Also build pip,behave and docker-compose using below commands.

apt install python-pip

pip install --upgrade pip

pip install behave nose docker-compose

pip install -I flask==0.10.1 python-dateutil==2.2 pytz==2014.3 pyyaml==3.10 couchdb==1.0 flask-cors==2.0.1 requests==2.4.3

With this we are ready to build the fabric (validaTing peer). This is probably most problematic step. If you missed any of the above step,it would not work. Use these commands.

cd $GOPATH/src/github.com/hyperledger/fabric

@H_70_15@make peer

At stage-1,you would see your screen like this –

At stage-2,that’s how you screen looks like –

Stage-3

And

Stage-4

Once its successful,you are ready to setup CA server. The Certificate Authority (CA) provides a number of certificate services to users of a blockchain.

@H_70_15@make membersrvc

With this installation part is done. Now lets Start node service (validaTing peer) –

peer node start

Run Certificate Authority (CA) server by starTing member services –

@H_70_15@membersrvc

Once both servers are started,You can access this blockchain setup for development or tesTing. You may need to understand which service is running on which port. Run below command to do that –

netstat -lnt

7050 – REST service listeining port

7051 – Peer service listening port

7052 – Used by CLI for callBACks

7053 – Event service on validaTing node

7054 – Certificate Authority (CA) listening port (Member services)

Once services are up and running. You can use REST API calls from any machine on network.

In the next blog,we’ll configure security,privacy and logging levels for this setup (http://ibm.biz/securebC).We’ll also see how to write,deploy,invoke and query chaincode (http://ibm.biz/chaincodE). Thanks.

References:

  1. http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/devenv/
  2. https://www.ibm.com/blockchain/what-is-blockchain.html
  3. https://www.ibm.com/blockchain/for-business.html
  4. https://github.com/hyperledger/fabric/blob/master/docs/Setup/ca-setup.md
  5. http://hyperledger-fabric.readthedocs.io/en/latest/API/CoreAPI/#rest-api
  6. http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/build/
  7. https://www.ibm.com/blockchain/garage.html
  8. https://www.ibm.com/blockchain/bluemix.html

其他Hyperledger相关资源整理:

http://8btc.com/thread-41047-1-1.html

本站总结

以上是本站教程为你收集整理的Ubuntu下HyperLedger fabric开发环境搭建全部内容,希望文章能够帮你解决Ubuntu下HyperLedger fabric开发环境搭建所遇到的程序开发问题。

如果觉得本站教程网站内容还不错,欢迎将本站教程推荐给好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。