Prerequisites

  • A funded Spark wallet
  • The recipient’s Spark address or identifier
  • Basic understanding of Spark network operations

Receiving Spark Payments

To receive a payment, you’ll need to share your Spark address. For Spark ↔ Spark transfers, we use Spark addresses. The Spark address format is different from the usual Bitcoin address format which starts with “bc1p”:

Address Example: 030a5f818880a5603b73c9869b37d3ac0bf81e243a48c7b653b28bf52c310b3016

Code Sample:

const sparkAddress = await wallet.getSparkAddress();
console.log("Spark address:", sparkAddress);

Sending Spark Payments

Send Bitcoin payments to other Spark users:

const transfer = await wallet.sendSparkTransfer({
  receiverSparkAddress:
    "03e9cd9c3077c97457d44b1eb8f88bb95186c855bfffa247a5404b5bd8cd46229a",
  amountSats: 100,
});

console.log("Transfer:", transfer);

Send Token payments to other Spark users:

const transfer = await wallet.sendSparkTokenTransfer({
  receiverSparkAddress:
    "03e9cd9c3077c97457d44b1eb8f88bb95186c855bfffa247a5404b5bd8cd46229a",
  amountSats: 100,
  tokenPublicKey:
    "03e9cd9c3077c97457d44b1eb8f88bb95186c855bfffa247a5404b5bd8cd46229a",
});

console.log("Transfer:", transfer);

Receiving Spark Payments

Run getBalance() with the forceRefetch option to claim and view the balance.

const balance = await wallet.getBalance(true /* forceRefetch */);
console.log(`Balance:`, balance);

The getBalance() method returns a Promise resolving to an object containing:

  • balance: A bigint representing the total amount in satoshis
  • tokenBalances: A Map of token balances, where each entry contains:
    • balance: A bigint representing the token amount

Features and Benefits

  • Instant settlements
  • Lower fees compared to on-chain transactions
  • Standard pubkey addressing system

Next Steps

After mastering Spark payments, you can:

Need Help?