# Coinpred widget: Bitcoin halving countdown (比特币减半倒计时)

> A live countdown to the next Bitcoin halving at block 1,050,000, with block height, blocks left, estimated date and the reward change.

Widget id: `halving` · Live preview and configurator: https://coinpred.com/widgets/#halving · All widgets: https://coinpred.com/widgets/llms.txt

## Embed code (default settings)

```html
<div class="coinpred-widget" data-widget="halving" data-style="countdown" data-lang="en" data-theme="light">
  <a href="https://coinpred.com/widgets/" target="_blank" rel="noopener">Coinpred Bitcoin halving countdown</a>
</div>
<script async src="https://coinpred.com/widgets/v1.js"></script>
```

## Options

Change the data-* attributes on the div. Only these values are supported:

| Attribute | Values | Default | Notes |
|---|---|---|---|
| `data-style` | `countdown` \| `progress` \| `compact` | `countdown` | countdown (Countdown), progress (Progress), compact (Compact) |
| `data-theme` | `light` \| `dark` | `light` |  |
| `data-lang` | `en` \| `zh` | `en` | en (English) or zh (Simplified Chinese) |

## Rules

1. Load the script from coinpred.com, which also provides the data: `<script async src="https://coinpred.com/widgets/v1.js"></script>`.
2. Use the official snippet unchanged: the `<div class="coinpred-widget">` with its `<a>` link to coinpred.com. Do not rebuild the widget with another library.
3. Keep the `<a>` link inside the div visible (no `display:none`, no `rel="nofollow"`); it is the only condition of free use.
4. Load the script once per page. In single-page apps (React, Vue, Next.js…) call `window.CoinpredWidgets.scan()` after rendering new widget divs.
5. Use `data-lang="zh"` for Simplified Chinese sites and `data-theme="dark"` on dark backgrounds. Coin symbols are plain tickers (BTC, not BTCUSDT).

## Where to paste it

### Plain HTML

Paste the snippet inside <body> where the widget should appear, save and reload. With several widgets on one page keep the <script> line once.

### WordPress

Edit the page or post → “+” → Custom HTML block → paste → Update. In the Classic editor switch to the Text tab first; for a sidebar use Appearance → Widgets → Custom HTML.

### Webflow / Wix / Shopify etc.

Add an Embed / Code Block / Custom code / Custom Liquid section, paste the snippet and publish. In Wix, resize the HTML iframe element to the widget height.

### React / Next.js

Render the div with its data attributes and load the script once on the client; after client-side navigation call window.CoinpredWidgets.scan() to mount new widgets. The Next.js App Router needs 'use client'.

```jsx
'use client';
import { useEffect } from 'react';

const SRC = 'https://coinpred.com/widgets/v1.js';
export default function CoinpredWidget() {
  useEffect(() => {
    if (window.CoinpredWidgets) return void window.CoinpredWidgets.scan();
    if (!document.querySelector('script[src="' + SRC + '"]')) {
      const s = document.createElement('script'); s.src = SRC; s.async = true; document.body.appendChild(s);
    }
  }, []);
  return (
    <div className="coinpred-widget" data-widget="halving" data-style="countdown" data-lang="en" data-theme="light">
      <a href="https://coinpred.com/widgets/" target="_blank" rel="noopener">Coinpred Bitcoin halving countdown</a>
    </div>
  );
}
```

### Vue / Nuxt

Put the div in the template and load the script once in onMounted; if it is already loaded call window.CoinpredWidgets.scan().

```vue
<template>
  <div class="coinpred-widget" data-widget="halving" data-style="countdown" data-lang="en" data-theme="light">
    <a href="https://coinpred.com/widgets/" target="_blank" rel="noopener">Coinpred Bitcoin halving countdown</a>
  </div>
</template>

<script setup>
import { onMounted } from 'vue';
const SRC = 'https://coinpred.com/widgets/v1.js';
onMounted(() => {
  if (window.CoinpredWidgets) return window.CoinpredWidgets.scan();
  const s = document.createElement('script'); s.src = SRC; s.async = true; document.body.appendChild(s);
});
</script>
```

## Add it with AI

Copy this prompt into ChatGPT, Claude, Cursor, Copilot or any AI assistant:

```text
Add the “Bitcoin halving countdown” widget from coinpred.com to my site. Docs: https://coinpred.com/widgets/docs/halving.md
My settings: style=countdown, lang=en, theme=light
```

## Data source and method

Block height and recent average block time come from mempool.space (blockstream.info fallback). The next halving is at block 1,050,000, cutting the reward from 3.125 to 1.5625 BTC. The estimate = blocks left × recent average block time, so it moves with block speed.

Data is for information only and is not investment advice.
