SingleSigTxParams
Transaction parameters for a single-signature origin: the TxParamsBase fields plus the caller's publicKey. It is one side of the TxParams union that every build* function accepts.
Usage
import { buildStake } from '@stacks/bitcoin-staking';
import { Pc, TransactionSigner, broadcastTransaction, fetchNonce } from '@stacks/transactions';
const tx = await buildStake({
signerManager: 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.my-signer-manager',
amountUstx,
numCycles: 6,
startBurnHt,
publicKey, // hex secp256k1 public key of the staker
fee: 10_000n,
nonce: await fetchNonce({ address: stakerAddress, network: 'mainnet' }),
network: 'mainnet',
postConditions: [Pc.principal(stakerAddress).willSendEq(amountUstx).ustxToLock()],
});
new TransactionSigner(tx).signOrigin(stakerPrivateKey);
const result = await broadcastTransaction({ transaction: tx, network: 'mainnet' });Notes
Builders treat the params as single-sig whenever
publicKeyis defined, and build a P2PKH spending condition from it.The builder returns an unsigned transaction. Sign it with the private key for
publicKey, for example with TransactionSigner.A transaction ID from broadcastTransaction confirms submission, not success. A failed pox-5 assert is mined as
abort_by_responsewith an(err uN)result, which parsePox5Error reads.
Definition
Properties
publicKey
string
Hex-encoded secp256k1 public key of the origin, compressed or uncompressed
numSignatures
never
Must be absent
fee, nonce, network, postConditions and postConditionMode come from TxParamsBase.
Was this helpful?