🏢

XRP LedgerのパブリックAPI

2023/11/24に公開

XRP Ledgerとは

XRPレジャーはBitcoinやEthereumなどと同じ分散型のパブリックブロックチェーンです。PoWやPoSとは異なる独自のコンセンサスアルゴリズムが用いられています。
EVMによるスマートコントラクトは搭載しておらず、スマートトランザクタ(プロトコルネイティブで提供されている機能)を拡張することで進化し続けています。

XRP Lederの情報はレジャーオブジェクトやレジャーエントリなどと呼ばれ、レジャー全体で一意となるキーで識別されています。

データの取得

XRP Ledgerからデータを取得する方法の最も基礎的なものとしてPublic APIが提供されています。

これはXRPLのサーバアプリケーションであるrippledから提供されているものであり、XRP Ledgerネットワークの情報を他の第三者に依存せずに取得できます。

特徴

XRPLのパブリックAPIではXRPLのデータを一意なキーで取得したり、特定のリストなどを取得できます。

XRP Ledgerサーバと直接通信を行うため信頼性が高いデータとなっています。

パブリックAPIの種類

アカウント

アカウントの基本情報やトークン情報など、アカウントに関する情報を取得するAPIです。

account_channels

アカウントが作成した、または宛先として含まれるペイメントチャネルを取得します。

リクエスト
{
  "id": 1,
  "command": "account_channels",
  "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
  "destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
  "ledger_index": "validated"
}
レスポンス
{
  "id": 1,
  "result": {
    "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
    "channels": [
      {
        "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
        "amount": "1000",
        "balance": "0",
        "channel_id": "C7F634794B79DB40E87179A9D1BF05D05797AE7E92DF8E93FD6656E8C4BE3AE7",
        "destination_account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
        "public_key": "aBR7mdD75Ycs8DRhMgQ4EMUEmBArF8SEh1hfjrT2V9DQTLNbJVqw",
        "public_key_hex": "03CFD18E689434F032A4E84C63E2A3A6472D684EAF4FD52CA67742F3E24BAE81B2",
        "settle_delay": 60
      }
    ],
    "ledger_hash": "1EDBBA3C793863366DF5B31C2174B6B5E6DF6DB89A7212B86838489148E2A581",
    "ledger_index": 71766314,
    "validated": true
  },
  "status": "success",
  "type": "response"
}

https://xrpl.org/ja/account_channels.html

account_currencies

アカウントが保有、または送信可能な通貨の一覧を取得します。

リクエスト
{
   "command": "account_currencies",
   "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
   "strict": true,
   "ledger_index": "validated"
}
レスポンス
{
   "result": {
       "ledger_index": 11775844,
       "receive_currencies": [
           "BTC",
           "CNY",
           "DYM",
           "EUR",
           "JOE",
           "MXN",
           "USD",
           "015841551A748AD2C1F76FF6ECB0CCCD00000000"
       ],
       "send_currencies": [
           "ASP",
           "BTC",
           "CHF",
           "CNY",
           "DYM",
           "EUR",
           "JOE",
           "JPY",
           "MXN",
           "USD"
       ],
       "validated": true
   },
   "status": "success",
   "type": "response"
}

https://xrpl.org/ja/account_currencies.html

account_info

アカウントの基本情報を取得します。
関連レジャーオブジェクト: AccountInfo

リクエスト
{
  "id": 2,
  "command": "account_info",
  "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
  "strict": true,
  "ledger_index": "current",
  "queue": true
}
レスポンス
{
    "id": 5,
    "status": "success",
    "type": "response",
    "result": {
        "account_data": {
            "Account": "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn",
            "Balance": "999999999960",
            "Flags": 8388608,
            "LedgerEntryType": "AccountRoot",
            "OwnerCount": 0,
            "PreviousTxnID": "4294BEBE5B569A18C0A2702387C9B1E7146DC3A5850C1E87204951C6FDAA4C42",
            "PreviousTxnLgrSeq": 3,
            "Sequence": 6,
            "index": "92FA6A9FC8EA6018D5D16532D7795C91BFB0831355BDFDA177E86C8BF997985F"
        },
        "ledger_current_index": 4,
        "queue_data": {
            "auth_change_queued": true,
            "highest_sequence": 10,
            "lowest_sequence": 6,
            "max_spend_drops_total": "500",
            "transactions": [
                {
                    "auth_change": false,
                    "fee": "100",
                    "fee_level": "2560",
                    "max_spend_drops": "100",
                    "seq": 6
                },
                ...(trimmed for length) ...
                {
                    "LastLedgerSequence": 10,
                    "auth_change": true,
                    "fee": "100",
                    "fee_level": "2560",
                    "max_spend_drops": "100",
                    "seq": 10
                }
            ],
            "txn_count": 5
        },
        "validated": false
    }
}

https://xrpl.org/ja/account_info.html

account_lines

アカウントが設定しているトラストラインの一覧を取得します。
自身が設定したトラストラインだけではなく自身に対するトラストラインも取得されます。
関連レジャーオブジェクト: RippleState

リクエスト
{
  "id": 1,
  "command": "account_lines",
  "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59"
}
レスポンス
{
    "id": 1,
    "status": "success",
    "type": "response",
    "result": {
        "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
        "lines": [
            {
                "account": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
                "balance": "0",
                "currency": "ASP",
                "limit": "0",
                "limit_peer": "10",
                "quality_in": 0,
                "quality_out": 0
            },
            {
                "account": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
                "balance": "0",
                "currency": "XAU",
                "limit": "0",
                "limit_peer": "0",
                "no_ripple": true,
                "no_ripple_peer": true,
                "quality_in": 0,
                "quality_out": 0
            },
            {
                "account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
                "balance": "3.497605752725159",
                "currency": "USD",
                "limit": "5",
                "limit_peer": "0",
                "no_ripple": true,
                "quality_in": 0,
                "quality_out": 0
            }
        ]
    }
}

https://xrpl.org/ja/account_lines.html

account_nfts

アカウントが保有しているNFTの一覧を取得します。
関連レジャーオブジェクト: NFTokenPage

リクエスト
{
  "command": "account_nfts",
  "account": "rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx",
  "ledger_index": "validated"
}
レスポンス
{
  "result": {
    "account": "rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx",
    "account_nfts": [
      {
        "Flags": 1,
        "Issuer": "rGJUF4PvVkMNxG6Bg6AKg3avhrtQyAffcm",
        "NFTokenID": "00010000A7CAD27B688D14BA1A9FA5366554D6ADCF9CE0875B974D9F00000004",
        "NFTokenTaxon": 0,
        "URI": "697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469",
        "nft_serial": 4
      },
      {
        "Flags": 1,
        "Issuer": "rGJUF4PvVkMNxG6Bg6AKg3avhrtQyAffcm",
        "NFTokenID": "00010000A7CAD27B688D14BA1A9FA5366554D6ADCF9CE087727D1EA000000005",
        "NFTokenTaxon": 0,
        "URI": "697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469",
        "nft_serial": 5
      }
    ],
    "ledger_hash": "7971093E67341E325251268A5B7CD665EF450B126F67DF8384D964DF834961E8",
    "ledger_index": 2380540,
    "validated": true
  },
  "status": "success",
  "type": "response"
}

https://xrpl.org/ja/account_nfts.html

account_objects

アカウントが保有しているオブジェクトの一覧を取得します。
関連レジャーオブジェクト: Offer,RippleState,NFTokenPageなど多数

リクエスト
{
  "id": 1,
  "command": "account_objects",
  "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
  "ledger_index": "validated",
  "type": "state",
  "limit": 10
}
レスポンス
{
    "id": 8,
    "status": "success",
    "type": "response",
    "result": {
        "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
        "account_objects": [
            {
                "Balance": {
                    "currency": "ASP",
                    "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
                    "value": "0"
                },
                "Flags": 65536,
                "HighLimit": {
                    "currency": "ASP",
                    "issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
                    "value": "0"
                },
                "HighNode": "0000000000000000",
                "LedgerEntryType": "RippleState",
                "LowLimit": {
                    "currency": "ASP",
                    "issuer": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
                    "value": "10"
                },
                "LowNode": "0000000000000000",
                "PreviousTxnID": "BF7555B0F018E3C5E2A3FF9437A1A5092F32903BE246202F988181B9CED0D862",
                "PreviousTxnLgrSeq": 1438879,
                "index": "2243B0B630EA6F7330B654EFA53E27A7609D9484E535AB11B7F946DF3D247CE9"
            },
            ...
        ],
        "ledger_hash": "053DF17D2289D1C4971C22F235BC1FCA7D4B3AE966F842E5819D0749E0B8ECD3",
        "ledger_index": 14378733,
        "limit": 10,
        "marker": "F60ADF645E78B69857D2E4AEC8B7742FEABC8431BD8611D099B428C3E816DF93,94A9F05FEF9A153229E2E997E64919FD75AAE2028C8153E8EBDB4440BD3ECBB5",
        "validated": true
    }
}

https://xrpl.org/ja/account_objects.html

account_offers

アカウントが作成しているDEXオファーの一覧を取得します。
関連レジャーオブジェクト: Offer

リクエスト
{
  "id": 2,
  "command": "account_offers",
  "account": "rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM"
}
レスポンス
{
  "id": 9,
  "status": "success",
  "type": "response",
  "result": {
    "account": "rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM",
    "ledger_current_index": 18539550,
    "offers": [
      {
        "flags": 0,
        "quality": "0.00000000574666765650638",
        "seq": 6577664,
        "taker_gets": "33687728098",
        "taker_pays": {
          "currency": "EUR",
          "issuer": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq",
          "value": "193.5921774819578"
        }
      },
      {
        "flags": 0,
        "quality": "7989247009094510e-27",
        "seq": 6572128,
        "taker_gets": "2361918758",
        "taker_pays": {
          "currency": "XAU",
          "issuer": "rrh7rf1gV2pXAoqA8oYbpHd8TKv5ZQeo67",
          "value": "0.01886995237307572"
        }
      },
      ... trimmed for length ...
    ],
    "validated": false
  }
}

https://xrpl.org/ja/account_offers.html

account_tx

アカウントが関与しているトランザクションの一覧を取得します。

リクエスト
{
  "id": 2,
  "command": "account_tx",
  "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
  "ledger_index_min": -1,
  "ledger_index_max": -1,
  "binary": false,
  "limit": 2,
  "forward": false
}
レスポンス
{
    "id": 2,
    "status": "success",
    "type": "response",
    "result": {
        "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
        "ledger_index_max": 6542489,
        "ledger_index_min": 32570,
        "limit": 2,
        "transactions": [
            {
                "meta": {
                    "AffectedNodes": [
                        {
                            "ModifiedNode": {
                                "FinalFields": {
                                    "Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
                                    "Balance": "9999999980",
                                    "Flags": 0,
                                    "OwnerCount": 2,
                                    "Sequence": 3
                                },
                                "LedgerEntryType": "AccountRoot",
                                "LedgerIndex": "4F83A2CF7E70F77F79A307E6A472BFC2585B806A70833CCD1C26105BAE0D6E05",
                                "PreviousFields": {
                                    "Balance": "9999999990",
                                    "OwnerCount": 1,
                                    "Sequence": 2
                                },
                                "PreviousTxnID": "389720F6FD8A144F171708F9ECB334D704CBCFEFBCDA152D931AC34FB5F9E32B",
                                "PreviousTxnLgrSeq": 95405
                            }
                        },
                        {
                            "CreatedNode": {
                                "LedgerEntryType": "RippleState",
                                "LedgerIndex": "718C6D58DD3BBAAAEBFE48B8FBE3C32C9F6F2EBC395233BA95D0057078EE07DB",
                                "NewFields": {
                                    "Balance": {
                                        "currency": "USD",
                                        "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
                                        "value": "0"
                                    },
                                    "Flags": 131072,
                                    "HighLimit": {
                                        "currency": "USD",
                                        "issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
                                        "value": "100"
                                    },
                                    "LowLimit": {
                                        "currency": "USD",
                                        "issuer": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
                                        "value": "0"
                                    }
                                }
                            }
                        },
                        ...
                    ],
                    "TransactionIndex": 0,
                    "TransactionResult": "tesSUCCESS"
                },
                "tx": {
                    "Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
                    "Fee": "10",
                    "Flags": 0,
                    "LimitAmount": {
                        "currency": "USD",
                        "issuer": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
                        "value": "100"
                    },
                    "Sequence": 2,
                    "SigningPubKey": "02BC8C02199949B15C005B997E7C8594574E9B02BA2D0628902E0532989976CF9D",
                    "TransactionType": "TrustSet",
                    "TxnSignature": "304402200EF81EC32E0DFA9BE376B20AFCA11765ED9FEA04CA8B77C7178DAA699F7F5AFF02202DA484DBD66521AC317D84F7717EC4614E2F5DB743E313E8B48440499CC0DBA4",
                    "date": 413620090,
                    "hash": "002AA492496A1543DBD3680BF8CF21B6D6A078CE4A01D2C1A4B63778033792CE",
                    "inLedger": 195480,
                    "ledger_index": 195480
                },
                "validated": true
            },
            {
                "meta": {
                    "AffectedNodes": [
                        {
                            "ModifiedNode": {
                                "FinalFields": {
                                    "Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
                                    "Balance": "9999999970",
                                    "Flags": 0,
                                    "OwnerCount": 3,
                                    "Sequence": 4
                                },
                                "LedgerEntryType": "AccountRoot",
                                "LedgerIndex": "4F83A2CF7E70F77F79A307E6A472BFC2585B806A70833CCD1C26105BAE0D6E05",
                                "PreviousFields": {
                                    "Balance": "9999999980",
                                    "OwnerCount": 2,
                                    "Sequence": 3
                                },
                                "PreviousTxnID": "002AA492496A1543DBD3680BF8CF21B6D6A078CE4A01D2C1A4B63778033792CE",
                                "PreviousTxnLgrSeq": 195480
                            }
                        },
                        {
                            "ModifiedNode": {
                                "FinalFields": {
                                    "Flags": 0,
                                    "Owner": "r3PDtZSa5LiYp1Ysn1vMuMzB59RzV3W9QH",
                                    "RootIndex": "A39F044D860C5B5846AA7E0FAAD44DC8897F0A62B2F628AA073B21B3EC146010"
                                },
                                "LedgerEntryType": "DirectoryNode",
                                "LedgerIndex": "A39F044D860C5B5846AA7E0FAAD44DC8897F0A62B2F628AA073B21B3EC146010"
                            }
                        },
                        {
                            "ModifiedNode": {
                                "LedgerEntryType": "AccountRoot",
                                "LedgerIndex": "E0D7BDE68B468FF0B8D948FD865576517DA987569833A05374ADB9A72E870A06",
                                "PreviousTxnID": "0222B59280D165D40C464EA75AAD08A4D152C46A38C0625DEECF6EE87FC5B9E1",
                                "PreviousTxnLgrSeq": 343555
                            }
                        },
                        {
                            "CreatedNode": {
                                "LedgerEntryType": "RippleState",
                                "LedgerIndex": "EA4BF03B4700123CDFFB6EB09DC1D6E28D5CEB7F680FB00FC24BC1C3BB2DB959",
                                "NewFields": {
                                    "Balance": {
                                        "currency": "USD",
                                        "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
                                        "value": "0"
                                    },
                                    "Flags": 131072,
                                    "HighLimit": {
                                        "currency": "USD",
                                        "issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
                                        "value": "100"
                                    },
                                    "LowLimit": {
                                        "currency": "USD",
                                        "issuer": "r3PDtZSa5LiYp1Ysn1vMuMzB59RzV3W9QH",
                                        "value": "0"
                                    }
                                }
                            }
                        },
                        {
                            "ModifiedNode": {
                                "FinalFields": {
                                    "ExchangeRate": "4E11C37937E08000",
                                    "Flags": 0,
                                    "RootIndex": "F60ADF645E78B69857D2E4AEC8B7742FEABC8431BD8611D099B428C3E816DF93",
                                    "TakerGetsCurrency": "0000000000000000000000000000000000000000",
                                    "TakerGetsIssuer": "0000000000000000000000000000000000000000",
                                    "TakerPaysCurrency": "0000000000000000000000004254430000000000",
                                    "TakerPaysIssuer": "5E7B112523F68D2F5E879DB4EAC51C6698A69304"
                                },
                                "LedgerEntryType": "DirectoryNode",
                                "LedgerIndex": "F60ADF645E78B69857D2E4AEC8B7742FEABC8431BD8611D099B428C3E816DF93"
                            }
                        }
                    ],
                    "TransactionIndex": 0,
                    "TransactionResult": "tesSUCCESS"
                },
                "tx": {
                    "Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
                    "Fee": "10",
                    "Flags": 0,
                    "LimitAmount": {
                        "currency": "USD",
                        "issuer": "r3PDtZSa5LiYp1Ysn1vMuMzB59RzV3W9QH",
                        "value": "100"
                    },
                    "Sequence": 3,
                    "SigningPubKey": "02BC8C02199949B15C005B997E7C8594574E9B02BA2D0628902E0532989976CF9D",
                    "TransactionType": "TrustSet",
                    "TxnSignature": "3044022058A89552068D1A274EE72BA71363E33E54E6608BC28A84DEC6EE530FC2B5C979022029F4D1EA1237A1F717C5F5EC526E6CFB6DF54C30BADD25EDDE7D2FDBC8F17E34",
                    "date": 416347560,
                    "hash": "53354D84BAE8FDFC3F4DA879D984D24B929E7FEB9100D2AD9EFCD2E126BCCDC8",
                    "inLedger": 343570,
                    "ledger_index": 343570
                },
                "validated": true
            }
        ],
        "validated": true
    }
}

https://xrpl.org/ja/account_tx.html

gateway_balances

アカウントが発行しているトークンの残高一覧を取得します。
関連レジャーオブジェクト: RippleState

リクエスト
{
    "id": "example_gateway_balances_1",
    "command": "gateway_balances",
    "account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
    "strict": true,
    "hotwallet": ["rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ","ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt"],
    "ledger_index": "validated"
}
レスポンス
{
  "id": 3,
  "status": "success",
  "type": "response",
  "result": {
    "account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
    "assets": {
      "r9F6wk8HkXrgYWoJ7fsv4VrUBVoqDVtzkH": [
        {
          "currency": "BTC",
          "value": "5444166510000000e-26"
        }
      ],
      "rPFLkxQk6xUGdGYEykqe7PR25Gr7mLHDc8": [
        {
          "currency": "EUR",
          "value": "4000000000000000e-27"
        }
      ],
      ...
    },
    "balances": {
      "rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ": [
        {
          "currency": "EUR",
          "value": "29826.1965999999"
        }
      ],
      "ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt": [
        {
          "currency": "USD",
          "value": "13857.70416"
        }
      ]
    },
    "ledger_hash": "61DDBF304AF6E8101576BF161D447CA8E4F0170DDFBEAFFD993DC9383D443388",
    "ledger_index": 14483195,
    "obligations": {
      "BTC": "5908.324927635318",
      "EUR": "992471.7419793958",
      "GBP": "4991.38706013193",
      "USD": "1997134.20229482"
    },
    "validated": true
  }
}

https://xrpl.org/ja/gateway_balances.html

noripple_check

アカウントの役割に応じた推奨されるDefaultRipple設定を取得します。
関連レジャーオブジェクト: AccountInfo

リクエスト
{
   "id": 0,
   "command": "noripple_check",
   "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
   "role": "gateway",
   "ledger_index": "current",
   "limit": 2,
   "transactions": true
}
レスポンス
{
 "id": 0,
 "status": "success",
 "type": "response",
 "result": {
   "ledger_current_index": 14342939,
   "problems": [
     "You should immediately set your default ripple flag",
     "You should clear the no ripple flag on your XAU line to r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
     "You should clear the no ripple flag on your USD line to rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q"
   ],
   "transactions": [
     {
       "Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
       "Fee": 10000,
       "Sequence": 1406,
       "SetFlag": 8,
       "TransactionType": "AccountSet"
     },
     {
       "Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
       "Fee": 10000,
       "Flags": 262144,
       "LimitAmount": {
         "currency": "XAU",
         "issuer": "r3vi7mWxru9rJCxETCyA1CHvzL96eZWx5z",
         "value": "0"
       },
       "Sequence": 1407,
       "TransactionType": "TrustSet"
     },
     {
       "Account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
       "Fee": 10000,
       "Flags": 262144,
       "LimitAmount": {
         "currency": "USD",
         "issuer": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
         "value": "5"
       },
       "Sequence": 1408,
       "TransactionType": "TrustSet"
     }
   ],
   "validated": false
 }
}

https://xrpl.org/ja/noripple_check.html

レジャー

現在または過去のレジャーに関する情報を取得するAPIです。

ledger

指定したレジャーのバージョン情報を取得します。

ledger_indexフィールドへの設定値で様々な種類のレジャーの情報を取得できます。

  • validated: 検証済みの最新のレジャーの情報
  • closed: 直近にクローズ(処理済かつ検証中)されたレジャーの情報
  • current: 現在オープンな(処理中の)レジャーの情報

https://xrpl.org/ja/basic-data-types.html#レジャーの指定

リクエスト
{
  "id":14,
  "command":"ledger",
  "ledger_index":"validated",
  "full": false,
  "accounts": false,
  "transactions": false,
  "expand": false,
  "owner_funds": false
}
レスポンス
{
 "id":4,
 "status":"success",
 "type":"response",
 "result":{
   "ledger":{
     "accepted": true,
     "account_hash":"FD2709F6C07284C3EE85EDE32AC452D9013A89D9B9E781D67D9784457E86A9BB",
     "close_flags":0,
     "close_time":508541181,
     "close_time_human":"2016-Feb-11 21:26:21",
     "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"
   },
   "ledger_hash":"F1433E9D15F33E746B8820DEEE4879F48181704364E459332561DF8E52E4EB7E",
   "ledger_index":18851530,
   "validated": true
 }
}

https://xrpl.org/ja/ledger.html

ledger_closed

直近にクローズされたレジャー(未検証)のバージョン情報を取得します。

リクエスト
{
  "id": 2,
  "command": "ledger_closed"
}
レスポンス
{
  "id": 1,
  "status": "success",
  "type": "response",
  "result": {
    "ledger_hash": "17ACB57A0F73B5160713E81FE72B2AC9F6064541004E272BD09F257D57C30C02",
    "ledger_index": 6643099
  }
}

https://xrpl.org/ja/ledger_closed.html

ledger_current

現在のオープンレジャー(未検証)のバージョン情報を取得します。

リクエスト
{
  "id":2,
  "command":"ledger_current"
}
レスポンス
{
 "id":2,
 "status":"success",
 "type":"response",
 "result":{
   "ledger_current_index":6643240
 }
}

https://xrpl.org/ja/ledger_current.html

ledger_data

指定したレジャーのデータを取得します。データサイズが非常に大きい(執筆時点で5GB程度)ため、パブリックサーバでの利用は推奨しません。

リクエスト
{
  "id":2,
  "ledger_hash":"842B57C1CC0613299A686D3E9F310EC0422C84D3911E5056389AA7E5808A93C8",
  "command":"ledger_data",
  "limit":5,
  "binary": true
}
レスポンス
{
   "id":2,
   "result":{
       "ledger_hash":"842B57C1CC0613299A686D3E9F310EC0422C84D3911E5056389AA7E5808A93C8",
       "ledger_index":"6885842",
       "marker":"0002A590029B53BE7857EFF9985F770EC792CE483720EB5E963C4D6A607D43DF",
       "state":[
           {
               "Account":"rKKzk9ghA2iuy3imqMXUHJqdRPMtNDGf4c",
               "Balance":"893730848",
               "Flags":0,
               "LedgerEntryType":"AccountRoot",
               "OwnerCount":0,
               "PreviousTxnID":"C204A65CF2542946289A3358C67D991B5E135FABFA89F271DBA7A150C08CA046",
               "PreviousTxnLgrSeq":6487716,
               "Sequence":1,
               "index":"00001A2969BE1FC85F1D7A55282FA2E6D95C71D2E4B9C0FDD3D9994F3C00FF8F"
           },
           {
               "Account":"rGryPmNWFognBgMtr9k4quqPbbEcCrhNmD",
               "BookDirectory":"71633D7DE1B6AEB32F87F1A73258B13FC8CC32942D53A66D4F038D7EA4C68000",
               "BookNode":"0000000000000000",
               "Flags":0,
               "LedgerEntryType":"Offer",
               "OwnerNode":"0000000000000000",
               "PreviousTxnID":"555B93628BF3EC318892BB7C7CDCB6732FF53D12B6EEC4FAF60DD1AEE1C6101F",
               "PreviousTxnLgrSeq":3504261,
               "Sequence":3,
               "TakerGets":"1000000",
               "TakerPays":{
                   "currency":"BTC",
                   "issuer":"rnuF96W4SZoCJmbHYBFoJZpR8eCaxNvekK",
                   "value":"1"
               },
               "index":"000037C6659BB98F8D09F2F4CFEB27DE8EFEAFE54DD9E1C13AECDF5794B0C0F5"
           },
           {
               "Account":"rUy8tW38MW9ma7kSjRgB2GHtTkQAFRyrN8",
               "BookDirectory":"DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4C1AA535D3D0C000",
               "BookNode":"0000000000000000",
               "Flags":131072,
               "LedgerEntryType":"Offer",
               "OwnerNode":"0000000000000000",
               "PreviousTxnID":"A160BC41A45B6BB118DF23D77E4FF23C723431B917F50DCB41319ECC2821F34C",
               "PreviousTxnLgrSeq":6764892,
               "Sequence":10,
               "TakerGets":"780000000000",
               "TakerPays":{
                   "currency":"USD",
                   "issuer":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
                   "value":"5850"
               },
               "index":"0000A8791F78CC9B39200E12A9BDAACCF40A72A512FA815525CFC9BA772990F7"
           },
           {
               "Account":"rh3C81VfNDhhWPQWCU8ZGgknvdgNUvRtM9",
               "Balance":"13000000000",
               "Flags":0,
               "LedgerEntryType":"AccountRoot",
               "OwnerCount":0,
               "PreviousTxnID":"286498B513710CFEB2D723A554C7557983D1952DF4DEE342C40DCB43067C9A21",
               "PreviousTxnLgrSeq":4092975,
               "Sequence":1,
               "index":"0000B717320558E2DE1A3B9FDB24E9A695BF05D1A44E4A4683212BB1DD0FBA23"
           },
           {
               "Balance":{
                   "currency":"BTC",
                   "issuer":"rrrrrrrrrrrrrrrrrrrrBZbvji",
                   "value":"0"
               },
               "Flags":131072,
               "HighLimit":{
                   "currency":"BTC",
                   "issuer":"rKUK9omZqVEnraCipKNFb5q4tuNTeqEDZS",
                   "value":"10"
               },
               "HighNode":"0000000000000000",
               "LedgerEntryType":"RippleState",
               "LowLimit":{
                   "currency":"BTC",
                   "issuer":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
                   "value":"0"
               },
               "LowNode":"0000000000000000",
               "PreviousTxnID":"87591A63051645F37B85D1FBA55EE69B1C96BFF16904F5C99F03FB93D42D0375",
               "PreviousTxnLgrSeq":746872,
               "index":"000103996A3BAD918657F86E12A67D693E8FC8A814DA4B958A244B5F14D93E58"
           }
       ]
   },
   "status":"success",
   "type":"response"
}

https://xrpl.org/ja/ledger_data.html

ledger_entry

一意となる情報で指定したレジャーオブジェクトの情報を取得します。
フィールドの指定方法を変えることでどんなレジャーオブジェクトも取得できます。

リクエスト
{
  "command": "ledger_entry",
  "index": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4",
  "ledger_index": "validated"
}
レスポンス
{
  "result": {
    "ledger_hash": "C273DE9DB4991058504A4C8A5B196C1EFE4BB0C26F02DD1B757C8D5FA1A644B7",
    "ledger_index": 84126799,
    "validated": true,
    "index": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4",
    "node": {
      "Amendments": [
        "42426C4D4F1009EE67080A9B7965B44656D7714D104A72F9B4369F97ABF044EE",
        "4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373",
        "6781F8368C4771B83E8B821D88F580202BCB4228075297B19E4FDC5233F1EFDC",
        "740352F2412A9909880C23A559FCECEDA3BE2126FED62FC7660D628A06927F11",
        ...
      ],
      "Flags": 0,
      "LedgerEntryType": "Amendments",
      "Majorities": [
        {
          "Majority": {
            "Amendment": "27CD95EE8E1E5A537FF2F89B6CEB7C622E78E9374EBD7DCBEDFAE21CD6F16E0A",
            "CloseTime": 752970162
          }
        },
        {
          "Majority": {
            "Amendment": "AE35ABDEFBDE520372B31C957020B34A7A4A9DC3115A69803A44016477C84D6E",
            "CloseTime": 753201081
          }
        }
      ],
      "index": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4"
    }
  },
  "status": "success",
  "type": "response",
  "warnings": [
    {
      "id": 2001,
      "message": "This is a clio server. clio only serves validated data. If you want to talk to rippled, include 'ledger_index':'current' in your request"
    }
  ]
}

https://xrpl.org/ja/ledger_entry.html

トランザクション

submit

Blob型の署名済みのトランザクションを送信します。

xrpl.jsなどではclient.submitclient.submitAndWaitの処理の中で呼び出されています。

リクエスト
{
    "id": 3,
    "command": "submit",
    "tx_blob": "1200002280000000240000001E61D4838D7EA4C6800000000000000000000000000055534400000000004B4E9C06F24296074F7BC48F92A97916C6DC5EA968400000000000000B732103AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB7447304502210095D23D8AF107DF50651F266259CC7139D0CD0C64ABBA3A958156352A0D95A21E02207FCF9B77D7510380E49FF250C21B57169E14E9B4ACFD314CEDC79DDD0A38B8A681144B4E9C06F24296074F7BC48F92A97916C6DC5EA983143E9D4A2B8AA0780F682D136F7A56D6724EF53754"
}
レスポンス
{
  "id": 1,
  "status": "success",
  "type": "response",
  "result": {
    "engine_result": "tesSUCCESS",
    "engine_result_code": 0,
    "engine_result_message": "The transaction was applied.Only final in a validated ledger.",
    "tx_blob": "1200002280000000240000016861D4838D7EA4C6800000000000000000000000000055534400000000004B4E9C06F24296074F7BC48F92A97916C6DC5EA9684000000000002710732103AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB7446304402200E5C2DD81FDF0BE9AB2A8D797885ED49E804DBF28E806604D878756410CA98B102203349581946B0DDA06B36B35DBC20EDA27552C1F167BCF5C6ECFF49C6A46F858081144B4E9C06F24296074F7BC48F92A97916C6DC5EA983143E9D4A2B8AA0780F682D136F7A56D6724EF53754",
    "tx_json": {
      "Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
      "Amount": {
        "currency": "USD",
        "issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
        "value": "1"
      },
      "Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
      "Fee": "10000",
      "Flags": 2147483648,
      "Sequence": 360,
      "SigningPubKey": "03AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB",
      "TransactionType": "Payment",
      "TxnSignature": "304402200E5C2DD81FDF0BE9AB2A8D797885ED49E804DBF28E806604D878756410CA98B102203349581946B0DDA06B36B35DBC20EDA27552C1F167BCF5C6ECFF49C6A46F8580",
      "hash": "4D5D90890F8D49519E4151938601EF3D0B30B16CD6A519D9C99102C9FA77F7E0"
    }
  }
}

https://xrpl.org/ja/submit.html

submit_multisigned

JSON型の署名済みのマルチシグトランザクションを送信できます。

リクエスト
{
   "id": "submit_multisigned_example",
   "command": "submit_multisigned",
   "tx_json": {
       "Account": "rEuLyBCvcw4CFmzv8RepSiAoNgF8tTGJQC",
       "Fee": "30000",
       "Flags": 262144,
       "LimitAmount": {
           "currency": "USD",
           "issuer": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
           "value": "100"
       },
       "Sequence": 2,
       "Signers": [{
           "Signer": {
               "Account": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
               "SigningPubKey": "02B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF",
               "TxnSignature": "30450221009C195DBBF7967E223D8626CA19CF02073667F2B22E206727BFE848FF42BEAC8A022048C323B0BED19A988BDBEFA974B6DE8AA9DCAE250AA82BBD1221787032A864E5"
           }
       }, {
           "Signer": {
               "Account": "rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v",
               "SigningPubKey": "028FFB276505F9AC3F57E8D5242B386A597EF6C40A7999F37F1948636FD484E25B",
               "TxnSignature": "30440220680BBD745004E9CFB6B13A137F505FB92298AD309071D16C7B982825188FD1AE022004200B1F7E4A6A84BB0E4FC09E1E3BA2B66EBD32F0E6D121A34BA3B04AD99BC1"
           }
       }],
       "SigningPubKey": "",
       "TransactionType": "TrustSet",
       "hash": "BD636194C48FD7A100DE4C972336534C8E710FD008C0F3CF7BC5BF34DAF3C3E6"
   }
}
レスポンス
{
 "id": "submit_multisigned_example",
 "status": "success",
 "type": "response",
 "result": {
   "engine_result": "tesSUCCESS",
   "engine_result_code": 0,
   "engine_result_message": "The transaction was applied.Only final in a validated ledger.",
   "tx_blob": "1200142200040000240000000263D5038D7EA4C680000000000000000000000000005553440000000000B5F762798A53D543A014CAF8B297CFF8F2F937E868400000000000753073008114A3780F5CB5A44D366520FC44055E8ED44D9A2270F3E010732102B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF744730450221009C195DBBF7967E223D8626CA19CF02073667F2B22E206727BFE848FF42BEAC8A022048C323B0BED19A988BDBEFA974B6DE8AA9DCAE250AA82BBD1221787032A864E58114204288D2E47F8EF6C99BCC457966320D12409711E1E0107321028FFB276505F9AC3F57E8D5242B386A597EF6C40A7999F37F1948636FD484E25B744630440220680BBD745004E9CFB6B13A137F505FB92298AD309071D16C7B982825188FD1AE022004200B1F7E4A6A84BB0E4FC09E1E3BA2B66EBD32F0E6D121A34BA3B04AD99BC181147908A7F0EDD48EA896C3580A399F0EE78611C8E3E1F1",
   "tx_json": {
     "Account": "rEuLyBCvcw4CFmzv8RepSiAoNgF8tTGJQC",
     "Fee": "30000",
     "Flags": 262144,
     "LimitAmount": {
       "currency": "USD",
       "issuer": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
       "value": "100"
     },
     "Sequence": 2,
     "Signers": [
       {
         "Signer": {
           "Account": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
           "SigningPubKey": "02B3EC4E5DD96029A647CFA20DA07FE1F85296505552CCAC114087E66B46BD77DF",
           "TxnSignature": "30450221009C195DBBF7967E223D8626CA19CF02073667F2B22E206727BFE848FF42BEAC8A022048C323B0BED19A988BDBEFA974B6DE8AA9DCAE250AA82BBD1221787032A864E5"
         }
       },
       {
         "Signer": {
           "Account": "rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v",
           "SigningPubKey": "028FFB276505F9AC3F57E8D5242B386A597EF6C40A7999F37F1948636FD484E25B",
           "TxnSignature": "30440220680BBD745004E9CFB6B13A137F505FB92298AD309071D16C7B982825188FD1AE022004200B1F7E4A6A84BB0E4FC09E1E3BA2B66EBD32F0E6D121A34BA3B04AD99BC1"
         }
       }
     ],
     "SigningPubKey": "",
     "TransactionType": "TrustSet",
     "hash": "BD636194C48FD7A100DE4C972336534C8E710FD008C0F3CF7BC5BF34DAF3C3E6"
   }
 }
}

https://xrpl.org/ja/submit_multisigned.html

tx

一意に識別可能なハッシュやCTIDからトランザクション情報を取得します。

リクエスト
{
 "id": 1,
 "command": "tx",
 "transaction": "E08D6E9754025BA2534A78707605E0601F03ACE063687A0CA1BDDACFCD1698C7",
 "binary": false
}
レスポンス
{
   "id": 1,
   "result": {
       "Account": "r3PDtZSa5LiYp1Ysn1vMuMzB59RzV3W9QH",
       "Amount": {
           "currency": "USD",
           "issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
           "value": "1"
       },
       "Destination": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
       "Fee": "10",
       "Flags": 0,
       "Paths": [
           [
               {
                   "account": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
                   "currency": "USD",
                   "issuer": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
                   "type": 49,
                   "type_hex": "0000000000000031"
               }
           ],
           [
               {
                   "account": "rD1jovjQeEpvaDwn9wKaYokkXXrqo4D23x",
                   "currency": "USD",
                   "issuer": "rD1jovjQeEpvaDwn9wKaYokkXXrqo4D23x",
                   "type": 49,
                   "type_hex": "0000000000000031"
               },
               {
                   "account": "rB5TihdPbKgMrkFqrqUC3yLdE8hhv4BdeY",
                   "currency": "USD",
                   "issuer": "rB5TihdPbKgMrkFqrqUC3yLdE8hhv4BdeY",
                   "type": 49,
                   "type_hex": "0000000000000031"
               },
               {
                   "account": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
                   "currency": "USD",
                   "issuer": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
                   "type": 49,
                   "type_hex": "0000000000000031"
               }
           ]
       ],
       "SendMax": {
           "currency": "USD",
           "issuer": "r3PDtZSa5LiYp1Ysn1vMuMzB59RzV3W9QH",
           "value": "1.01"
       },
       "Sequence": 88,
       "SigningPubKey": "02EAE5DAB54DD8E1C49641D848D5B97D1B29149106174322EDF98A1B2CCE5D7F8E",
       "TransactionType": "Payment",
       "TxnSignature": "30440220791B6A3E036ECEFFE99E8D4957564E8C84D1548C8C3E80A87ED1AA646ECCFB16022037C5CAC97E34E3021EBB426479F2ACF3ACA75DB91DCC48D1BCFB4CF547CFEAA0",
       "hash": "E08D6E9754025BA2534A78707605E0601F03ACE063687A0CA1BDDACFCD1698C7",
       "inLedger": 348734,
       "ledger_index": 348734,
       "meta": {
           "AffectedNodes": [
               {
                   "ModifiedNode": {
                       "FinalFields": {
                           "Account": "r3PDtZSa5LiYp1Ysn1vMuMzB59RzV3W9QH",
                           "Balance": "59328999119",
                           "Flags": 0,
                           "OwnerCount": 11,
                           "Sequence": 89
                       },
                       "LedgerEntryType": "AccountRoot",
                       "LedgerIndex": "E0D7BDE68B468FF0B8D948FD865576517DA987569833A05374ADB9A72E870A06",
                       "PreviousFields": {
                           "Balance": "59328999129",
                           "Sequence": 88
                       },
                       "PreviousTxnID": "C26AA6B4F7C3B9F55E17CD0D11F12032A1C7AD2757229FFD277C9447A8815E6E",
                       "PreviousTxnLgrSeq": 348700
                   }
               },
               {
                   "ModifiedNode": {
                       "FinalFields": {
                           "Balance": {
                               "currency": "USD",
                               "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
                               "value": "-1"
                           },
                           "Flags": 131072,
                           "HighLimit": {
                               "currency": "USD",
                               "issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
                               "value": "100"
                           },
                           "HighNode": "0000000000000000",
                           "LowLimit": {
                               "currency": "USD",
                               "issuer": "r3PDtZSa5LiYp1Ysn1vMuMzB59RzV3W9QH",
                               "value": "0"
                           },
                           "LowNode": "0000000000000000"
                       },
                       "LedgerEntryType": "RippleState",
                       "LedgerIndex": "EA4BF03B4700123CDFFB6EB09DC1D6E28D5CEB7F680FB00FC24BC1C3BB2DB959",
                       "PreviousFields": {
                           "Balance": {
                               "currency": "USD",
                               "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
                               "value": "0"
                           }
                       },
                       "PreviousTxnID": "53354D84BAE8FDFC3F4DA879D984D24B929E7FEB9100D2AD9EFCD2E126BCCDC8",
                       "PreviousTxnLgrSeq": 343570
                   }
               }
           ],
           "TransactionIndex": 0,
           "TransactionResult": "tesSUCCESS"
       },
       "validated": true
   },
   "status": "success",
   "type": "response"
}

https://xrpl.org/ja/tx.html

パスやオーダーブック

amm_info

AMMの情報を取得します。
関連レジャーオブジェクト: AccountInfo,AMM

リクエスト
{
    "command": "amm_info",
    "asset": {
      "currency": "XRP"
    },
    "asset2": {
      "currency": "TST",
      "issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
    }
}
レスポンス
{
  "result": {
    "amm": {
      "account": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
      "amount": "296890496",
      "amount2": {
        "currency": "TST",
        "issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd",
        "value": "25.81656470648473"
      },
      "asset2_frozen": false,
      "auction_slot": {
        "account": "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
        "auth_accounts": [
          {
            "account": "r3f2WpQMsAd8k4Zoijv2PZ78EYFJ2EdvgV"
          },
          {
            "account": "rnW8FAPgpQgA6VoESnVrUVJHBdq9QAtRZs"
          }
        ],
        "discounted_fee": 0,
        "expiration": "2023-Jan-26 00:28:40.000000000 UTC",
        "price": {
          "currency": "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
          "issuer": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
          "value": "0"
        },
        "time_interval": 0
      },
      "lp_token": {
        "currency": "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
        "issuer": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
        "value": "87533.41976112682"
      },
      "trading_fee": 600,
      "vote_slots": [
        {
          "account": "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
          "trading_fee": 600,
          "vote_weight": 9684
        }
      ]
    },
    "ledger_current_index": 316725,
    "validated": false
  },
  "status": "success",
  "type": "response"
}

https://xrpl.org/ja/amm_info.html

book_offers

指定したオーダーブックのオファー一覧を取得します。
関連レジャーオブジェクト: Offer

リクエスト
{
  "id": 4,
  "command": "book_offers",
  "taker": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
  "taker_gets": {
    "currency": "XRP"
  },
  "taker_pays": {
    "currency": "USD",
    "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
  },
  "limit": 10
}
レスポンス
{
  "id": 11,
  "status": "success",
  "type": "response",
  "result": {
    "ledger_current_index": 7035305,
    "offers": [
      {
        "Account": "rM3X3QSr8icjTGpaF52dozhbT2BZSXJQYM",
        "BookDirectory": "7E5F614417C2D0A7CEFEB73C4AA773ED5B078DE2B5771F6D55055E4C405218EB",
        "BookNode": "0000000000000000",
        "Flags": 0,
        "LedgerEntryType": "Offer",
        "OwnerNode": "0000000000000AE0",
        "PreviousTxnID": "6956221794397C25A53647182E5C78A439766D600724074C99D78982E37599F1",
        "PreviousTxnLgrSeq": 7022646,
        "Sequence": 264542,
        "TakerGets": {
          "currency": "EUR",
          "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
          "value": "17.90363633316433"
        },
        "TakerPays": {
          "currency": "USD",
          "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
          "value": "27.05340557506234"
        },
        "index": "96A9104BF3137131FF8310B9174F3B37170E2144C813CA2A1695DF2C5677E811",
        "quality": "1.511056473200875"
      },
      {
        "Account": "rhsxKNyN99q6vyYCTHNTC1TqWCeHr7PNgp",
        "BookDirectory": "7E5F614417C2D0A7CEFEB73C4AA773ED5B078DE2B5771F6D5505DCAA8FE12000",
        "BookNode": "0000000000000000",
        "Flags": 131072,
        "LedgerEntryType": "Offer",
        "OwnerNode": "0000000000000001",
        "PreviousTxnID": "8AD748CD489F7FF34FCD4FB73F77F1901E27A6EFA52CCBB0CCDAAB934E5E754D",
        "PreviousTxnLgrSeq": 7007546,
        "Sequence": 265,
        "TakerGets": {
          "currency": "EUR",
          "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
          "value": "2.542743233917848"
        },
        "TakerPays": {
          "currency": "USD",
          "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
          "value": "4.19552633596446"
        },
        "index": "7001797678E886E22D6DE11AF90DF1E08F4ADC21D763FAFB36AF66894D695235",
        "quality": "1.65"
      }
    ]
  }
}

https://xrpl.org/ja/book_offers.html

deposit_authorized

指定したアカウントが指定したアカウントに送金できるかを確認します。
関連レジャーオブジェクト: DepositPreauth

リクエスト
{
  "id": 1,
  "command": "deposit_authorized",
  "source_account": "rEhxGqkqPPSxQ3P25J66ft5TwpzV14k2de",
  "destination_account": "rsUiUMpnrgxQp24dJYZDhmV4bE3aBtQyt8",
  "ledger_index": "validated"
}
レスポンス
{
  "id": 1,
  "result": {
    "deposit_authorized": true,
    "destination_account": "rsUiUMpnrgxQp24dJYZDhmV4bE3aBtQyt8",
    "ledger_hash": "BD03A10653ED9D77DCA859B7A735BF0580088A8F287FA2C5403E0A19C58EF322",
    "ledger_index": 8,
    "source_account": "rEhxGqkqPPSxQ3P25J66ft5TwpzV14k2de",
    "validated": true
  },
  "status": "success",
  "type": "response"
}

https://xrpl.org/ja/deposit_authorized.html

nft_buy_offer

指定したNFTに対する購入オファーの一覧を取得します。
関連レジャーオブジェクト: NFTokenOffer

リクエスト
{
  "command": "nft_buy_offers",
  "nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007",
  "ledger_index": "validated"
}
レスポンス
{
  "result": {
    "nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007",
    "offers": [
      {
        "amount": "1500",
        "flags": 0,
        "nft_offer_index": "3212D26DB00031889D4EF7D9129BB0FA673B5B40B1759564486C0F0946BA203F",
        "owner": "rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx"
      }
    ]
  },
  "status": "success",
  "type": "response"
}

https://xrpl.org/ja/nft_buy_offers.html

nft_sell_offer

指定したNFTに対する販売オファーの一覧を取得します。
関連レジャーオブジェクト: NFTokenOffer

リクエスト
{
  "command": "nft_sell_offers",
  "nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007",
  "ledger_index": "validated"
}
レスポンス
{
  "result": {
    "nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007",
    "offers": [
      {
        "amount": "1000",
        "flags": 1,
        "nft_offer_index": "9E28E366573187F8E5B85CE301F229E061A619EE5A589EF740088F8843BF10A1",
        "owner": "rLpSRZ1E8JHyNDZeHYsQs1R5cwDCB3uuZt"
      }
    ]
  },
  "status": "success",
  "type": "response"
}

https://xrpl.org/ja/nft_sell_offers.html

path_find

2つのアカウント間での最適な支払いパスを取得・更新します。
関連レジャーオブジェクト: RippleState

リクエスト
{
   "id":8,
   "command":"path_find",
   "subcommand":"create",
   "source_account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
   "destination_account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
   "destination_amount":{
       "value":"0.001",
       "currency":"USD",
       "issuer":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
   }
}
レスポンス
{
 "id":1,
 "status":"success",
 "type":"response",
 "result":{
   "alternatives":[
     {
       "paths_computed":[
         [
           {
             "currency":"USD",
             "issuer":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
             "type":48,
             "type_hex":"0000000000000030"
           },
           {
             "account":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
             "type":1,
             "type_hex":"0000000000000001"
           }
         ],
         [
           {
             "currency":"USD",
             "issuer":"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
             "type":48,
             "type_hex":"0000000000000030"
           },
           {
             "account":"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
             "type":1,
             "type_hex":"0000000000000001"
           }
         ],
         [
           {
             "currency":"USD",
             "issuer":"r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X",
             "type":48,
             "type_hex":"0000000000000030"
           },
           {
             "account":"r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X",
             "type":1,
             "type_hex":"0000000000000001"
           }
         ],
         [
           {
             "currency":"USD",
             "issuer":"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
             "type":48,
             "type_hex":"0000000000000030"
           },
           {
             "account":"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
             "type":1,
             "type_hex":"0000000000000001"
           }
         ]
       ],
       "source_amount":"251686"
     },
     {
       "paths_computed":[
         [
           {
             "account":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
             "type":1,
             "type_hex":"0000000000000001"
           },
           {
             "currency":"USD",
             "issuer":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
             "type":48,
             "type_hex":"0000000000000030"
           },
           {
             "account":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
             "type":1,
             "type_hex":"0000000000000001"
           }
         ],
         [
           {
             "account":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
             "type":1,
             "type_hex":"0000000000000001"
           },
           {
             "currency":"USD",
             "issuer":"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
             "type":48,
             "type_hex":"0000000000000030"
           },
           {
             "account":"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
             "type":1,
             "type_hex":"0000000000000001"
           }
         ],
         [
           {
             "account":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
             "type":1,
             "type_hex":"0000000000000001"
           },
           {
             "currency":"USD",
             "issuer":"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
             "type":48,
             "type_hex":"0000000000000030"
           },
           {
             "account":"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun",
             "type":1,
             "type_hex":"0000000000000001"
           }
         ]
       ],
       "source_amount":{
         "currency":"BTC",
         "issuer":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
         "value":"0.000001541291269274307"
       }
     },
     ...
   ],
   "destination_account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
   "destination_amount":{
     "currency":"USD",
     "issuer":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
     "value":"0.001"
   },
   "id":1,
   "source_account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
   "full_reply": false
 }
}

https://xrpl.org/ja/path_find.html

ripple_path_find

2つのアカウント間での最適な支払いパスを取得します。
関連レジャーオブジェクト: RippleState

リクエスト
{
   "id":8,
   "command":"ripple_path_find",
   "source_account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
   "source_currencies":[
       {
           "currency":"XRP"
       },
       {
           "currency":"USD"
       }
   ],
   "destination_account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
   "destination_amount":{
       "value":"0.001",
       "currency":"USD",
       "issuer":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
   }
}
レスポンス
{
   "id":8,
   "status":"success",
   "type":"response",
   "result":{
       "alternatives":[
           {
               "paths_canonical":[],
               "paths_computed":[
                   [
                       {
                           "currency":"USD",
                           "issuer":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
                           "type":48,
                           "type_hex":"0000000000000030"
                       },
                       {
                           "account":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
                           "type":1,
                           "type_hex":"0000000000000001"
                       }
                   ],
                   [
                       {
                           "currency":"USD",
                           "issuer":"rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1",
                           "type":48,
                           "type_hex":"0000000000000030"
                       },
                       {
                           "account":"rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1",
                           "type":1,
                           "type_hex":"0000000000000001"
                       },
                       {
                           "account":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
                           "type":1,
                           "type_hex":"0000000000000001"
                       }
                   ],
                   [
                       {
                           "currency":"USD",
                           "issuer":"rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1",
                           "type":48,
                           "type_hex":"0000000000000030"
                       },
                       {
                           "account":"rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1",
                           "type":1,
                           "type_hex":"0000000000000001"
                       },
                       {
                           "account":"rLpq4LgabRfm1xEX5dpWfJovYBH6g7z99q",
                           "type":1,
                           "type_hex":"0000000000000001"
                       },
                       {
                           "account":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
                           "type":1,
                           "type_hex":"0000000000000001"
                       }
                   ],
                   [
                       {
                           "currency":"USD",
                           "issuer":"rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1",
                           "type":48,
                           "type_hex":"0000000000000030"
                       },
                       {
                           "account":"rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1",
                           "type":1,
                           "type_hex":"0000000000000001"
                       },
                       {
                           "account":"rPuBoajMjFoDjweJBrtZEBwUMkyruxpwwV",
                           "type":1,
                           "type_hex":"0000000000000001"
                       },
                       {
                           "account":"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
                           "type":1,
                           "type_hex":"0000000000000001"
                       }
                   ]
               ],
               "source_amount":"256987"
           }
       ],
       "destination_account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
       "destination_currencies":[
           "015841551A748AD2C1F76FF6ECB0CCCD00000000",
           "JOE",
           "DYM",
           "EUR",
           "CNY",
           "MXN",
           "BTC",
           "USD",
           "XRP"
       ]
   }
}

https://xrpl.org/ja/ripple_path_find.html

ペイメントチャネル

channel_verify

オフレジャーで受け取ったペイメントチャネル送金の署名を検証します。
関連レジャーオブジェクト: PayChannel

リクエスト
{
   "id":1,
   "command":"channel_verify",
   "channel_id":"5DB01B7FFED6B67E6B0414DED11E051D2EE2B7619CE0EAA6286D67A3A4D5BDB3",
   "signature":"304402204EF0AFB78AC23ED1C472E74F4299C0C21F1B21D07EFC0A3838A420F76D783A400220154FB11B6F54320666E4C36CA7F686C16A3A0456800BBC43746F34AF50290064",
   "public_key":"aB44YfzW24VDEJQ2UuLPV2PvqcPCSoLnL7y5M1EzhdW4LnK5xMS3",
   "amount":"1000000"
}
レスポンス
{
   "id":1,
   "status":"success",
   "type":"response",
   "result":{
       "signature_verified":true
   }
}

https://xrpl.org/ja/channel_verify.html

サブスクリプション

subscribe

レジャー情報やトランザクション情報、オーダーブック情報などの変更をリアルタイムで取得します。

レジャー情報取得の例
リクエスト
{
  "id": "Example watch for new validated ledgers",
  "command": "subscribe",
  "streams": ["ledger"]
}
レスポンス
{
  "result": {
    "validated_ledgers": "32570-84126901",
    "ledger_index": 84126901,
    "ledger_hash": "5D5837FF16999B6E4B4CA0C5BD5555BF14426614A751AF3377680C0D9251C5D6",
    "ledger_time": 754108900,
    "fee_base": 10,
    "reserve_base": 10000000,
    "reserve_inc": 2000000
  },
  "id": "Example watch one account and all new ledgers",
  "status": "success",
  "type": "response",
}
オーダーブック取得の例
リクエスト
{
  "id": "Example subscribe to XRP/GateHub USD order book",
  "command": "subscribe",
  "books": [
      {
          "taker_pays": {
              "currency": "XRP"
          },
          "taker_gets": {
              "currency": "USD",
              "issuer": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq"
          },
          "snapshot": true
      }
  ]
}
レスポンス
{
    "engine_result": "tesSUCCESS",
    "engine_result_code": 0,
    "engine_result_message": "The transaction was applied. Only final in a validated ledger.",
    "ledger_hash": "08547DD866F099CCB3666F113116B7AA2DF520FA2E3011DD1FF9C9C04A6C7C3E",
    "ledger_index": 18852105,
    "meta": {
        "AffectedNodes": [{
            "ModifiedNode": {
                "FinalFields": {
                    "Account": "rfCFLzNJYvvnoGHWQYACmJpTgkLUaugLEw",
                    "AccountTxnID": "D295E2BE50E3B78AED24790D7B9096996DAF43F095BF17DB83EEACC283D14050",
                    "Balance": "3070332374272",
                    "Flags": 0,
                    "OwnerCount": 23,
                    "RegularKey": "r9S56zu6QeJD5d8A7QMfLAeYavgB9dhaX4",
                    "Sequence": 12142921
                },
                "LedgerEntryType": "AccountRoot",
                "LedgerIndex": "2880A9B4FB90A306B576C2D532BFE390AB3904642647DCF739492AA244EF46D1",
                "PreviousFields": {
                    "AccountTxnID": "3CA3422B0E42D76A7A677B0BA0BE72DFCD93676E0C80F8D2EB27C04BD8457A0F",
                    "Balance": "3070332385272",
                    "Sequence": 12142920
                },
                "PreviousTxnID": "3CA3422B0E42D76A7A677B0BA0BE72DFCD93676E0C80F8D2EB27C04BD8457A0F",
                "PreviousTxnLgrSeq": 18852102
            }
        }, {
            "ModifiedNode": {
                "FinalFields": {
                    "Flags": 0,
                    "IndexPrevious": "00000000000022D2",
                    "Owner": "rfCFLzNJYvvnoGHWQYACmJpTgkLUaugLEw",
                    "RootIndex": "F435FBBEC9654204D7151A01E686BAA8CB325A472D7B61C7916EA58B59355767"
                },
                "LedgerEntryType": "DirectoryNode",
                "LedgerIndex": "29A543B6681AD7FC8AFBD1386DAE7385F02F9B8C4756A467DF6834AB54BBC9DB"
            }
        }, {
            "ModifiedNode": {
                "FinalFields": {
                    "ExchangeRate": "4C1BA999A513EF78",
                    "Flags": 0,
                    "RootIndex": "79C54A4EBD69AB2EADCE313042F36092BE432423CC6A4F784C1BA999A513EF78",
                    "TakerGetsCurrency": "0000000000000000000000000000000000000000",
                    "TakerGetsIssuer": "0000000000000000000000000000000000000000",
                    "TakerPaysCurrency": "0000000000000000000000005553440000000000",
                    "TakerPaysIssuer": "2ADB0B3959D60A6E6991F729E1918B7163925230"
                },
                "LedgerEntryType": "DirectoryNode",
                "LedgerIndex": "79C54A4EBD69AB2EADCE313042F36092BE432423CC6A4F784C1BA999A513EF78"
            }
        }, {
            "CreatedNode": {
                "LedgerEntryType": "Offer",
                "LedgerIndex": "92E235EE80D2B28A89BEE2C905D4545C2A004FD5D4097679C8A3FB25507FD9EB",
                "NewFields": {
                    "Account": "rfCFLzNJYvvnoGHWQYACmJpTgkLUaugLEw",
                    "BookDirectory": "79C54A4EBD69AB2EADCE313042F36092BE432423CC6A4F784C1BA999A513EF78",
                    "Expiration": 508543674,
                    "OwnerNode": "00000000000022F4",
                    "Sequence": 12142920,
                    "TakerGets": "6537121438",
                    "TakerPays": {
                        "currency": "USD",
                        "issuer": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq",
                        "value": "50.9"
                    }
                }
            }
        }, {
            "DeletedNode": {
                "FinalFields": {
                    "Account": "rfCFLzNJYvvnoGHWQYACmJpTgkLUaugLEw",
                    "BookDirectory": "79C54A4EBD69AB2EADCE313042F36092BE432423CC6A4F784C1BA999A513EF78",
                    "BookNode": "0000000000000000",
                    "Expiration": 508543133,
                    "Flags": 0,
                    "OwnerNode": "00000000000022F4",
                    "PreviousTxnID": "58B3279C2D56AAC3D9B06106E637C01E3D911E9D31E2FE4EA0D886AC9F4DEE1E",
                    "PreviousTxnLgrSeq": 18851945,
                    "Sequence": 12142889,
                    "TakerGets": "6537121438",
                    "TakerPays": {
                        "currency": "USD",
                        "issuer": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq",
                        "value": "50.9"
                    }
                },
                "LedgerEntryType": "Offer",
                "LedgerIndex": "D3436CE21925E1CB12C5C444963B47D7EA0CD9A0E387926DC76B23FE5CD1C15F"
            }
        }],
        "TransactionIndex": 26,
        "TransactionResult": "tesSUCCESS"
    },
    "status": "closed",
    "transaction": {
        "Account": "rfCFLzNJYvvnoGHWQYACmJpTgkLUaugLEw",
        "Expiration": 508543674,
        "Fee": "11000",
        "Flags": 2147483648,
        "LastLedgerSequence": 18852106,
        "OfferSequence": 12142889,
        "Sequence": 12142920,
        "SigningPubKey": "034841BF24BD72C7CC371EBD87CCBF258D8ADB05C18DE207130364A97D8A3EA524",
        "TakerGets": "6537121438",
        "TakerPays": {
            "currency": "USD",
            "issuer": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq",
            "value": "50.9"
        },
        "TransactionType": "OfferCreate",
        "TxnSignature": "3045022100B9AD678A773FB61F8F9B565713C80CBF187A2F9EB8E9CE0DAC7B839CA6F4B04C02200613D173A0636CD9BE13F2E3EBD13A16932B5B7D8A96BB5F6D561CA5CDBC4AD3",
        "date": 508543090,
        "hash": "D295E2BE50E3B78AED24790D7B9096996DAF43F095BF17DB83EEACC283D14050",
        "owner_funds": "3070197374272"
    },
    "type": "transaction",
    "validated": true
}

https://xrpl.org/ja/subscribe.html

unsubscribe

subscribeによる情報の取得を中止します。

リクエスト
{
   "id":"Unsubscribe a lot of stuff",
   "command":"unsubscribe",
   "streams":["ledger","server","transactions","transactions_proposed"],
   "accounts":["rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1"],
   "accounts_proposed":["rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1"],
   "books":[
       {
           "taker_pays":{
               "currency":"XRP"
           },
           "taker_gets":{
               "currency":"USD",
               "issuer":"rUQTpMqAF5jhykj4FExVeXakrZpiKF6cQV"
           },
           "both": true
       }
   ]
}
レスポンス
{
   "id":"Unsubscribe a lot of stuff",
   "result":{},
   "status":"success",
   "type":"response"
}

https://xrpl.org/ja/unsubscribe.html

サーバ情報

fee

現在の手数料情報を取得します。

リクエスト
{
  "id":"fee_websocket_example",
  "command":"fee"
}
レスポンス
{
  "id":"fee_websocket_example",
  "status":"success",
  "type":"response",
  "result":{
    "current_ledger_size":"14",
    "current_queue_size":"0",
    "drops":{
      "base_fee":"10",
      "median_fee":"11000",
      "minimum_fee":"10",
      "open_ledger_fee":"10"
    },
    "expected_ledger_size":"24",
    "ledger_current_index":26575101,
    "levels":{
      "median_level":"281600",
      "minimum_level":"256",
      "open_ledger_level":"256",
      "reference_level":"256"
    },
    "max_queue_size":"480"
  }
}

https://xrpl.org/ja/fee.html

server_info

現在のサーバ情報を取得します(ユーザ向け)。

リクエスト
{
  "id": 1,
  "command": "server_info"
}
レスポンス
{
  "id": 1,
  "status": "success",
  "type": "response",
  "result": {
    "info": {
      "build_version": "0.30.1-rc3",
      "complete_ledgers": "18611104-18614732",
      "hostid": "trace",
      "io_latency_ms": 1,
      "last_close": {
        "converge_time_s": 4.003,
        "proposers": 5
      },
      "load": {
        "job_types": [
          {
            "job_type": "untrustedProposal",
            "per_second": 2
          },
          ...
        ],
        "threads": 6
      },
      "load_factor": 1000,
      "load_factor_net": 1000,
      "peers": 10,
      "pubkey_node": "n94UE1ukbq6pfZY9j54sv2A1UrEeHZXLbns3xK5CzU9NbNREytaa",
      "pubkey_validator": "n9KM73uq5BM3Fc6cxG3k5TruvbLc8Ffq17JZBmWC4uP4csL4rFST",
      "server_state": "proposing",
      "server_state_duration_us": 92762334,
      "state_accounting": {
        "connected": {
          "duration_us": "150510079",
          "transitions": 1
        },
        "disconnected": {
          "duration_us": "1827731",
          "transitions": 1
        },
        "full": {
          "duration_us": "166972201508",
          "transitions": 1853
        },
        "syncing": {
          "duration_us": "6249156726",
          "transitions": 1854
        },
        "tracking": {
          "duration_us": "13035222",
          "transitions": 1854
        }
      },
      "uptime": 173379,
      "validated_ledger": {
        "age": 3,
        "base_fee_xrp": 0.00001,
        "hash": "04F7CF4EACC57140C8088F6BFDC8A824BB3ED5717C3DAA6642101F9FB446226C",
        "reserve_base_xrp": 20,
        "reserve_inc_xrp": 5,
        "seq": 18614732
      },
      "validation_quorum": 4,
      "validator_list_expires" : "2017-Oct-12 16:06:36"
    }
  }
}

https://xrpl.org/ja/server_info.html

server_state

現在のサーバ情報を取得します(プログラム向け)。

リクエスト
{
 "id": 2,
 "command": "server_state"
}
レスポンス
{
 "id": 2,
 "status": "success",
 "type": "response",
 "result": {
   "state": {
     "build_version": "0.30.1-rc3",
     "complete_ledgers": "18611104-18615049",
     "io_latency_ms": 1,
     "last_close": {
       "converge_time": 3003,
       "proposers": 5
     },
     "load": {
       "job_types": [
         {
           "job_type": "untrustedProposal",
           "peak_time": 1,
           "per_second": 3
         },
         ...
       ],
       "threads": 6
     },
     "load_base": 256,
     "load_factor": 256000,
     "peers": 10,
     "pubkey_node": "n94UE1ukbq6pfZY9j54sv2A1UrEeHZXLbns3xK5CzU9NbNREytaa",
     "pubkey_validator": "n9KM73uq5BM3Fc6cxG3k5TruvbLc8Ffq17JZBmWC4uP4csL4rFST",
     "server_state": "proposing",
     "server_state_duration_us": 92762334,
     "state_accounting": {
       "connected": {
         "duration_us": "150510079",
         "transitions": 1
       },
       "disconnected": {
         "duration_us": "1827731",
         "transitions": 1
       },
       "full": {
         "duration_us": "168295542987",
         "transitions": 1865
       },
       "syncing": {
         "duration_us": "6294237352",
         "transitions": 1866
       },
       "tracking": {
         "duration_us": "13035524",
         "transitions": 1866
       }
     },
     "uptime": 174748,
     "validated_ledger": {
       "base_fee": 10,
       "close_time": 507693650,
       "hash": "FEB17B15FB64E3AF8D371E6AAFCFD8B92775BB80AB953803BD73EA8EC75ECA34",
       "reserve_base": 20000000,
       "reserve_inc": 5000000,
       "seq": 18615049
     },
     "validation_quorum": 4,
     "validator_list_expires": 561139596
   }
 }
}

https://xrpl.org/ja/server_state.html

コード例

xrpl.jsを使ってパブリックAPIを利用してみましょう。

account_infoledger_entryを利用し、2つの方法でアカウントの情報を取得してみます。

account_info

アカウント情報をより詳細に取得します。フラグなどがよりヒューマンリーダブルな形式で取得できます。

import { Client } from "xrpl"

const main = async () => {
  const client = new Client('wss://xrpl.ws')
  await client.connect()
  
  const response = await client.request({
    command: 'account_info',
    account: 'rQQQrUdN1cLdNmxH4dHfKgmX5P4kf3ZrM'
  })
  console.log(response.result)
}

main()
console.log(response.result)
{
  account_data: {
    Account: 'rQQQrUdN1cLdNmxH4dHfKgmX5P4kf3ZrM',
    Balance: '159030647',
    BurnedNFTokens: 1,
    Domain: '746571752E646576',
    EmailHash: 'DCA87D72C399A1993247F6BE6E3C929E',
    Flags: 0,
    LedgerEntryType: 'AccountRoot',
    MintedNFTokens: 2,
    OwnerCount: 20,
    PreviousTxnID: '248A756C2CBF70633131DC7F45C9819A99FB16E719A471BD9B143E88D33D0608',
    PreviousTxnLgrSeq: 84015814,
    Sequence: 61531654,
    index: '6A6192D86708D68A1678859E30F945F3179F55838CB9E56935F618FF103FF113',
    urlgravatar: 'http://www.gravatar.com/avatar/dca87d72c399a1993247f6be6e3c929e'
  },
  account_flags: {
    defaultRipple: false,
    depositAuth: false,
    disableMasterKey: false,
    disallowIncomingCheck: false,
    disallowIncomingNFTokenOffer: false,
    disallowIncomingPayChan: false,
    disallowIncomingTrustline: false,
    disallowIncomingXRP: false,
    globalFreeze: false,
    noFreeze: false,
    passwordSpent: false,
    requireAuthorization: false,
    requireDestinationTag: false
  },
  ledger_current_index: 84127038,
  validated: false,
  _nodepref: 'nonfh'
}

ledger_entry

アカウント情報をレジャーオブジェクトとして取得します。

import { Client } from "xrpl"

const main = async () => {
  const client = new Client('wss://xrpl.ws')
  await client.connect()
  
  const response = await client.request({
    command: 'ledger_entry',
    account_root: "rQQQrUdN1cLdNmxH4dHfKgmX5P4kf3ZrM"
  })
  console.log(response.result)
}

main()
console.log(response.result)
{
  index: '6A6192D86708D68A1678859E30F945F3179F55838CB9E56935F618FF103FF113',
  ledger_current_index: 84127071,
  node: {
    Account: 'rQQQrUdN1cLdNmxH4dHfKgmX5P4kf3ZrM',
    Balance: '159030647',
    BurnedNFTokens: 1,
    Domain: '746571752E646576',
    EmailHash: 'DCA87D72C399A1993247F6BE6E3C929E',
    Flags: 0,
    LedgerEntryType: 'AccountRoot',
    MintedNFTokens: 2,
    OwnerCount: 20,
    PreviousTxnID: '248A756C2CBF70633131DC7F45C9819A99FB16E719A471BD9B143E88D33D0608',
    PreviousTxnLgrSeq: 84015814,
    Sequence: 61531654,
    index: '6A6192D86708D68A1678859E30F945F3179F55838CB9E56935F618FF103FF113'
  },
  validated: false,
}

ページング

パブリックノードから大きなサイズのリスト情報を取得する場合、一度に取得可能なサイズに制限があります。そのため、ページングを利用してリストを取得する必要があります。

リクエスト
import { AccountTxTransaction, Client, Transaction } from "xrpl"

const main = async () => {
  const client = new Client('wss://xrpl.ws')
  await client.connect()

  let transaction: AccountTxTransaction[] = []

  let maker: any = undefined

  do {
    const response = await client.request({
      command: 'account_tx',
      account: "rQQQrUdN1cLdNmxH4dHfKgmX5P4kf3ZrM",
      maker // makerを指定
    })
    transaction = [...transaction, ...response.result.transactions]
    console.log(transaction.length)
    maker = response.result.marker // レスポンスにmakerが含まれる場合は、リストの続きがあるということなので、makerを指定して再度リクエストを行う
  } while (maker)
  console.log(transaction)
}

main()

レスポンス
[
  {
    meta: {
      AffectedNodes: [Array],
      TransactionIndex: 23,
      TransactionResult: 'tesSUCCESS',
      delivered_amount: '183805'
    },
    tx: {
      Account: 'rExK8TgtWigYb1vx9uZTrZrPht7pdQzoQm',
      Amount: '183805',
      Destination: 'rQQQrUdN1cLdNmxH4dHfKgmX5P4kf3ZrM',
      Fee: '10',
      Flags: 0,
      LastLedgerSequence: 84015832,
      Sequence: 79493874,
      SigningPubKey: 'ED9CD226C4B8A3166937B8852DB49E45859CF84DF6B4C6BB70422BF6E9A6778742',
      TransactionType: 'Payment',
      TxnSignature: '8C018832D8864AD8050FB56935D6DF0FFAE180C1C263E2DE2252BBEDA2A6F07DFCD5B33788BCBE7EBAC4F1C4260F76142B420BB61E291CCEAD0B538807DDC00F',
      date: 753682890,
      hash: '248A756C2CBF70633131DC7F45C9819A99FB16E719A471BD9B143E88D33D0608',
      inLedger: 84015814,
      ledger_index: 84015814
    },
    validated: true
  },
  ...
]

まとめ

XRPLではXRP Ledgerサーバと直接通信を行い、レジャーのデータを取得することが可能です。
取得可能なデータは多岐にわたり、アカウント情報やトランザクション情報、オーダーブック情報などを取得することができます。

トランザクションの送信とこのデータ取得を組み合わせることで、XRP Ledgerを利用した様々なアプリケーションを作成することができます。

興味を持たれた方はXRP Ledger開発者のDiscordチャンネルへ是非お越しください!
日本語チャンネルもありますので、英語ができなくても大丈夫です!
https://xrpldevs.org

また、XRPL JapanのDiscordサーバもありますので、こちらもぜひご参加ください!
https://discord.gg/invite/xrpljapan

Discussion