XRPLF / xrpl-py

A Python library to interact with the XRP Ledger (XRPL) blockchain
ISC License
144 stars 81 forks source link

Use Network ID to determine the correct faucet to use #710

Open mvadari opened 1 month ago

mvadari commented 1 month ago

Code reference: https://github.com/XRPLF/xrpl-py/blob/main/xrpl/asyncio/wallet/wallet_generation.py

Currently, the faucet generation code guesses the correct faucet to use based on substrings in the URL. This isn't a very robust system. It would be better (and more robust) to use the Network ID.

ckeshava commented 3 weeks ago

If a transaction includes the NetworkID field, then it fails on mainnet, testnet, devnet (any network whose network_id < 1025). Docs: https://xrpl.org/docs/references/protocol/transactions/common-fields/#networkid-field

image

How can we disambiguate between these networks with the network_id field?

mvadari commented 3 weeks ago

If a transaction includes the NetworkID field, then it fails on mainnet, testnet, devnet (any network whose network_id < 1025). How can we disambiguate between these networks with the network_id field?

All networks have a network ID, that's how you determine whether or not the NetworkID field needs to be included in the transaction. It's available in server_info.