Arbitrum One
Prêt à utiliser cela en production ?
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
Arbitrum One
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
go-ethereum (geth) is the official Go implementation of Ethereum and the most complete, up-to-date EVM library available to Go developers. Its ethclient package speaks plain JSON-RPC, so it connects to Arbitrum One's Nitro nodes exactly as it would to L1 — point it at https://arbitrum.therpc.io/YOUR_API_KEY. Install it with go get github.com/ethereum/go-ethereum. The library is maintained by the Ethereum Foundation, which keeps it aligned with the latest protocol changes that flow downstream into Arbitrum's EVM-equivalent execution.
go-ethereum is the official Go client, maintained by the Ethereum Foundation, and gives Go developers the most complete and current EVM implementation for building on Arbitrum One — from balance reads to abigen contract bindings, all over the same JSON-RPC interface the rollup exposes.
Call ethclient.Dial("https://arbitrum.therpc.io/YOUR_API_KEY") to open a connection to Arbitrum One. Wrapping the returned *ethclient.Client in your own struct — as EthereumClient does below — keeps the dependency injectable and your code testable, so you can swap in a mock client or a local Nitro dev node in unit tests without touching call sites.
For type-safe contract access, run abigen over a Solidity ABI to generate Go bindings — the cleanest way to integrate Arbitrum One protocols like GMX or Uniswap into a Go backend. Under the hood, bind.BoundContract wraps the parsed ABI and exposes Call for view methods (free, read against the latest sequencer state) and Transact for state-changing methods (L2 transactions paid in ETH). Pull verified ABIs from https://arbiscan.io.
SubscribeNewHead opens a push subscription, which requires a WebSocket connection — the plain HTTP endpoint cannot stream, so you must dial a wss:// URL for this. Run the subscription loop in a goroutine and use select to handle both incoming headers and sub.Err(), so a dropped connection is detected and can be re-dialed. On Arbitrum One the sequencer produces new blocks faster than one per second, so a steady stream of headers is normal — size your channel buffers accordingly.
Wei values on Arbitrum One are 256-bit integers, so always use big.Int and big.Float for arithmetic — never float64, which silently loses precision past 15–16 significant digits and would corrupt an ETH balance or a transfer amount. The helpers below convert between wei and ether and validate hex addresses so this discipline stays consistent across the codebase.