@iota/bundle-validator
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta.30 • Public • Published

@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

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);

Package Sidebar

Install

npm i @iota/bundle-validator

Weekly Downloads

262

Version

1.0.0-beta.30

License

MIT

Unpacked Size

116 kB

Total Files

36

Last publish

Collaborators

  • tuditi
  • msarcevic
  • braniota
  • lmoe
  • domschiener
  • lexerr
  • martyniota
  • nothingismagick
  • laumair
  • iota_ci
  • rubenkoch
  • brord