Ethereum rpcapi
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
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 />}); Pre >
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
Ethereum specifies the JSON RPC API application development interface that each node needs to implement. This interface is transport independent. Applications can use this interface protocol to operate Ethereum nodes through HTTP, websocket or IPC and other communication mechanisms:

我们 ThoughtWorks 的几个小伙伴最近开源的 ThoughtWorksInc/microbuilder ,让你直接写 RPC 接口,然后自动转换成 RESTful 调用
这有一个例子,摘自 Microbuilder的文档,类似这样定义:
@:structuralFailure(userSdk.model.Models.Failure)
interface IUserProfileService {
@:route("GET", "users/{userId}")
@:responseContentType("text/json")
function getProfile(userId:String):Future<Profile>;
@:requestHeader("Your-Custom-Header", "custom-header-value")
@:route("PUT", "users/{userId}")
@:requestContentType("text/json")
function setProfile(userId:String, profile:Profile):Future<Void>;
}
然后 Microbuilder 会自动生成接口实现,你就可以直接调用 RPC 了
Web service belongs to web service in architecture, and RPC is a way of using web service
Web Service:
in terms of usage, it can be divided into RPC, soap and rest
in terms of data format, it is divided into XML and JSON
among them, the use of RPC and soap is decreasing, and restful architecture is dominant; The use of XML format is decreasing, and the use of lightweight formats such as JSON is increasing
RPC is a remote procere call, which calls the server's service (method) just like calling the local service (method). There are XML-RPC and json-rpc in implementation, but the transmission data format is different, and the usage is similar.
SOA: the so-called service-oriented architecture (message oriented)
rest: the so-called representational state transfer (resource oriented)
RPC is the remote procere call, a very simple concept, which calls the server's service (method) just like calling the local service (method)
the common implementations are XML-RPC and json-rpc. The communication mode is basically the same, but the only difference is the format of data transmission
the three elements of rest are unique resource identification, simple method (the method here is an abstract concept) and certain expression
important feature: stateless.
