> For the complete documentation index, see [llms.txt](https://docs.bv7x.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bv7x.ai/use-the-signal/examples/nodejs.md).

# Node.js

Complete example: sign a message with ethers.js, verify your wallet, and fetch the oracle signal.

***

## Requirements

```bash
npm install ethers
```

***

## Full Example

```javascript
import { ethers } from "ethers";

const WALLET_KEY = "0xYourPrivateKey"; // never commit this
const BASE_URL = "https://bv7x.ai";

async function main() {
  const wallet = new ethers.Wallet(WALLET_KEY);
  const timestamp = Math.floor(Date.now() / 1000);

  // Step 1: Sign verification message
  const message = `Verify BV7X balance: ${wallet.address}:${timestamp}`;
  const signature = await wallet.signMessage(message);

  // Step 2: Verify wallet and get bearer token
  const verifyRes = await fetch(`${BASE_URL}/api/bv7x/oracle/verify`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      wallet: wallet.address,
      signature,
      timestamp,
    }),
  });
  const { token, tier, balance } = await verifyRes.json();
  console.log(`Tier: ${tier}, Balance: ${balance}`);

  // Step 3: Fetch the oracle signal
  const signalRes = await fetch(`${BASE_URL}/api/bv7x/oracle`, {
    headers: { Authorization: `Bearer ${token}` },
  });
  const signal = await signalRes.json();
  console.log(`Signal: ${signal.signal}`);
  console.log(`Direction: ${signal.direction}`);
  console.log(`Confidence: ${signal.confidence}`);
  console.log(`Regime: ${signal.regime}`);
  console.log(`BTC: $${signal.btcPrice.toLocaleString()}`);
}

main().catch(console.error);
```

***

## Output

```
Tier: basic, Balance: 750000000
Signal: SELL
Direction: DOWN
Confidence: 0.615
Regime: BEAR_TREND
BTC: $66,027
```

***

## Notes

* Uses native `fetch` (Node.js 18+). For older versions, use `node-fetch`.
* The private key signs only the verification message. It is never sent to the server.
* The bearer token expires after 30 minutes. Re-run the verify flow to renew.
* For Premium endpoints, hold 1B+ $BV7X.

***

## Next

* [Python Example](/use-the-signal/examples/python.md) -- same flow in Python
* [MCP + Claude](/use-the-signal/examples/mcp-claude.md) -- AI agent integration
