JSON-RPC

java 以太坊开发利器web3j

▼魔方 西西 提交于 2019-12-02 04:53:37
为了给希望使用web3j的开发人员提供更大的灵活性,项目由多个模块组成。 根据依赖顺序,列一下: org.web3j.utils :最小实用模块。 org.web3j.rlp :递归长度前缀(RLP)编码器。 org.web3j.abi :应用的二进制接口(ABI)编码器。 org.web3j.crypto :用于以太坊交易签名和密钥/钱包管理密码所需的加密库。 org.web3j.tuples :简单元组模块。 org.web3j.core :Web3j除了代码生成器外的核心模块。 org.web3j.codegen: 代码生成器。 org.web3j.console : 命令行工具。 下面的模块只依赖于核心模块: org.web3j.geth :geth专用JSON-RPC模块。 org.web3j.parity :Parity专用JSON-RPC模块。 org.web3j.infura :Infura特定HTTP头支持。 对于大多数用例来说通过web3j来与网络和智能合约交互,核心模块就可以满足你的大部分需要。核心模块的依赖性非常颗粒状,如果你的项目主要集中在与以太坊网络的特定交互上(如ABI/RLP编码、交易签名、而不是提交等),则这些模块很可能需要被使用。 所有模块都发布到Maven Central和Bintray,使用上面列出的名称发布的模块名,即: 对于Java:

java开源库web3j的以太坊过滤器(filter)和智能合约事件(event)教程

▼魔方 西西 提交于 2019-12-02 04:21:59
web3j过滤器提供以太坊网络发生的某些事件的通知,对java和安卓程序员来说很有用。在Ethereum以太坊中支持三类过滤器: 块滤波器(Block filters) 未决交易过滤器(Pending transaction filters) 主题过滤器(Topic filters) 块过滤器和未决交易过滤器提供了在网络上创建新交易或块的通知。 主题过滤器更灵活。允许根据提供的特定标准创建过滤器。 不幸的是,除非你使用 WebSocket 连接到Geth,否则通过JSON-RPC API来处理过滤器是一个繁琐的过程,这里需要轮询以太坊客户端,以便了解HTTP和IPC所请求的实时同步特征,是否有任何新的更新到你的过滤器。此外,块和交易过滤器只提供交易或区块链hash值,因此需要进一步的请求来获得hash对应的实际交易或块。 web3j的 过滤器 解决了这些问题,因此你有一个完全异步的基于事件的API来处理过滤器。它使用 RXJava 的可观测性 Observables ,它提供了与事件协同工作的一致API,这有助于通过功能组合将JSON-RPC调用链接在一起。 注: Infura 不支持过滤器。 块和交易过滤器 接收所有新块把它们添加到区块链(false参数指定我们只需要块就ok,而不需要嵌入交易): Subscription subscription = web3j

JSON-RPC Swagger combination

亡梦爱人 提交于 2019-12-01 18:12:35
I am considering to implement JSON-RPC for my web service with this library . I would also like to implement Swagger for my service. However, I am not sure, if these two are a good combination together. In JSON-RPC all methods are behind the same resource, while that does not make any sense in Swagger. I am wondering the following: Is it possible to combine these technologies in full strength? Is JSON-RPC still a good technology to use? Or is it better to implement it manually? Your thoughts are appreciated. Related, unaswered question: Swagger and json-rpc Coming from the Swagger team, and

Implement JSON-RPC in WCF

一曲冷凌霜 提交于 2019-12-01 13:36:35
I've been looking all around without finding a solution to this. I would like to implement a JSON-RPC server with WCF. I've found this http://jsonrpc2.codeplex.com/ but it does not use WCF and I have idea how to integrate it. Can someone gives me an hint on how to put everything together? Thanks EDIT: I've posted my source code here A very basic implementation of the server side is now working, at least with a HTTP GET request. I'm trying to implement now a WCF Client for it but again I'm stuck :( I'll post a separate question on it. I've written some blogs which show exactly how to do that -

Go - JSON-RPC - “too many colons”

百般思念 提交于 2019-12-01 12:41:47
I'm trying to call a HTTP JSON-RPC server for Bitcoin using Go (not on GAE), but I get error of dial tcp http://user:pass@127.0.0.1:8332: too many colons in address or dial ip http://user:pass@127.0.0.1:8332: lookup http://user:pass@127.0.0.1:8332: no such host I tried various network configurations , but couldn't get anything going. When I just typed the address into the browser, I got a response from the server: {"result":null,"error":{"code":-32700,"message":"Parse error"},"id":null} Which looks like a proper response for an empty call. How do I correctly call that HTTP JSON-RPC server in

Data validation in AVRO

僤鯓⒐⒋嵵緔 提交于 2019-12-01 07:33:56
I am new to AVRO and please excuse me if it is a simple question. I have a use case where I am using AVRO schema for record calls. Let's say I have avro schema { "name": "abc", "namepsace": "xyz", "type": "record", "fields": [ {"name": "CustId", "type":"string"}, {"name": "SessionId", "type":"string"}, ] } Now if the input is like { "CustId" : "abc1234" "sessionID" : "000-0000-00000" } I want to use some regex validations for these fields and I want take this input only if it comes in particular format shown as above. Is there any way to specify in avro schema to include regex expression? Any

Events not reaching kurento java server

吃可爱长大的小学妹 提交于 2019-12-01 05:29:40
问题 I'm new to Kurento media server, I am trying to send an event from kurento media server to the java application which I have. I have created an event using the following steps: edited the interface json file: "events": [{ "properties": [{ "name": "Total", "doc": "Total", "type": "float" }], "extends": "Media", "name": "TotalDetected", "doc": "Total Detected." }] then in my .hpp file: sigc::signal<void, TotalDetected> signalTotalDetected; and in my .cpp file: try { GST_WARNING ("Sending Event:

Add Path to Erlang Search Path?

一世执手 提交于 2019-12-01 03:21:56
I recently installed Erlang RFC4627 (JSON-RPC) with the debian package. I ran the test server using: sudo erl -pa ebin and then at the prompt: test_jsonrpc:start_httpd(). returned ok I tested with http://:5671/ and got the success messages. When I try to run rabbitmq-http2 however, I get the errors that the readme says are caused by rfc4627's code not being on the erlang search path. How do I put it on the path. I saw something on Dave Thomas's blog which suggested putting the path in the file: ~/.erlang This didn't seem to work for me (maybe I did it wrong?). The code module is how you

web3j教程:android和java程序员如何使用web3j开发区块链以太坊

眉间皱痕 提交于 2019-12-01 00:20:41
如何使用web3j为Java应用或Android App增加以太坊区块链支持,本教程内容即涉及以太坊中的核心概念,例如账户管理包括账户的创建、钱包创建、交易转账,交易与状态、智能合约开发与交互、过滤器和事件等,同时也详细说明如何使用web3j提供的API开发接口与以太坊进行交互,是java和android(安卓)工程师学习以太坊应用开发(DApp)的不二选择。 以太坊概述 以太坊是备受关注的区块链,它基于密码学技术和P2P通信技术 构建了一个去中心化的平台,所有的交易同步保存在每个节点中, 通过将区块单向级联成链,以太坊有效的保证了交易的不可篡改: 智能合约平台 以太坊是第一个实现了虚拟机的区块链,因此为智能合约 - Smart Contract - 的运行提供了良好的支持环境。也正因为这个原因,以太坊被称为区块链 2.0,以区别于比特币代表的以数字加密货币为核心特征的区块链1.0。 可以将智能合约理解为机器之间的合同约定,在满足一定条件时自动 执行约定好的逻辑,例如在保险理赔流程中,如果理赔条件满足就自动 将赔偿金释放给出险人,这个流程就可以使用智能合约来实现。 有多种语言可以开发以太坊智能合约,但目前最常用的是类似于JavaScript的 Solidity语言。本课程中将采用Solidity讲解智能合约的开发。 JSON RPC与web3j 如果我们希望构造一个去中心化应用

php如何使用JSON-RPC查找以太坊中的最新块哈希hash值?

六月ゝ 毕业季﹏ 提交于 2019-11-30 23:50:32
我用PHP中开发了一个以太坊块资源管理器,并成功地与我的服务器Geth节点建立了JSON-RPC通信。然而,当我试图找出最后一个区块时,我陷入了困境。我在 https://ethereum.gitbooks.io/frontier-guide/content/rpc.html 中读到了很不错的内容,但是我没有任何方法去查询到以太坊节点的哪一个是最后一个块。一旦我得到了块哈希,我就可以有接口检索完整的信息块,但我不知道如何找到最新的块哈希。 API接口中 eth_blockNumber 应该返回最新的块号,但是如何得到哈希? 问题解答 user@Kumquat:~$ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest", false],"id":1}' localhost:8545 {"jsonrpc":"2.0","id":1,"result":{"difficulty":"0x31962a3fc82b", "extraData":"0x4477617266506f6f6c", "gasLimit":"0x47c3d8", "gasUsed":"0x0", "hash":