Create Transaction

From Nxtwiki
Jump to: navigation, search

Create Transaction

The following API calls create Nxt transactions using HTTP POST requests. Follow the links for examples and HTTP POST request parameters specific to each call. Refer to the sections below for HTTP POST request parameters and JSON response fields common to all calls that create transactions. Calls in italics are phasing-safe (refer to Get Constants and Create Phasing Poll)

Create Transaction Request

The following HTTP POST parameters are common to all API calls that create transactions:

  • secretPhrase is the secret passphrase of the account (optional, but transaction neither signed nor broadcast if omitted)
  • publicKey is the public key of the account (optional if secretPhrase provided)
  • feeNQT is the fee (in NQT) for the transaction:
    • minimum 1000 NXT for Issue Asset, unless singleton asset is issued, for which the fee is 1 NXT
    • 2 NXT in base fee for Set Alias, with 2 NXT additional fee for each 32 chars of name plus URI total length, after the first 32 chars
    • [25000, 1000, 40] NXT for [3-letter, 4-letter, 5-letter] Issue Currency
    • 40 NXT for re-issue of any currency
    • 10 NXT for a Create Poll, including 20 options and total size of poll name plus poll description plus total option length not exceeding 320 chars. For each option above 20, an additional fee of 1 NXT, and for each 32 chars after 320, an additional fee of 2 NXT.
    • [2, 21] NXT for a [basic, required-minimum-balance] Create Phasing Poll. 1 NXT will be added for each option (answer) beyond 20, and 1 NXT for each 32 bytes of hashedSecret or linkedFullHash fields.
    • 1 NXT for the first 32 bytes of a unencrypted non-prunable message, 1 NXT for each additional 32 bytes
    • 2 NXT for the first 32 bytes of an encrypted non-prunable message, 1 NXT for each additional 32 bytes. The length is measured excluding the nonce and the 16 byte AES initialization vector.
    • 1 NXT for the first 1024 bytes of a prunable message, 0.1 NXT for each additional 1024 prunable bytes
    • 1 NXT for Set Account Info, including 32 chars, with 2 NXT additional fee for each 32 chars
    • 2 NXT for DGS Listing, including 32 chars of name plust description. With 2 NXT additional fee for each 32 chars.
    • 1 NXT for DGS Delivery, including 32 bytes of encrypted goods data (AES initialization bytes and nonce excluded). With 2 NXT additional fee for each 32 bytes.
    • 2 NXT for transactions that make use of referencedTransactionFullHash property when creating a new transaction.
    • 1 NXT otherwise, where 1 NXT = 100000000 NQT
    Note: To calculate the minimum fee automatically, set feeNQT to 0 and broadcast to false. The fee will be returned in the result JSON, under transactionJSON.feeNQT.
  • deadline is the deadline (in minutes) for the transaction to be confirmed, 32767 minutes maximum
  • referencedTransactionFullHash creates a chained transaction, meaning that the current transaction cannot be confirmed unless the referenced transaction is also confirmed (optional)
  • broadcast is set to false to prevent broadcasting the transaction to the network (optional)

Note: An optional arbitrary message can be appended to any transaction by adding message-related parameters as in Send Message.

Note: Any phasing-safe transaction (refer to Create Transaction) can have its execution deferred either conditionally or unconditionally (refer to Create Phasing Poll).

Create Transaction Response

The following JSON response fields are common to all API calls that create transactions:

  • signatureHash (S) is a SHA-256 hash of the transaction signature
  • unsignedTransactionBytes (S) are the unsigned transaction bytes
  • transactionJSON (O) is a transaction object (refer to Get Transaction for details)
  • broadcasted (B) is true if the transaction was broadcast, false otherwise
  • requestProcessingTime (N) is the API request processing time (in millisec)
  • transactionBytes (S) are the signed transaction bytes
  • fullHash (S) is the full hash of the signed transaction
  • transaction (S) is the ID of the newly created transaction