DeHubOpen DeHub

DeHub › Docs

Build a DeHub Mini App — SDK and Manifest

A mini app is a normal website that runs inside DeHub. DeHub draws the header with your app's name and real domain, and your app talks to DeHub through a small SDK. The same app runs on dehub.io and in the DeHub phone app with no changes.

Add the SDK

<script src="https://riftn.com/sdk/miniapp.js"></script>
<script>
  // Hide the splash screen once your first screen is on.
  dehub.ready();

  const { user, client } = await dehub.context;
  if (user) console.log('Hi', user.handle);
</script>

The SDK adds one global, dehub. Every call returns a promise. Outside DeHub, dehub.isInDehub() is false and calls reject, so you can run the same page on its own.

SDK methods

MethodWhat it does
dehub.ready()Hides the splash screen.
dehub.close()Closes your app.
dehub.contextResolves to { user, location, client }. user is { wallet, handle, displayName, avatarUrl } or null when signed out. client has platform (web or mobile), added, locale, theme and safeAreaInsets.
dehub.getCapabilities()The methods this host supports.
dehub.auth.getToken()A signed token proving who the user is, for your server. The first call asks the user to share their identity. See Sign in with DeHub.
dehub.actions.composePost({ text, embedUrl })Opens the DeHub composer with your text and an optional link back into your app (up to 500 characters).
dehub.actions.viewProfile({ handle })Opens a DeHub profile.
dehub.actions.viewPost({ id })Opens a DeHub post by its numeric id.
dehub.actions.openUrl(url)Opens an https link outside your app.
dehub.actions.addApp()Asks the user to add your app, which also allows notifications.
dehub.actions.pay({ amount, memo })Asks the user to pay you in DHB. See Payments.
dehub.haptics.impact(style)A short vibration on phones: light, medium or heavy.
dehub.on(event, fn)Listen for host events. Returns a function that stops listening.

When DeHub refuses a request the promise rejects with an error that has a code: signin (the user is signed out), rejected (the user said no), invalid (bad parameters), rate_limited, busy (another request is open), unsupported or failed.

The manifest: dehub.json

Serve this file at https://your-domain/.well-known/dehub.json. It tells the store what your app is called, which icon to show and who owns it.

{
  "app": {
    "name": "Tip Jar",
    "homeUrl": "https://tipjar.example.com/",
    "iconUrl": "https://tipjar.example.com/icon-1024.png",
    "subtitle": "Say thanks in DHB",
    "description": "A tip jar for creators. One tap, paid straight to the creator's wallet.",
    "category": "finance",
    "tags": ["tips", "creators"],
    "splashBackgroundColor": "#0B0B0B",
    "screenshotUrls": ["https://tipjar.example.com/shot-1.png"],
    "webhookUrl": "https://tipjar.example.com/api/dehub-webhook",
    "permissions": ["wallet", "notifications"]
  },
  "ownership": {
    "address": "0xYourDehubWallet",
    "domain": "tipjar.example.com",
    "signature": "0x…"
  }
}
FieldRules
nameRequired. 32 characters or fewer.
homeUrlRequired. https, on the same domain as the manifest.
iconUrlRequired. https. A 1024×1024 PNG with no transparency.
subtitle30 characters or fewer.
descriptionRecommended. 170 characters or fewer.
categoryRecommended. One of: games, social, finance, utility, productivity, health-fitness, news-media, music, shopping, education, developer-tools, entertainment, art-creativity.
tagsUp to 5. Lowercase letters, digits or dashes, 20 characters each.
screenshotUrlsUp to 3 https images.
splashBackgroundColorA hex colour like #0B0B0B.
webhookUrlhttps. Receives webhook events.
webhookEventsOptional. Any of: tip, follow, mention. Account events for the owner wallet, sent to webhookUrl.
permissionsAny of: wallet, compose, notifications, camera.

Prove you own the domain

The ownership block is your DeHub wallet's signature of this exact message, where the second line is your domain:

dehub mini app ownership
tipjar.example.com

You do not have to sign it by hand. On dehub.io/apps/dev, check your link and press Sign to get a ready-made block to paste. Payments go to the wallet that signed, and only that wallet can update the listing or create a notification key.

Rich cards in the feed

When someone posts your link, DeHub shows a card with a button that opens your app. Add this tag to the page's <head> (the fc:miniapp tag is read too):

<meta name="dehub:miniapp" content='{"version":"1","imageUrl":"https://tipjar.example.com/card-3x2.png","button":{"title":"Open Tip Jar","action":{"url":"https://tipjar.example.com/"}}}'>

Payments in DHB

const { txHash, chainId, amount, receipt } = await dehub.actions.pay({
  amount: 50,          // DHB, whole numbers, up to 1,000,000
  memo: 'Order #1042', // optional, 140 characters
});

// Send `receipt` to your server and verify it there.
await fetch('/api/orders/1042/paid', { method: 'POST', body: receipt });

DeHub shows the amount, your app and your wallet, the user confirms in their wallet, and DeHub checks the transfer on chain (Base or BNB Chain) before answering. The receipt is a signed token with typ: "payment", sub (the payer's wallet), aud (your domain), amount, token, chainId, txHash and memo. Verify it exactly like a sign-in token. Only registered apps with a signed manifest can take payments.

Test mode. When you open your own app on DeHub with the wallet that owns it, payments are simulated: nothing moves on chain, and the receipt and payment webhook carry test: true, chainId: 0 and a txHash starting with test_. Never deliver paid goods for a test receipt in production.

Submitting and review

Reviewers check that the app loads, works on a phone, matches its listing and does not imitate DeHub. Updating your manifest and submitting again updates the listing.

Weekly rewards

Every night DeHub ranks listed apps by real use: signed-in people who come back (55%), weekly users (35%), plus a boost in an app's first 14 days. Every Monday the week's share of the monthly DHB reward pool is split by score. To qualify, an app needs a verified owner wallet and at least 3 returning users. The ranking and past rewards are on dehub.io/apps/dev.

DeHub Blog · dehub.io home