Position: Home page » Ethereum » Ethereum javarpc call

Ethereum javarpc call

Publish: 2021-05-07 00:15:02
1. How to run Ethereum source code go Ethereum
install MIPS based Linux header file
$CD $prjroot / kernel
$tar - xjvf linux-2.6.38. Tar. Bz2
$CD linux-2.6.38

create an include folder under the specified path to store related header files< br />$ mkdir -p $TARGET_ Prefix / include

ensures that the Linux source code is clean
$make mrproper

generates the required header file< br />$ make ARCH=mips headers_ check
$ make ARCH=mips INSTALL_ HDR_ PATH=dest headers_ Install

all the files in dest folder to the specified include folder< br />$ cp -rv dest/include/* $TARGET_ Prefix / include

delete dest folder at last
$RM - RF dest
$LS - L $target_ PREFIX/include
2.

If you want to query the transaction records on the main network, you can use Etherscan. However, if you build your own private chain, how should you query the transaction records

the answer is that you need to listen to the logs on the chain, save them in the database, and then query them in the database. For example:

< pre t = "code" L = "Java" > varaddr = & quot& quot;< br />varfilter=web3.eth.filter({fromB lock:0 ,toBlock:' latest', address:addr });< br />filter.get(function(err,transactions){
transactions.forEach(function(tx){
vartxInfo=web3.eth.getTransaction(tx.transactionHash);
/ / at this time, the transaction information txinfo can be stored in the database
})< br />});

Web3. Eth. Filter() is used to monitor the log on the chain, and Web3. Eth. Gettransaction() is used to extract the information of the specified transaction. Once the transaction information is obtained, it can be stored in the database for query

recommend a practical introction, you can see: Ethereum tutorial

3. There is no inevitable relationship between whether the virtual currency will disappear or not and whether it can not be used on the third-party platform. Online third-party trading platform can only say that this kind of currency has another platform for trading, which shows that this kind of currency is more reliable
Ruitai coin has not been launched on the third-party platform, but it is rumored that it will also be launched on the third-party platform.
4. You can use the HTTP client protocol to include a set of JSON parameters and post them to the RPC server
after receiving the processing, the server will return a string, which should also be a set of JSON. If you parse it out, it will be the execution result
5. It's RPC.
RPC generally refers to calling remote code like calling local code, which is usually done by setting up a local agent
6. JSONObject jsonObject = new JSONObject();
Map map = request.getParameterMap();
Iterator<?> it = map.keySet().iterator();
while(it.hasNext()){
String key = (String)it.next();
String[] values = (String[])map.get(key);
jsonObject.accumulate(key, values[0]);
}

String name = jsonObject.getString("userName"); //返回从前台接受的用户名
System.out.println(name); //输出用户名

jsonObject.clear(); // 清空jsonObjec中的数据
jsonObject.put("love" , "足球"); //将足球赋给love这个变量名
out.print(jsonObject); //返回json格式的数据
7. 1. Select the win version to download, I choose the proto-2.4.1-win32. Zip
2. Download a protobuf-java-2.4.1.jar file (note that it should be the same as the proto.exe version you just downloaded)
and then start the development
steps:
1. Write a. Proto file with Notepad:
} for example: write test. Proto

package protobuf< br />option java_ package = " com.sq.protobuf"; < br />option java_ outer_ classname = " FirstProtobuf"; < br />message testBuf {
required int32 ID = 1; < br /> required string Url = 2;
}
put it in the same level directory as the newly decompressed protocol.exe
2. In CMD, go to the folder of protocol-2.4.1-win32,
execute
e: & # 92; protoc-2.4.1-win32> protoc.exe --java_ Out =. / test. Proto

you can find a generated firstprotobuf. Java file

3. Create a new Java project in MyEclipse, create a package com.sq.protobuf, and then put the firstprotobuf.java file generated just now under it
an error will be reported at this time because the jar package has not been introced. In the package view, you can solve the problem by introcing protobuf-java-2.4.1.jar.
8. http://www.open-open.com/lib/view/open1341798273463.html

21548;"26694;" 26550;"19981;" 38169
9. Basic principles to realize the communication between network machines, we must first look at the basic principles of computer system network communication. At the bottom level, what network communication needs to do is to transfer the flow from one computer to another computer, based on the transmission protocol and network io. Among them, the transmission protocols are more famous, such as HTTP, TCP, UDP, etc UDP is a transport protocol based on socket concept for a certain kind of application scenario. Network IO mainly includes bio, NiO and AIO. All distributed application communication is based on this principle, just for the ease of application. Various languages usually provide some application layer protocols that are closer to the ease of application. The goal of application level protocol remote service communication is to initiate a request on one computer, and the other machine will process the request and return the result to the requester after receiving the request. There will be such request modes as oneway request, synchronous request, asynchronous request and so on, What we need to do to achieve this is to convert the request into a stream and transmit it to the far end through the transport protocol. The remote computer processes the request after receiving the stream. After processing, it converts the result into a stream and returns it to the caller through the transport protocol. The principle is like this, but for the convenience of application, the instry has launched a lot of application level protocols based on this principle, so that you do not need to directly operate such low-level things. Usually, the application level remote communication protocol will provide: 1. In order to avoid the trouble of direct flow operation, provide a more easy-to-use or language fitting standard transmission format; 2. The realization of network communication mechanism is to transform the transmission format into a stream for you, and transmit it to the remote computer through a certain transmission protocol. After receiving the stream, the remote computer converts it into a transmission format and stores it or notifies the remote computer in a certain way. So when we study the application level remote communication protocol, we can learn with these questions: 1. What is the standard format of transmission? 2. How to convert the request into a transport stream? 3. How to receive and process the stream? 4. What is the transmission protocol? However, the application level remote communication protocol will not make much improvement on the transport protocol, mainly in the aspect of stream operation, which makes the process of generating and processing streams in the application layer more suitable for the language or standard used. As for the transport protocol, it is usually optional. The well-known ones in the Java field are RMI, XML-RPC, binary RPC, soap, CORBA, JMS, Let's take a concrete look at these application level protocols for remote communication: rmirmirmi is a typical remote communication protocol customized for Java. As we all know, in singlevm, we can directly call javaobjectinstance to realize communication, so it's best to follow this way in remote communication, This remote communication mechanism is called RPC (remote protocol call), and RMI is born towards this goal. Let's look at the principle of a complete remote communication process based on RMI: 1. The client initiates a request, and the request is transferred to the stub class of RMI client; 2. The stub class serializes the requested interface, method, parameter and other information; 3. Transmit the serialized data to the server based on socket; 4. The server receives the stream and forwards it to the corresponding Skelton class; The 5.skelton class will serialize the requested information and then call the actual processing class. 6. The result will be returned to the Skelton class after processing; 7. The Skelton class serializes the result and sends it to the stub of the client through socket; 8. After receiving the stream, stub deserializes and returns the deserialized Java object to the caller. According to the principle to answer the following questions: 1. What is the standard format of transmission? It's javaobjectstream. 2. How to convert the request into a transport stream? Based on Java serialization mechanism, the requested Java object information is transformed into a stream. 3. How to receive and process the stream? Start the corresponding listening port according to the adopted protocol. When a stream enters, the stream is deserialized based on Java serialization mechanism, and the corresponding processing object information is obtained according to RMI protocol. After processing, the result is also returned based on Java serialization mechanism. 4. What is the transmission protocol? Socket Xml-rpcxml-rpc is also a remote calling protocol similar to RMI. The difference between xml-rpcxml-rpc and RMI is that it defines the requested information (the requested object, method, parameter, etc.) in a standard XML format. What's the advantage of xml-rpcxml-rpc? It can also be used in cross language communication. Let's look at a remote communication process of XML-RPC protocol: 1. The client initiates a request and fills in the request information according to the XML-RPC protocol; 2. After the completion of filling, the XML is transformed into a stream and transmitted through the transport protocol; 3. After receiving the stream, it is converted into XML, and the requested information is obtained and processed according to the XML-RPC protocol; 4. After processing, the result is written into XML and returned according to XML-RPC protocol. What is the standard format of transmission? XML in standard format. 2. How to convert the request into a transport stream? Turn XML into a stream. 3. How to receive and process the stream? The request stream is obtained through the listening port, converted into XML, and the request information is obtained according to the protocol, processed and written into XML. 4. What is the transmission protocol? Http Binary rpcbinary RPC is similar to XML-RPC in name. The only difference is that the standard format of transmission is changed from XML to binary. What is the standard format of transmission? Standard format binary file. 2. How to convert the request into a transport stream? Convert binary format file to stream. 3. How to receive and process the stream? The request stream is obtained through the monitored port and converted into binary file. According to the protocol, the request information is obtained and processed, and the result is written into XML and returned. 4. What is the transmission protocol? Http Soap soap, originally meant as simple object access protocol, is a lightweight communication protocol based on XML for information exchange in distributed environment. It can be considered that soap is an advanced version of XMLRPC. Both of them have the same principle, HTTP + XML. The only difference is that they define different XML specifications. Soap is also a service invocation protocol standard adopted by WebService, Therefore, I will not elaborate more here The common object request broker (CIP) architecture is a set of tools used to define & quot; Distributed object system & quot; OMG (object measurement group) is the initiator and standard maker. The purpose of CORBA is to define a set of protocols. Objects conforming to this protocol can interact with each other, no matter what language they are written in, no matter what machine and operating system they run on. In my opinion, CORBA is an architecture similar to SOA, covering optional remote communication protocols, but it can't be included in communication protocols. Here, CORBA is basically eliminated, and I don't know much about CORBA. I won't elaborate here. JMS is a means and method to realize remote communication in the Java field. The implementation of remote communication based on JMS is different from RPC. Although RPC can achieve the effect, we don't think that JMS is an RPC Protocol because it is not defined from the protocol level, but it is a remote communication protocol. There are similar things in other language systems, This kind of mechanism can be uniformly called message mechanism. Message mechanism is usually a communication mechanism recommended by high concurrency and distributed fields. The main problem here is fault tolerance (see Erlang's paper for details). Look at the process of a remote communication in JMS: 1. The client converts the request into a message conforming to the requirements of JMS; 2. Put the message into jmsqueue or topic through JMS API; 3. If it is a jmsqueue, it will be sent to the corresponding destination queue in the sending process. If it is a topic, it will be sent to the jmsqueue subscribing to the topic. 4. The processing side obtains the message by training jmsqueue in turn. After receiving the message, it parses and processes the message according to the JMS protocol. What is the standard format of transmission? Message specified by JMS. 2. How to convert the request into a transport stream? Put the parameter information into the message. 3. How to receive and process the stream? After receiving the message, it is processed. After processing, it is still put into the queue in the form of message to send or multicast. 4. What is the transmission protocol? unlimited. JMS is also one of the common methods to realize remote asynchronous call.
Hot content
Inn digger Publish: 2021-05-29 20:04:36 Views: 341
Purchase of virtual currency in trust contract dispute Publish: 2021-05-29 20:04:33 Views: 942
Blockchain trust machine Publish: 2021-05-29 20:04:26 Views: 720
Brief introduction of ant mine Publish: 2021-05-29 20:04:25 Views: 848
Will digital currency open in November Publish: 2021-05-29 19:56:16 Views: 861
Global digital currency asset exchange Publish: 2021-05-29 19:54:29 Views: 603
Mining chip machine S11 Publish: 2021-05-29 19:54:26 Views: 945
Ethereum algorithm Sha3 Publish: 2021-05-29 19:52:40 Views: 643
Talking about blockchain is not reliable Publish: 2021-05-29 19:52:26 Views: 754
Mining machine node query Publish: 2021-05-29 19:36:37 Views: 750