Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                ### Interaction

<script src=""></script>
<script src=""></script>

    <input type="text" id="pubkey" placeholder="Public key">
    <pre id="transfers"></pre>


### Description

This pen makes use of [stellar-sdk]( and [@cosmic-plus/loopcall]( to implement a Lumen distribution explorer that has the genesis account for starting point.

### Concepts

- [Lumen distribution]( A process that used to have a [clear mandate](
- [Genesis account]( The first Stellar account, initially holding all Lumens.

### Keypoints

- `GAAZI...CCWN7` is the genesis account. It received 100 billion Lumens at network creation.
- **#transfers** list outgoing payments worth at least one million Lumens.
- Click on **#transfers** destination pubkeys to follow the track.
- `loopcall()` fetches the operation history for **#pubkey** and passes it to `ingest()` on-the-fly.
- `ingest()` filters, formats and displays the records.
- When **#pubkey** changes, `breaker()` returns true & the previous `loopcall()` stops.

### Challenges

- **easy/** Edit this pen to add a **#previous** button that can go back one step at a time until the genesis account.
- **hard/** Edit this pen to let the user to define **#minAmount**, **#maxAmount**, and **#asset**.

_Give it a try by editing the code, and be the first to post a solution on GalacticTalk!_

### Documentation

- [@cosmic-plus/loopcall documentation](
- [stellar-sdk OperationCallBuilder documentation](
- ['Operations for Account' on Stellar laboratory](

### Social

- [Discuss that pen on GalacticTalk](




                // $ npm install stellar-sdk @cosmic-plus/loopcall
// const StellarSdk = require("stellar-sdk")
// const loopcall = require("@cosmic-plus/loopcall")
const $ = document.querySelector.bind(document)

/* Configuration */
const horizon = ""
const server = new StellarSdk.Server(horizon)
const minAmount = 1000000

/* Core */
function iterateOperations (pubkey, filter, breaker)  {
  const callBuilder = server.operations().forAccount(pubkey)
  loopcall(callBuilder, { filter, breaker })

function matchRecord (record) {
  return record.type === "payment"
    && record.asset_type === "native"
    && record.from === $("#pubkey").value
    && record.amount >= minAmount

/* Interface */
function refresh (pubkey) {
  $("#pubkey").value = pubkey
  $("#transfers").innerHTML = ""
  const breaker = () => pubkey !== $("#pubkey").value
  iterateOperations(pubkey, processRecord, breaker)

function processRecord (record) {
  if (!matchRecord(record)) return
  const destination = makeLink(
  const date = record.created_at.substr(0, 10)
  const amount = record.amount.split(".")[0]
  const text = ` | ${date} | ${amount}\n`
  const details = document.createTextNode(text)

function makeLink (pubkey) {
  const a = document.createElement("a")
  a.onclick = () => refresh(pubkey)
  a.textContent = pubkey.substr(0, 5) + "..." + pubkey.substr(-5)
  return a

/* Events */
$("#pubkey").oninput = () => refresh ($("#pubkey").value)

/* Init */