This repository demonstrates how to perform an atomic-like Hedera Token Service (HTS) batch transaction using the Hedera JavaScript SDK. The demo covers:
- Creating three test accounts with automatic token association.
- Creating an NFT (Luxury Watch) and a fungible token (shares).
- Batch-minting the NFT, distributing FT shares, pausing FT transfers, and submitting a topic message atomically.
- Node.js v14+ and npm
- A Hedera Testnet account (operator) with:
- Account ID and private key
git clone https://github.com/hedera-dev/hip-551-batch-transaction-demo.git
cd hip-551-batch-transaction-demo
npm installCreate a .env file in the project root with the following variables:
OPERATOR_ADDRESS=<Your operator account ID>
OPERATOR_KEY=<Your operator private key>node mintFractionalAsset.jsThe script will:
- Create three new test accounts with automatic token association.
- Create an NFT, a fungible token, and a consensus topic.
- Perform a batch transaction that:
- Mints the NFT.
- Distributes shares.
- Pauses transfers.
- Submits an allocation log via a topic message.
- Print transaction statuses and the new account IDs to the console.
mintFractionalAsset.js: Main demo script.accountUtil.js: Utility for creating test accounts.package.json: Project metadata and dependencies..env: Environment variables (should not be committed).
ISC License