ruigomeseu / bitcoin-address-validation Goto Github PK
View Code? Open in Web Editor NEWValidate Bitcoin addresses - P2WSH, P2WPKH, P2PKH, P2SH and P2TR
License: MIT License
Validate Bitcoin addresses - P2WSH, P2WPKH, P2PKH, P2SH and P2TR
License: MIT License
validate('bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4');
bash: syntax error near unexpected token `'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4''
The same with double quotes
The validation fails when the bech32 address is in capital letters, for example:
Shouldn't both return true?
The browser
field currently points to a UMD bundle:
https://unpkg.com/[email protected]/lib/index.umd.js
Webpack (typically) resolves browser
, module
, or main
, in that order:
https://webpack.js.org/configuration/resolve/#resolve-mainfields
This means most Webpack users are consuming this package as a bundle, instead of a module with dependencies/imports. Notice how BundlePhobia thinks 100% of the package is "Self", instead of showing a breakdown of dependencies:
https://bundlephobia.com/[email protected]
This is undesirable, because if a consumer of this package has any of the same dependencies (base-x
, bech32
, bops
, hash.js
, etc.) required elsewhere in their app, their Webpack build will include them again in the resulting bundle instead of deduping.
Compare that to graphql-react
for example, that does not distribute a browser
bundle:
https://bundlephobia.com/[email protected]
As a general rule, it is an antipattern to distribute a bundle in an npm package; bundling is much better performed by consumers.
It's recommended to add a lock file (package-lock.json
or yarn.lock
for npm
or yarn
respectively) so that you can have more deterministic builds, and prevent supply chain attacks for dependencies or avoid sudden malicious updates to dependencies.
Not sure what your preferred CLI tool is, so I'll let you choose, but I recommend adding one!
I am unable to access my address
Hi,
valid joinmarket bech32 addresses failing validation
example addresses:
bc1qv4rpqxxukmk6rmy5qmmc3cqk2nut3zmw77jzvwzrvk2y28jw0tjs53zt96
bc1qj693pjncwyjznxdwma6sj0vm0puz4xe4jj9fq2
Please check
Thank you
I tried to use your bitcoin address validator, and I noticed that some valid bech32 addresses fail validation. I have included a few samples, the entire list of bech32 test vectors can be found here: https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki
const bitcoinAddressValidation = require("bitcoin-address-validation");
// bech32 test vectors
const addresses = [];
addresses.push('A12UEL5L');
addresses.push('a12uel5l');
addresses.push('an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio1tt5tgs');
addresses.push('abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw');
('11qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc8247j');
addresses.push('split1checkupstagehandshakeupstreamerranterredcaperred2y9e3w');
for(const address of addresses) {
const result = bitcoinAddressValidation(address);
console.log(`${address} => ${result}`);
}
It'd be great if this package had type definitions for typescript users.
Signet is using the same address as testnet, but recognised as a different network. So downstream apps will have to catch signet and cast it as testnet when passing the Network params.
Can Signet network be supported natively?
Great work on the Typescript typings. Would like to publish a new release to npm?
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.