Lightweight SLP validator with pre-broadcast validation and burn protection.
$ npm install slp-validate
The recommended method to use for validation is
ValidatorType1.isValidSlpTxn(). This method can check transaction validity before it is broadcast to the network to prevent accidental burning.
The following examples are provided in the examples directory:
1-validate-tx-rpc-burn-valid-stop.ts: Prevents accidental sending of a valid burn transaction
2-validate-tx-rpc-burn-valid-allow.ts: Allows sending a valid burn transaction
3-validate-txid-rpc.ts: Traditional SLP validate method by txid (offers no extra burn protection).
4-validate-txid-bchd.ts: Similar to example 3, but uses BCHD's gRPC instead of JSON RPC.
5-validate-txid-gs++.ts: Validate more quickly by downloading transactions in bulk from SLP graph search instead of downloading transactions individually via RPC.
$ npm run test
The majority of tests are driven by test vectors located in the slp-unit-test-data repository.
Run differential fuzzing with Electron Cash SLP edition by following the docs in ./fuzzer/README.md.
$ npm run test
Once differential testing is setup, you can see the lines covered by the fuzzer testing for ./lib/slp.ts:
$ cd fuzzer $ ./coverage.sh
- fixed missing index.d.ts file
- added differential fuzzing tests
- added code coverage
- added testing framework for differential fuzzing
- fix missing null check in parseSlpOutputScript
- fixed bug in isValidSlpTxn (issue #4)
- added JSDoc headers to some core methods in validation.ts
- use explicit checking of txn type when parsing SLP message
- fixed missing "unpkg" declaration in package.json
- more ts linting
- (breaking change) renamed MapCache to CacheMap
- (breaking change) removed .ts files from npm pkg, include .d.ts.
- fixed severe security vulnerability in parseSlpOutputScript
- add ts linting to the project
- add example for using gs++ as validation source
- ported validator from slpjs 0.21.3
- store cached transactions as buffer instead of a string
- add max cache size parameters in ValidatorType1 constructor
Thanks to cryptophyl.com for sponsoring the initial effort required to create this library.