# Get Started The XRP Ledger is always online and entirely public. You can access it **directly from a web browser** with a few steps described in this page. Scroll down to get started! ## 1. Prerequisites To access the XRP Ledger from a webpage, load [Lodash](https://lodash.com/) and [RippleAPI for JavaScript (ripple-lib)](rippleapi-reference.html) in your site's HTML. For example: ```html ``` On this page, that's already done, so continue to the next step! ## 2. First Script The following code gets the latest [ledger version](ledgers.html) and a list of transactions that were newly-validated in that ledger version, using the [`getLedger()` method](rippleapi-reference.html#getledger). Try running it as-is, or change the code and see what happens. **Tip:** If you can, open your browser's Developer Tools by pressing **F12**. The "Console" tab provides a native JavaScript console and can give insight into what code is running on any webpage. ```js const mainnet = new ripple.RippleAPI({ server: 'wss://s1.ripple.com' }); (async function(api) { await api.connect(); let response = await api.getLedger({ includeTransactions: true }); console.log(response); })(mainnet); ``` ```js const mainnet = new ripple.RippleAPI({ server: 'wss://s.altnet.rippletest.net/' }); (async function(api) { await api.connect(); let response = await api.getLedger({ includeTransactions: true }); console.log(response); })(mainnet); ``` ```js const mainnet = new ripple.RippleAPI({ server: 'wss://s1.ripple.com' }); (async function(api) { await api.connect(); let response = await api.getLedger({ includeTransactions: true }); let tx_id = response.transactionHashes[0]; let response2 = await api.getTransaction(tx_id); console.log(response2); })(mainnet); ``` ```js const mainnet = new ripple.RippleAPI({ server: 'wss://s1.ripple.com' }); (async function(api) { await api.connect(); let response = await api.getLedger({ includeTransactions: true }); console.log('Total XRP: '+api.dropsToXrp(response.totalDrops)); })(mainnet); ``` ## 3. Next Steps Try editing the code from step 2 to do something different: - Connect to the [Testnet](parallel-networks.html) public server at `wss://s.altnet.rippletest.net/` instead. [Answer >](javascript:js_interactives.step2.ex_1()) - Look up the details of a transaction using the [`getTransaction()` method](rippleapi-reference.html#gettransaction). For the `id`, use one of the `transactionHashes` from the `getLedger()` response! [Answer >](javascript:js_interactives.step2.ex_2()) - Convert the `totalDrops` from the response to decimal XRP. [Answer >](javascript:js_interactives.step2.ex_3()) ## Further Reading