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 > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Php how to use JSON-RPC to find the latest block hash value in Ethernet Square, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can get something.
I developed an ethernet block resource manager in PHP and successfully established JSON-RPC communication with my server Geth node. However, when I tried to find the last block, I got into trouble. I read something good in https://ethereum.gitbooks.io/frontier-guide/content/rpc.html, but I don't have any way to find out which block of the etheric place node is the last. Once I get the block hash, I can have the interface to retrieve the complete block of information, but I don't know how to find the latest block hash.
The eth_blockNumber in the API interface should return the latest block number, but how do I get the hash?
Question and answer user@Kumquat:~$ curl-X POST-- data'{"jsonrpc": "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": "0x78bfef68fccd4507f9f4804ba5c65eb2f928ea45b3383ade88aaa720f1209cba" "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "miner": "0x2a65aca4d5fc5b5c859090a6c34d164135398226", "nonce": "0xa5e8fb780cc2cd5e", "number": "0x1e655a", "parentHash": "0x8b535592eb3192017a527bbf8e3596da86b3abea51d6257898b2ced9d3a83826", "receiptRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "size": "0x20e", "stateRoot": "0xdc6ed0a382e50edfedb6bd296892690eb97eb3fc88fd55088d5ea753c48253dc", "timestamp": "0x579f4981", "totalDifficulty": "0x25cff06a0d96f4bee", "transactions": [], "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncles": []}
With latest, you can also use eth_blockNumber to get the latest blocks.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.