Scripts to exercise the new features introduced in Epoch 3.4 on Stacks testnet, covering:
- SIP-039 (Clarity 5) — fixes to known Clarity issues
- SIP-040 — improved post-conditions (
Originatormode,MAY SENDNFT condition) - SIP-042 — removal of
at-block
npm install
export STX_PRIVATE_KEY=<your-testnet-private-key-hex>You can generate a new key with:
node -e "
const { makeRandomPrivKey, privateKeyToHex, getAddressFromPrivateKey } = require('@stacks/transactions');
const { STACKS_TESTNET } = require('@stacks/network');
const sk = makeRandomPrivKey();
console.log('Private key:', privateKeyToHex(sk));
console.log('Testnet address:', getAddressFromPrivateKey(sk, STACKS_TESTNET));
"Fund the address with testnet STX before running.
| Script | Feature | Expected |
|---|---|---|
01-trait-same-contract.js |
Use a trait defined in the same contract | Deploy succeeds |
02-contract-call-to-constant.js |
contract-call? targeting a constant |
Deploy + call succeed |
03-from-consensus-buff-empty.js |
from-consensus-buff? with empty buffer |
Returns none (no crash) |
05-stack-depth-128.js |
100-deep function call chain (old limit was 64) | Deploy + call succeed |
08-secp256r1-verify.js |
secp256r1-verify no longer double-hashes (deploys Clarity 4 + 5) |
C4: false, C5: true |
| Script | Feature | Expected |
|---|---|---|
06-originator-postcondition.js |
Originator mode (3 scenarios) |
Covered send: success; overspend: abort; contract send w/o pc: success |
07-nft-may-send.js |
MaybeSent post-condition (NFT not sent + NFT sent) |
Both succeed |
| Script | Feature | Expected |
|---|---|---|
04-at-block-removed.js |
Deploy Clarity 5 contract using at-block |
Deploy fails (fee collected) |
Each script deploys the necessary contracts, waits for confirmation (up to 3 minutes), and then calls the deployed functions. Run them in order:
node 01-trait-same-contract.js
node 02-contract-call-to-constant.js
node 03-from-consensus-buff-empty.js
node 04-at-block-removed.js
node 05-stack-depth-128.js
node 06-originator-postcondition.js
node 07-nft-may-send.js
node 08-secp256r1-verify.js| Env Var | Description | Default |
|---|---|---|
STX_PRIVATE_KEY |
Hex-encoded testnet private key (required) | — |
STX_API_URL |
Stacks API endpoint | https://api.testnet.hiro.so |