@iota/bundle-validator

Syntactically validates bundle structure and signatures.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@iota/bundle-validator
1.0.0-beta.304 years ago6 years agoMinified + gzip package size for @iota/bundle-validator in KB

Readme

@iota/bundle-validator
Syntactically validates bundle structure and signatures.

Installation

Install using npm:
npm install @iota/bundle-validator

or using yarn:
yarn add @iota/bundle-validator

API Reference

* [.validateBundleSignatures(bundle)](#module_bundle-validator.validateBundleSignatures)

* [.isBundle(bundle)](#module_bundle-validator.isBundle)

bundle-validator.validateBundleSignatures(bundle)

Summary: Validates the signatures in a given bundle
| Param | Type | Description | | --- | --- | --- | | bundle | Array.<Transaction> | Transaction trytes |
This method takes an array of transaction trytes and checks if the signatures are valid.

Related methods

To get a bundle's transaction trytes from the Tangle, use the getBundle() method.
Returns: boolean - Whether the signatures are valid
Example
let valid = Validator.validateBundleSignatures(bundle);

bundle-validator.isBundle(bundle)

Summary: Validates the structure and contents of a given bundle.
| Param | Type | Description | | --- | --- | --- | | bundle | Array.<Transaction> | Transaction trytes |
This method takes an array of transaction trytes and validates whether they form a valid bundle by checking the following:
  • Addresses in value transactions have a 0 trit at the end, which means they were generated using the Kerl hashing function
  • Transactions in the bundle array are in the same order as their currentIndex field
  • The total value of all transactions in the bundle sums to 0
  • The bundle hash is valid

Related methods

To get a bundle's transaction trytes from the Tangle, use the getBundle() method.
Returns: boolean - bundle - Whether the bundle is valid
Example
let bundle = Validator.isBundle(bundle);