How to send a simple transaction
This recipe demonstrates how to send a transaction using the signAndSendUniqueTransaction
helper function, which
simplifies the process of creating, signing, and sending transactions on the Chromia blockchain.
- JS/TS client
Prerequisites
- Node.js
- FT4 client:
npm install @chromia/ft4
- Postchain client:
npm install postchain-client
Demo script
Key Features
The signAndSendUniqueTransaction
helper function does three things:
- Automatic uniqueness - Adds a
nop
operation with random data to ensure the transaction is unique - Simplified signing - Signs with the provided signature provider or private key
- Transaction receipt - Sends the transaction and returns a receipt with
statusCode
,status
, andtransactionRid
Transaction Status
The helper returns one of the following statuses:
- Waiting - Transaction is pending inclusion
- Rejected - Transaction was rejected by the network
- Confirmed - Transaction was successfully included in a block
- Unknown - Transaction status could not be determined
Learn more
- FT4 client documentation — covers account management and FT4 operations.
- JavaScript/TypeScript client — covers setup, connection, and usage patterns.
- Generic Transaction Protocol (GTX) — understanding GTX transaction structure.