In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will share with you the relevant knowledge points about how to deploy java open source block chain jdchain. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look.
Preface
Jdchain is JD.com 's open source blockchain platform. The goal is to implement a general blockchain framework system for enterprise application scenarios, which can be used as an enterprise-level infrastructure to provide efficient, flexible and secure solutions for business innovation.
The reason for choosing jdchain research is that jdchain is one of the few low-level blockchain platforms implemented by java.
Deploy components
Peer: master node of block chain, participating in consensus, account book operation, etc.
Gateway: communicate with Peer node, responsible for block chain browser and message passing
Client: using SDK and gateway links to initiate transactions through the gateway
Foolish deployment to get deployment package
There are two ways to get the deployment package. First, download it directly from the official website. Second, pull the source code from github, and then build it yourself. The deployment package will be generated under the deployment directory. If you build the package on the Windows system, the startup script in the package will run under the linux system will have escape characters. You need to set lineEnding to unix in assembly.xml.
Effect preview
Blockchain deployment tool
Block chain browser
Problems encountered in deployment:
The official document is relatively detailed, but many details are not specified. The environment for general experience and development is relatively simple, and it is possible to deploy 4-node peer on one host. At this time, great attention should be paid to port scheduling, because jdchain's current consensus algorithm uses the open source bftsmart implementation, and consensus ports cannot be contiguous on the same host, otherwise ports will conflict. Bloggers encounter this problem. The following is a detailed troubleshooting process: when creating a user using SDK, the following exception is thrown. The gateway can connect normally, and there is no problem with secret key authentication:
Caused by: java.lang.IndexOutOfBoundsException: The accessing index is out of BytesSlice's bounds! At com.jd.blockchain.utils.io.BytesSlice.checkBoundary (BytesSlice.java:174) at com.jd.blockchain.utils.io.BytesSlice.getInt (BytesSlice.java:97) at com.jd.blockchain.utils.io.BytesSlice.getInt (BytesSlice.java:86) at com.jd.blockchain.binaryproto.impl.HeaderEncoder.resolveCode (HeaderEncoder.java:71) at com.jd.blockchain.binaryproto.BinaryProtocol.decode (BinaryProtocol.java:41) Exception in at com.jd.blockchain.sdk.converters.BinarySerializeResponseConverter.getResponse (BinarySerializeResponseConverter.java:33) at com.jd.blockchain.utils.http.agent.HttpServiceAgent.invoke (HttpServiceAgent.java:587)... 7 more Gateway 1115 57 http://192.168.1.190:8081/rpc/tx][class 05.537 ERROR com.jd.blockchain.gateway.web.GatewayGlobalExceptionHandler 34 json-Unexpected exception occurred!-- [RequestURL= [post] http://192.168.1.190:8081/rpc/tx][class Java.lang.IllegalStateException] Returned object not currently part of this pool java.lang.IllegalStateException: Returned object not currently part of this pool at org.apache.commons.pool2.impl.GenericObjectPool.returnObject (GenericObjectPool.java:530) ~ [commons-pool2-2.5.0.jarthorpe Groupe 2.5.0] at com.jd.blockchain.consensus.bftsmart.client.BftsmartMessageService.sendOrderedMessage (BftsmartMessageService.java:46) ~ [consensusMurbftsmartmuri 1.1.RELEASE.jarlugo Grande 1 1.1.1.RELEASE] at com.jd.blockchain.consensus.bftsmart.client.BftsmartMessageService.sendOrdered (BftsmartMessageService.java:22) ~ [consensusFFT smarthorse 1.1.1.RELEASE.jarring] at com.jd.blockchain.sdk.service.NodeSigningAppender.process (NodeSigningAppender.java:84) ~ [SDKMAE BaseLay 1.1.1.RELEASE.jaringe] at com.jd. Blockchain.sdk.service.PeerServiceProxy.process (PeerServiceProxy.java:89) ~ [SDK Mustang Basetron 1.1.1.RELEASE.jarhammer] TxProcessingController.java:70] at com.jd.blockchain.gateway.web.TxProcessingController.process (RELEASE) ~ [Gatewayly1.1.RELEASE.jarlur] 1.1.1.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethod) ~ [?: 1.8.0RELEAS231] At sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) ~ [?: 1.8.0 / 231] at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) ~ [?: 1.8.0 / 231] at java.lang.reflect.Method.invoke (Method.java:498) ~ [?: 1.8.0 / 231]
The implementation is as follows:
Public class BftsmartPeerProxyFactory extends BasePooledObjectFactory {private BftsmartClientSettings bftsmartClientSettings; private int gatewayId; private AtomicInteger index = new AtomicInteger (1); public BftsmartPeerProxyFactory (BftsmartClientSettings bftsmartClientSettings, int gatewayId) {this.bftsmartClientSettings = bftsmartClientSettings; this.gatewayId = gatewayId;} @ Override public AsynchServiceProxy create () throws Exception {BftsmartTopology topology = BinarySerializeUtils.deserialize (bftsmartClientSettings.getTopology ()); MemoryBasedViewStorage viewStorage = new MemoryBasedViewStorage (topology.getView ()); TOMConfiguration tomConfiguration = BinarySerializeUtils.deserialize (bftsmartClientSettings.getTomConfig ()) / / every proxy client has unique id; tomConfiguration.setProcessId (gatewayId + index.getAndIncrement ()); AsynchServiceProxy peerProxy = new AsynchServiceProxy (tomConfiguration, viewStorage); return peerProxy;} @ Override public PooledObjectwrap (AsynchServiceProxy asynchServiceProxy) {return new DefaultPooledObject (asynchServiceProxy);}}
The code BinarySerializeUtils.deserialize (bftsmartClientSettings.getTopology ()) returns null and does not get the network topology of Bftsmart correctly. Then check the peer node and find that only node 0 succeeds, and the others throw the following exception. It is preliminarily determined that the copy service of bftsmart failed to start due to port occupation:
At sun.nio.ch.Net.bind0 (Native Method) ~ [1.8.0 ERROR bftsmart.tom.ServiceReplica 231] at sun.nio.ch.Net.bind (Net.java:433) ~ [?: 1.8.0mm 231] at sun.nio.ch.Net.bind (Net.java:425) ~ [?: 1. 8.0U231] at sun.nio.ch.ServerSocketChannelImpl.bind (ServerSocketChannelImpl.java:223) ~ [?: 1.8.0y231] at io.netty.channel.socket.nio.NioServerSocketChannel.doBind (NioServerSocketChannel.java:130) ~ [netty-all-4.1.29.Final.jar:4.1.29.Final] at io.netty.channel.AbstractChannel$AbstractUnsafe.bind (AbstractChannel.java:558) ~ [netty-all-4.1.29 .Final.jar: 4.1.29.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.bind (DefaultChannelPipeline.java:1358) ~ [netty-all-4.1.29.Final.jar:4.1.29.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeBind (AbstractChannelHandlerContext.java:501) ~ [netty-all-4.1.29.Final.jar:4.1.29.Final] at io.netty.channel.AbstractChannelHandlerContext.bind (AbstractChannelHandlerContext. Java:486) ~ [netty-all-4.1.29.Final.jar:4.1.29.Final] at io.netty.channel.DefaultChannelPipeline.bind (DefaultChannelPipeline.java:1019) ~ [netty-all-4.1.29.Final.jar:4.1.29.Final] at io.netty.channel.AbstractChannel.bind (AbstractChannel.java:254) ~ [netty-all-4.1.29.Final.jar:4.1.29.Final] At io.netty.bootstrap.AbstractBootstrap$2.run (AbstractBootstrap.java:366) ~ [netty-all-4.1.29.Final.jar:4.1.29.Final] at io.netty.util.concurrent.AbstractEventExecutor.safeExecute (AbstractEventExecutor.java:163) ~ [netty-all-4.1.29.Final.jar:4.1.29.Final] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks (SingleThreadEventExecutor.java:404) ~ [netty-all-4 .1.29.Final.jar: 4.1.29.Final] at io.netty.channel.nio.NioEventLoop.run (NioEventLoop.java:446) ~ [netty-all-4.1.29.Final.jar:4.1.29.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$5.run (SingleThreadEventExecutor.java:884) ~ [netty-all-4.1.29.Final.jar:4.1.29.Final] at io.netty. Util.concurrent.FastThreadLocalRunnable.run (FastThreadLocalRunnable.java:30) ~ [netty-all-4.1.29.Final.jar:4.1.29.Final] at java.lang.Thread.run (Thread.java:748) ~ [?: 1.8.0,231]
According to the bftsmart official documentation, if you are running on the same host, you cannot use sequential port numbers, that is, the consensus ports of peer initially orchestrated, 6000, 6001, 6002, 6003, for the following reasons: if some (or all) copies are deployed / executed on the same computer (127.0.0.1), config/hosts.config cannot have sequential port numbers (for example, 10000, 10001, 10002, 10003). This is because each copy is bound to two ports: one to receive messages from the client and the other to receive messages from other copies (selected by getting the next port number). More generally, if replica R is assigned a port number P, it will attempt to bind port P (binding to received client requests) and port P + 1 (binding to other replicas). If this guideline is not enforced, the copy may not be able to bind all the required ports.
These are all the contents of the article "how to deploy java open source block chain jdchain". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.