Nonce of Ethereum RPC interface call
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
RPC generally refers to calling remote code like calling local code, which is usually done by setting up a local agent
关于RPC 路由器的实现主要分布在smd_rpcrouter.c、smd_rpcrouter_device.c、smd_rpcrouter_servers.c、smd_rpcrouter_clients.c等文件中RPC路由器起着RPC服务器查询、RPC服务器和RPC客户端的注册和销毁,以及底层通信的封装功能,类似于TCP协议
在实际的实现中,RPC路由器和RPC服务器均是作为一个虚拟的字符型设备来存在的
下面是RPC路由器的创建过程:
代码3-11 RPC 路由器的创建过程
int msm_rpcrouter_init_devices(void)
{
int rc;
int major;
msm_rpcrouter_class=class_create(THIS_MODULE,
"oncrpc"); //创建设备节点
if (IS_ERR(msm_rpcrouter_class)) {
rc=-ENOMEM;
printk(KERN_ERR
"rpcrouter: failed to create oncrpc class ");
goto fail;
}
rc=alloc_chrdev_region(&msm_rpcrouter_devno,
0, //作为字符型设备分配资源
RPCROUTER_MAX_REMOTE_SERVERS + 1, "oncrpc");
if (rc<0) {
printk(KERN_ERR
"rpcrouter: Failed to alloc chardev region (%d) ", rc);
goto fail_destroy_class;
}
major=MAJOR(msm_rpcrouter_devno);
rpcrouter_device=device_create(msm_
rpcrouter_class, NULL, //创建设备
msm_rpcrouter_devno, NULL, "%.8x:%d",
0, 0);
if (IS_ERR(rpcrouter_device)) {
rc=-ENOMEM;
goto fail_unregister_cdev_region;
}
cdev_init(&rpcrouter_cdev, &rpcrouter_
router_fops); //字符型设备初始化
rpcrouter_cdev.owner=THIS_MODULE;
rc=cdev_add(&rpcrouter_cdev, msm_rpcrouter_devno, 1);
if (rc<0)
goto fail_destroy_device;
return 0;
fail_destroy_device:
device_destroy(msm_rpcrouter_class,
msm_rpcrouter_devno);//销毁设备
fail_unregister_cdev_region:
unregister_chrdev_region(msm_rpcrouter_devno, //去注册
RPCROUTER_MAX_REMOTE_SERVERS + 1);
fail_destroy_class:
class_destroy(msm_rpcrouter_class);
fail:
return rc;
}
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.
DWR is used for Ajax server and client data transfer, its role is to make the client can easily call the server-side function directly
GWT is a complete set of Ajax framework, which not only has data transfer interface (RPC), but also has the generation and configuration of foreground pages
in short, if you want to use DWR, you need another library (such as ext) to generate foreground pages< br />