Looks like the mainnet address with a testnet prefix and a missing zero, probably a copy paste error. More details:
The @example block on postConditionToHex uses the address ST00000000000000000002Q6VF78, which is not a valid c32check address. Copying the example as written throws Invalid c32check string: checksum mismatch.
Location: packages/transactions/src/postcondition.ts — the JSDoc block immediately above export function postConditionToHex.
- const hex = postConditionToHex({
- type: 'stx-postcondition',
- address: 'ST00000000000000000002Q6VF78', // <- invalid
- condition: 'eq',
- amount: '1000000000000000000',
- });
Why it is invalid
The string is the mainnet burn address suffix (2Q6VF78) carrying a testnet ST prefix, with one zero dropped. It is 28 characters; every valid Stacks address is 29.
Decoding it yields version byte 26 (T, testnet single-sig) with an all-zero hash160, which requires checksum 954e1051. The string instead carries ae6dbce8, the checksum for version byte 22 (P, mainnet). So it fails validation on every network.
Reproduced against the published package:
@stacks/transactions version: 7.6.0
SP000000000000000000002Q6VF78 -> OK 0002160000000000000000000000000000000000000000010de0b6b3a7640000
ST00000000000000000002Q6VF78 -> THROWS Invalid c32check string: checksum mismatch
ST000000000000000000002AMW42H -> OK 00021a0000000000000000000000000000000000000000010de0b6b3a7640000
Also confirmed independently with c32check@2.0.0 (c32addressDecode) and with a hand-rolled c32check decode.
Suggested fix
Use SP000000000000000000002Q6VF78, which is the canonical mainnet burn address and is already what the sibling fromHex JSDoc in packages/transactions/src/pc.ts uses. That makes the two examples consistent.
If a testnet address is preferred for this example, the correct canonical testnet burn address is ST000000000000000000002AMW42H.
Looks like the mainnet address with a testnet prefix and a missing zero, probably a copy paste error. More details:
The @example block on postConditionToHex uses the address ST00000000000000000002Q6VF78, which is not a valid c32check address. Copying the example as written throws Invalid c32check string: checksum mismatch.
Location: packages/transactions/src/postcondition.ts — the JSDoc block immediately above export function postConditionToHex.
Why it is invalid
The string is the mainnet burn address suffix (2Q6VF78) carrying a testnet ST prefix, with one zero dropped. It is 28 characters; every valid Stacks address is 29.
Decoding it yields version byte 26 (T, testnet single-sig) with an all-zero hash160, which requires checksum 954e1051. The string instead carries ae6dbce8, the checksum for version byte 22 (P, mainnet). So it fails validation on every network.
Reproduced against the published package:
@stacks/transactions version: 7.6.0
SP000000000000000000002Q6VF78 -> OK 0002160000000000000000000000000000000000000000010de0b6b3a7640000
ST00000000000000000002Q6VF78 -> THROWS Invalid c32check string: checksum mismatch
ST000000000000000000002AMW42H -> OK 00021a0000000000000000000000000000000000000000010de0b6b3a7640000
Also confirmed independently with c32check@2.0.0 (c32addressDecode) and with a hand-rolled c32check decode.
Suggested fix
Use SP000000000000000000002Q6VF78, which is the canonical mainnet burn address and is already what the sibling fromHex JSDoc in packages/transactions/src/pc.ts uses. That makes the two examples consistent.
If a testnet address is preferred for this example, the correct canonical testnet burn address is ST000000000000000000002AMW42H.