Address Derivation

Derive Claimr addresses locally when you have Twitter IDs and need offline or batch processing.

import { PublicKey } from '@solana/web3.js';

const CLAIMR = new PublicKey('3FsU2B8R7sP5ih7w2RoxtJEHfvBVeXtM8WwF6rjMbUrT');

function getClaimrAddress(twitterId: string): PublicKey {
  const [pda] = PublicKey.findProgramAddressSync(
    [Buffer.from('claimr'), Buffer.from(twitterId)],
    CLAIMR
  );
  return pda;
}

const address = getClaimrAddress('44196397');

Twitter ID Required

The function accepts numeric Twitter IDs only. Handles are mutable; IDs are permanent.

getClaimrAddress('44196397');   // correct
getClaimrAddress('elonmusk');   // incorrect - produces a different address

To resolve a handle to an ID:

When to Use Local vs API

Scenario
Recommendation

Have a handle, need address

API

Have IDs, need addresses

Local

Need balance information

API

Batch processing

Local

Offline use

Local

Last updated