Skip to content

Sign and broadcast vote

This recipe is intentionally isolated from the read-only learning path because it is side-effectful.

A vote broadcast changes Layer 1 state. Do not copy a signing/broadcast snippet into an application until the authority, key handling and confirmation flow are understood.

Safety

Safety level: side-effectful.

This page does not provide a runnable live example yet. Phase 4 keeps side-effectful examples isolated and non-executable until the maintainer approves a dedicated broadcast safety pattern.

Read first:

Conceptual flow

text
1. Read target post/account data.
2. Build or inspect the vote operation.
3. Confirm voter, author, permlink and weight with the user.
4. Validate that the key satisfies the required authority.
5. Sign and broadcast once.
6. If the network response is ambiguous, inspect chain state before retrying.

Non-runnable sketch

ts
// Sketch only. Do not paste into production without your own key handling.
import { Client, PrivateKey } from '@beblurt/dblurt';

const client = new Client(rpcList);
const key = PrivateKey.fromString(process.env.BLURT_POSTING_KEY);

await client.broadcast.vote(
  { voter: 'alice', author: 'bob', permlink: 'post-permlink', weight: 10000 },
  key
);

Why no executable example yet?

A safe executable broadcast example needs decisions that are larger than a recipe page:

  • environment-variable names;
  • test account expectations;
  • whether to use testnet or mainnet;
  • duplicate-vote handling;
  • key validation before broadcast;
  • chain-state verification after broadcast;
  • docs-check behavior so CI never performs side effects.

Until those are approved, broadcast documentation should remain conceptual and safety-gated.

Related: Accounts and authorities, Broadcast safely, Handle retryable errors.