XRPLF / rippled

Decentralized cryptocurrency blockchain daemon implementing the XRP Ledger protocol in C++
https://xrpl.org
ISC License
4.52k stars 1.47k forks source link

Add X-address encoding/decoding RPCs to rippled #3236

Open Crypto2 opened 4 years ago

Crypto2 commented 4 years ago

I think it would be a good idea to aid adoption of X-address format by adding encoding/decoding RPCs to rippled. Currently sample code is only available for Java and a public API that could potentially be compromised.

intelliot commented 1 year ago

The X-address codec is available in all of the supported client libraries:

xrpl.js: https://js.xrpl.org/functions/decodeXAddress.html

xrpl-py: https://xrpl-py.readthedocs.io/en/stable/source/xrpl.core.addresscodec.html

That said, I think it would be convenient to have this as part of rippled. Could you propose an API design for the feature?

Crypto2 commented 1 year ago

Nothing fancy, just like RPC calls of:

encode_x_address(address, optional tag) returns the address in X-format. decode_x_address(address) returns the norrmal Ripple address and tag.

For safety return an error if you try to decode a testnet address and rippled isn't running on testnet (and vice versa.) When I posted that I don't think X-address format was in any official libraries, you had to go out and get/make external ones.

intelliot commented 1 year ago

What prevents a malicious rippled from using an attacker's address in the response?

Crypto2 commented 1 year ago

You'd only want to use that kind of API on a node you run not a public one.