Skip to content

feat(sdk-coin-kaspa): implement Kaspa SDK module#8513

Draft
mohd-kashif wants to merge 1 commit intomasterfrom
feat/kaspa/pr2-sdk-module
Draft

feat(sdk-coin-kaspa): implement Kaspa SDK module#8513
mohd-kashif wants to merge 1 commit intomasterfrom
feat/kaspa/pr2-sdk-module

Conversation

@mohd-kashif
Copy link
Copy Markdown
Contributor

  • Kaspa coin class (UTXO, Schnorr/secp256k1, 8 decimals / sompi)
  • TransactionBuilder + TransactionBuilderFactory
  • KeyPair (Secp256k1ExtendedKeyPair, kaspa bech32 address derivation)
  • Transaction with Blake2b-256 sighash and Schnorr signatures
  • Utils: kaspa/kaspatest bech32 address validation
  • Full test suite: keyPair, transaction, builder, utils, coin, transactionFlow tests
  • .mocharc.yml and eslint config

Jira: CECHO-388

@manojkumar138 manojkumar138 force-pushed the feat/kaspa/pr1-statics branch from eb84b72 to 612ae7d Compare April 15, 2026 08:21
@mohd-kashif mohd-kashif changed the base branch from feat/kaspa/pr1-statics to master April 16, 2026 05:54
@mohd-kashif mohd-kashif force-pushed the feat/kaspa/pr2-sdk-module branch from 253f21e to 939f666 Compare April 16, 2026 05:55
- Kaspa coin class (UTXO, Schnorr/secp256k1, 8 decimals / sompi)
- TransactionBuilder + TransactionBuilderFactory
- KeyPair (Secp256k1ExtendedKeyPair, kaspa bech32 address derivation)
- Transaction with Blake2b-256 sighash and Schnorr signatures
- Utils: kaspa/kaspatest bech32 address validation
- Full test suite: keyPair, transaction, builder, utils, coin, transactionFlow tests
- .mocharc.yml and eslint config

Jira: CECHO-388
@mohd-kashif mohd-kashif force-pushed the feat/kaspa/pr2-sdk-module branch from 939f666 to ab449e0 Compare April 16, 2026 06:08
@mohd-kashif mohd-kashif self-assigned this Apr 16, 2026
Comment on lines +22 to +24
export const MAINNET_RPC_URL = 'mainnet.kaspa.green';
export const TESTNET10_RPC_URL = 'testnet-10.kaspa.green';
export const TESTNET11_RPC_URL = 'testnet-11.kaspa.green';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused constants. Also, why are we storing RPC urls as constants?

export const VERSION_SCRIPT = 8; // P2SH

// Decimals: 1 KASPA = 100_000_000 sompi (8 decimal places)
export const DECIMALS = 8;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not fetch this from statics. There should be a single source of truth for this.

Comment on lines +49 to +65
recordKeysFromPrivateKey(prv: string): void {
if (!isValidPrivateKey(prv)) {
throw new Error('Unsupported private key');
}
if (isValidXprv(prv)) {
this.hdNode = bip32.fromBase58(prv);
} else {
this.keyPair = ECPair.fromPrivateKey(Buffer.from(prv.slice(0, 64), 'hex'));
}
}

/**
* Build an ECPair from a public key or extended public key.
*
* @param {string} pub A raw public key
*/
recordKeysFromPublicKey(pub: string): void {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this different from the implementation in base class - Secp256k1ExtendedKeyPair


/** @inheritDoc */
protected signImplementation({ key }: BaseKey): BaseTransaction {
return this._transaction;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we call the sign method of transaction here.

* Parse a Kaspa transaction from prebuild.
*/
async parseTransaction(params: ParseTransactionOptions): Promise<ParsedTransaction> {
return {};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this returning empty object

import { BaseCoin as StaticsBaseCoin } from '@bitgo/statics';
import { Kaspa } from './kaspa';

export class Tkaspa extends Kaspa {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is not adding any functionality. Can be removed.

* Kaspa transaction sighash computation.
*
* Based on the Kaspa BIP-143-like sighash specification:
* https://github.com/kaspanet/docs/blob/main/Specs/BIP143-like%20SigHashes.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File not found

@parasgarg-bitgo
Copy link
Copy Markdown
Contributor

If Kaspa follows UTXO model, why are we not extending abstract-UTXO module for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants