Ethereum
¿Listo para usar esto en producción?
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Ethereum
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
net_version returns the network ID of the chain a node is connected to, given as a plain decimal string. For Ethereum mainnet the answer is "1" — the same value as chain ID 1, since the two coincide on Ethereum even though they are distinct concepts at the protocol level. It is a quick way to confirm you are talking to the right ETH network before you do anything that matters. Point the call at https://ethereum.therpc.io/YOUR_API_KEY and you will get "1" back; a Sepolia endpoint would answer "11155111", Holesky "17000". The method takes no parameters and reads no state.
"1") before broadcasting a transaction that moves real ETH."11155111") or Holesky ("17000") so staging never writes to production state.Este método no acepta parámetros. Pasa un array vacío [].
| Tipo | Descripción |
|---|---|
| string | Decimal string network ID, e.g. `"1"` for Ethereum mainnet. Note: network ID and chain ID coincide on most networks but can differ. |
Try it live in the Ethereum playground.
1), but they are not the same field, and on some networks they diverge. For anything that signs a transaction, use eth_chainId, since EIP-155 replay protection is keyed on the chain ID, not the network ID.0x-prefixed hex you see almost everywhere else in the JSON-RPC API. Parse it as base 10, and do not feed it to a hex decoder expecting "0x1".