From e981f4d47b16d27998cd79fdd760923d23e7c7e3 Mon Sep 17 00:00:00 2001 From: mDuo13 Date: Mon, 23 Mar 2020 18:47:03 -0700 Subject: [PATCH] Update ledger method human_close_time & examples --- .../ledger-methods/ledger.md | 131 +++++++++++------- 1 file changed, 83 insertions(+), 48 deletions(-) diff --git a/content/references/rippled-api/public-rippled-methods/ledger-methods/ledger.md b/content/references/rippled-api/public-rippled-methods/ledger-methods/ledger.md index 0918504241..1bdf05da6d 100644 --- a/content/references/rippled-api/public-rippled-methods/ledger-methods/ledger.md +++ b/content/references/rippled-api/public-rippled-methods/ledger-methods/ledger.md @@ -10,7 +10,7 @@ An example of the request format: *WebSocket* -``` +```json { "id": 14, "command": "ledger", @@ -25,7 +25,7 @@ An example of the request format: *JSON-RPC* -``` +```json { "method": "ledger", "params": [ @@ -47,7 +47,7 @@ An example of the request format: #Syntax: ledger ledger_index|ledger_hash [full|tx] # "full" is equivalent to "full": true # "tx" is equivalent to "transactions": true -rippled ledger current +rippled ledger validated ``` @@ -78,66 +78,101 @@ An example of a successful response: *WebSocket* -``` +```json { - "id": 4, - "status": "success", - "type": "response", + "id": 14, "result": { "ledger": { "accepted": true, - "account_hash": "FD2709F6C07284C3EE85EDE32AC452D9013A89D9B9E781D67D9784457E86A9BB", + "account_hash": "53BD4650A024E27DEB52DBB6A52EDB26528B987EC61C895C48D1EB44CEDD9AD3", "close_flags": 0, - "close_time": 508541181, - "close_time_human": "2016-Feb-11 21:26:21", + "close_time": 638329241, + "close_time_human": "2020-Mar-24 01:40:41.000000000 UTC", "close_time_resolution": 10, "closed": true, - "hash": "F1433E9D15F33E746B8820DEEE4879F48181704364E459332561DF8E52E4EB7E", - "ledger_hash": "F1433E9D15F33E746B8820DEEE4879F48181704364E459332561DF8E52E4EB7E", - "ledger_index": "18851530", - "parent_close_time": 508541180, - "parent_hash": "8300B70AA5A865961DED7DAC5B88047028762D5946ECA887D09D32DE442E2305", - "seqNum": "18851530", - "totalCoins": "99998102799411646", - "total_coins": "99998102799411646", - "transaction_hash": "E0DB0471A1D198611E1C050ADA4AE74EEB38CEC26E0550663E0FCB1364212A3B" + "hash": "1723099E269C77C4BDE86C83FA6415D71CF20AA5CB4A94E5C388ED97123FB55B", + "ledger_hash": "1723099E269C77C4BDE86C83FA6415D71CF20AA5CB4A94E5C388ED97123FB55B", + "ledger_index": "54300932", + "parent_close_time": 638329240, + "parent_hash": "DF68B3BCABD31097634BABF0BDC87932D43D26E458BFEEFD36ADF2B3D94998C0", + "seqNum": "54300932", + "totalCoins": "99991024049648900", + "total_coins": "99991024049648900", + "transaction_hash": "50B3A8FE2C5620E43AA57564209AEDFEA3E868CFA2F6E4AB4B9E55A7A62AAF7B" }, - "ledger_hash": "F1433E9D15F33E746B8820DEEE4879F48181704364E459332561DF8E52E4EB7E", - "ledger_index": 18851530, + "ledger_hash": "1723099E269C77C4BDE86C83FA6415D71CF20AA5CB4A94E5C388ED97123FB55B", + "ledger_index": 54300932, "validated": true - } + }, + "status": "success", + "type": "response" } ``` *JSON-RPC* -``` +```json 200 OK + { - "result": { - "ledger": { - "accepted": true, - "account_hash": "B089E7CD4F5167249951611AAEC863D4BF84FF098500E9CB50561F1A89EED825", - "close_flags": 0, - "close_time": 508541222, - "close_time_human": "2016-Feb-11 21:27:02", - "close_time_resolution": 10, - "closed": true, - "hash": "85E6D422F1A3AE0BEA315C4F09CD0B45022312A4BBF0D308246E901536B61157", - "ledger_hash": "85E6D422F1A3AE0BEA315C4F09CD0B45022312A4BBF0D308246E901536B61157", - "ledger_index": "18851543", - "parent_close_time": 508541221, - "parent_hash": "C382DB117F2D5AAECFBFB43EA509F8E56D6E1D1297CE00C0D02A3EE695ABB78F", - "seqNum": "18851543", - "totalCoins": "99998102795090646", - "total_coins": "99998102795090646", - "transaction_hash": "BEC71A3CAD11BFC4E4013CD109F220E0850E9A3808B15FAA6DAE4D898970EFAF" - }, - "ledger_hash": "85E6D422F1A3AE0BEA315C4F09CD0B45022312A4BBF0D308246E901536B61157", - "ledger_index": 18851543, - "status": "success", - "validated": true - } + "result": { + "ledger": { + "accepted": true, + "account_hash": "B258A8BB4743FB74CBBD6E9F67E4A56C4432EA09E5805E4CC2DA26F2DBE8F3D1", + "close_flags": 0, + "close_time": 638329271, + "close_time_human": "2020-Mar-24 01:41:11.000000000 UTC", + "close_time_resolution": 10, + "closed": true, + "hash": "3652D7FD0576BC452C0D2E9B747BDD733075971D1A9A1D98125055DEF428721A", + "ledger_hash": "3652D7FD0576BC452C0D2E9B747BDD733075971D1A9A1D98125055DEF428721A", + "ledger_index": "54300940", + "parent_close_time": 638329270, + "parent_hash": "AE996778246BC81F85D5AF051241DAA577C23BCA04C034A7074F93700194520D", + "seqNum": "54300940", + "totalCoins": "99991024049618156", + "total_coins": "99991024049618156", + "transaction_hash": "FC6FFCB71B2527DDD630EE5409D38913B4D4C026AA6C3B14A3E9D4ED45CFE30D" + }, + "ledger_hash": "3652D7FD0576BC452C0D2E9B747BDD733075971D1A9A1D98125055DEF428721A", + "ledger_index": 54300940, + "status": "success", + "validated": true + } +} +``` + +*Commandline* + +```json +Loading: "/etc/opt/ripple/rippled.cfg" +2020-Mar-24 01:42:42.622264591 UTC HTTPClient:NFO Connecting to 127.0.0.1:5005 + +{ + "result" : { + "ledger" : { + "accepted" : true, + "account_hash" : "6B3101BE8F1431C5AC5B43D9731F1F3A747D24B3BEF89B687F0F3039E10EB65A", + "close_flags" : 0, + "close_time" : 638329360, + "close_time_human" : "2020-Mar-24 01:42:40.000000000 UTC", + "close_time_resolution" : 10, + "closed" : true, + "hash" : "C88A0EEC0E785A4C3E99F2A8B8EE0D7BDF3DE6C786C39B1B01547F6DAE5A4B7F", + "ledger_hash" : "C88A0EEC0E785A4C3E99F2A8B8EE0D7BDF3DE6C786C39B1B01547F6DAE5A4B7F", + "ledger_index" : "54300962", + "parent_close_time" : 638329352, + "parent_hash" : "96D2D70DC540BA4614A00C77FCFDED20E7D58AF3238E36655C38C407A56982A3", + "seqNum" : "54300962", + "totalCoins" : "99991024049218063", + "total_coins" : "99991024049218063", + "transaction_hash" : "47AC79011652D2A56AE04D3DD618C60A6669E3F94308C803554E890D2BD94481" + }, + "ledger_hash" : "C88A0EEC0E785A4C3E99F2A8B8EE0D7BDF3DE6C786C39B1B01547F6DAE5A4B7F", + "ledger_index" : 54300962, + "status" : "success", + "validated" : true + } } ``` @@ -152,7 +187,7 @@ The response follows the [standard format][], with a successful result containin | `ledger.accountState` | Array | (Omitted unless requested) All the [account-state information](ledger-data-formats.html) in this ledger. | | `ledger.close_flags` | Integer | A bit-map of flags relating to the closing of this ledger. Currently, the ledger has only one flag defined for `close_flags`: **sLCF_NoConsensusTime** (value 1). If this flag is enabled, it means that validators were in conflict regarding the correct close time for the ledger, but build otherwise the same ledger, so they declared consensus while "agreeing to disagree" on the close time. In this case, the consensus ledger contains a `close_time` that is 1 second after that of the previous ledger. (In this case, there is no official close time, but the actual real-world close time is probably 3-6 seconds later than the specified `close_time`.) | | `ledger.close_time` | Integer | The time this ledger was closed, in [seconds since the Ripple Epoch][] | -| `ledger.close_time_human` | String | The time this ledger was closed, in human-readable format | +| `ledger.close_time_human` | String | The time this ledger was closed, in human-readable format. Always uses the UTC time zone. [Updated in: rippled 1.5.0][] | | `ledger.close_time_resolution` | Integer | Ledger close times are rounded to within this many seconds. | | `ledger.closed` | Boolean | Whether or not this ledger has been closed | | `ledger.ledger_hash` | String | Unique identifying hash of the entire ledger. |