RARlib by CORPEGAv0.2

Recursive doginal library for Dogecoin. Inscribed once, importable by any future inscription.
Cross-marketplace: works on doginals.org, doggy.market, and any future indexer that serves inscription content.

Author
CORPEGA · @RARdrc20
Date
May 2026
Status
v0.2 — API expansion + cross-marketplace
License
Public Domain · on-chain forever

What it provides

Quick start — 5 copy-paste examples

1. BOOTSTRAP — how every consumer loads RARlib
Paste this in any inscription's HTML. Replace LIB_ID with this inscription's ID.
const LIB_ID = '<this_inscription_id>';

fetch('/content/' + LIB_ID)
  .then(r => r.text())
  .then(html => {
    const m = html.match(/\/\* RARLIB_CODE_START \*\/([\s\S]*?)\/\* RARLIB_CODE_END \*\//);
    if (!m) throw new Error('RARlib markers not found');
    eval(m[1]);
    main();   // RARlib is now available
  });

function main() {
  // your code here
}
2. EMBED ANY INSCRIPTION
Smart embed — auto-detects content-type, picks <img>, <video>, <audio> or <iframe>.
RARlib.embed('<inscription_id>', document.querySelector('#slot'));
3. GET ENRICHED METADATA
Cached: subsequent calls for the same ID return instantly.
const info = await RARlib.inscription('<inscription_id>');
console.log(info.owner, info.contentType, info.byteSize);
console.log(info.isImage, info.isHtml, info.isVideo);
4. DETECT WALLETS
Sync scan of window.* for available wallet bridges. Connect/sign methods coming in v0.3.
const wallets = RARlib.wallet.detect();
if (wallets.length) {
  console.log('Available:', wallets.map(w => w.name).join(', '));
}
5. FULL SHOWCASE — the v0.1 demo, still supported
All-in-one renderer that builds the canonical "recursive doginal" page. Good for vitrine inscriptions.
RARlib.boot({
  title: 'My Recursive Doginal',
  rektumId: '<any_inscription_id>',
  creator: 'me @myhandle',
  brandless: false   // set true to hide $RAR logo + RARlib mark
});

The recursive pattern, briefly

This file is itself a doginal — a Dogecoin inscription. Its content is permanent and addressable by its inscription ID. Any other inscription can fetch this file via the relative path /content/<libId> and execute its code.

The pattern enables on-chain code reuse: one library inscribed once, used by many.

Each consumer pays only for what's unique to it.

Recursive content embedding on Doge has been pioneered by Billy @thenoderunners, Heimdall @Heimdall_Bull, RoboAI @RoboAI_DRC420, Martin Seeger @MartinSeeger2, Booktoshi, and others. RARlib extends their work with the first JavaScript library pattern — code that registers reusable methods in the consumer's global scope.

Cross-marketplace by design

v0.2 uses relative paths for inscription content. This means RARlib works regardless of which marketplace serves the consumer inscription: doginals.org, doggy.market, or any future indexer. The RARlib.metadata() and RARlib.inscription() methods use the doginals.org API explicitly (since it is the canonical indexer API at this time) and fall back gracefully if unreachable.

Thanks to the dev of Doggy Market for the relative-path tip that made this release possible.

Stability promise

All v0.x methods will keep their signatures across patch versions. New methods may be added; existing ones will not be changed or removed without a major version bump.

Future versions (v0.3, v0.4, …) will be inscribed as new doginals with new IDs. v0.1 and v0.2 remain on-chain forever and can always be loaded by consumers that reference their inscription IDs.

How to use from another inscription

const LIB_ID = '<this_inscription_id>';
const html = await fetch('/content/' + LIB_ID).then(r => r.text());
const m = html.match(/\/\* RARLIB_CODE_START \*\/([\s\S]*?)\/\* RARLIB_CODE_END \*\//);
eval(m[1]);

// Now you can use any of the methods listed above.
RARlib.embed('<some_id>', document.body);