waves-crypto
Using this library you can easily create and sign binary data for Waves blockchain. It provides all you need on crypto and binary layers. Small and dependency-free.
Includes:
- Address generation
- Address validation
- Key pair generation
- Bytes signature
- Signature validation
- Serialization primitives
Keys and Addresses
const wc = //Mainnet addresswc //3PGMh3vQekpTbvUAiKwdzhWsLaxoSBEcsFJ //Testnet addresswc//3N4Lt6bWndH4yUAkTFge3F93yhT2c2Pmj9z //Public and private keys from seedwc /*{ public: 'HzSnoJKTVwezUBmo2gh9HYq52F1maKBsvv1ZWrZAHyHV', private: '4mmuDf2GQJ6vJrKzVzyKUyGBwv6AfpC5TKpaF3MfEE5w'}*/ //Public onlywc //HzSnoJKTVwezUBmo2gh9HYq52F1maKBsvv1ZWrZAHyHV //Private onlywc //4mmuDf2GQJ6vJrKzVzyKUyGBwv6AfpC5TKpaF3MfEE5w
Address validation
const validateAddress = const validationErrors = // ['Address checksum is invalid.'] //false
Signatures and verification
const wc = const verifySignature signBytes publicKey = wc const seed = 'magicseed'const pubKey = const bytes = Uint8Arrayconst sig = const isValid = //true
Serialization primitives
const wc = const LONG SHORT BYTE STRING OPTION BASE58_STRING LEN = wc //Transfer transaction for 1 wavesconst tx = version: 1 type: 4 recipient: '3P6jpTTGxnVYGKpmaDWjCQWZxadYSdeykMP' amount: 1 * Math fee: 100000 senderPublicKey: wc timestamp: Date assetId: null feeAssetId: null attachment: null const bytes = wc wc // 5FSwfLir7YRavgRjdzs9Hg2KEv2Pu8szmXMgNbkt6BAm9fAJGURzDp6PiN1QhRfXBUYU1xJghzqijFebFA9yFXyp