Get started - reorg for faster start, next steps

This commit is contained in:
mDuo13
2020-09-11 18:08:08 -07:00
parent 2c3a6e0c82
commit 8e6173b2e4

View File

@@ -1,30 +1,13 @@
# Get Started # 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! The XRP Ledger is always online and entirely public. Anyone can access it **directly from a web browser** with source code like what's on this page.
## 1. Prerequisites The following example 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.
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
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.js"></script>
<script src="https://unpkg.com/ripple-lib@1.8.0/build/ripple-latest-min.js"></script>
```
<!-- SPELLING_IGNORE: lodash -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.js"></script>
<script src="https://unpkg.com/ripple-lib@1.8.0/build/ripple-latest-min.js"></script>
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. **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.
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.js"></script>
<script src="https://unpkg.com/ripple-lib@1.8.0/build/ripple-latest-min.js"></script>
<!-- JS_EDITOR_START step2 --> <!-- JS_EDITOR_START step2 -->
@@ -97,16 +80,31 @@ const mainnet = new ripple.RippleAPI({
<!-- JS_EDITOR_END --> <!-- JS_EDITOR_END -->
## Suggestions
## 3. Next Steps Try editing the code above to do something different:
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()) - 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()) - 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()) - Convert the `totalDrops` from the response to decimal XRP. [Answer >](javascript:js_interactives.step2.ex_3())
## Setup Steps
This page has the necessary prerequisites already loaded, but you can access the XRP Ledger from **any webpage** if you load [Lodash](https://lodash.com/) and [RippleAPI for JavaScript (ripple-lib)](rippleapi-reference.html) in that page's HTML. For example:
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.js"></script>
<script src="https://unpkg.com/ripple-lib@1.8.0/build/ripple-latest-min.js"></script>
```
<!-- SPELLING_IGNORE: lodash -->
## Further Reading ## Further Reading
<!--{# Followed by bullet points automatically generated by the landing template #}--> When you're ready to move on, continue using the XRP Ledger with these resources:
- [Understand the Concepts](concepts.html) behind the XRP Ledger's design.
- [Use the RippleAPI Reference](rippleapi-reference.html) to see what else you can do.
- [Install `rippled`](install-rippled.html) to participate in the network.
- [Get Testnet XRP](xrp-testnet-faucet.html) to try sending and receiving payments.