{"id":22281619,"url":"https://github.com/horizenofficial/zencashjs","last_synced_at":"2025-04-05T09:05:49.756Z","repository":{"id":42617429,"uuid":"101746794","full_name":"HorizenOfficial/zencashjs","owner":"HorizenOfficial","description":"Dead simple and easy to use JavaScript library for Horizen","archived":false,"fork":false,"pushed_at":"2025-01-22T15:50:14.000Z","size":1231,"stargazers_count":43,"open_issues_count":4,"forks_count":26,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-05T09:05:45.450Z","etag":null,"topics":["javascript","zencash"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HorizenOfficial.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-29T09:59:24.000Z","updated_at":"2025-01-22T15:37:40.000Z","dependencies_parsed_at":"2023-02-01T04:00:50.432Z","dependency_job_id":"28247445-8ec7-4296-b960-f22179d1def3","html_url":"https://github.com/HorizenOfficial/zencashjs","commit_stats":{"total_commits":136,"total_committers":18,"mean_commits":7.555555555555555,"dds":0.6176470588235294,"last_synced_commit":"8de8433e5977a4b7fb3abdb205bb322ae9ece777"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HorizenOfficial%2Fzencashjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HorizenOfficial%2Fzencashjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HorizenOfficial%2Fzencashjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HorizenOfficial%2Fzencashjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HorizenOfficial","download_url":"https://codeload.github.com/HorizenOfficial/zencashjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312077,"owners_count":20918344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","zencash"],"created_at":"2024-12-03T16:19:49.592Z","updated_at":"2025-04-05T09:05:49.710Z","avatar_url":"https://github.com/HorizenOfficial.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zencashjs ![build status](https://api.travis-ci.org/HorizenOfficial/zencashjs.svg?branch=master)\nA javascript library for Node.js. Used in the development of Sphere and other wallets. Implements all non-computationally intensive operations.\n\n#### address.js\n- Create private keys, public keys, and addresses\n- Transform addresses / keys into different formats (WIF)\n\n#### transaction.js\n- Create and sign (non-shielded) transactions (1 input \u0026 multiple inputs)\n- Transaction serialization / deserialization\n\n#### message.js\n- Sign and verify messages\n\n#### address.js\n- Create secret key and transform to a spending key, paying key, or transmission key\n- Viewing key is not yet supported\n\nAddress / keys prefixes for both mainnet and testnet in config.js.\n\nInspired by [pybitcointools](https://github.com/vbuterin/pybitcointools)\n\n### Installation\n`npm install zencashjs`\n\n### Usage\nSee examples below\n\n## Migrating from 1.x to 2.x\nVersion 2 brings sidechain support and compatibility with Zendoo.  Most functionality and example usage remains identical to Version 1, with the exception of the changes listed below:\n\n### `zencashjs.transaction.deserializeTx`\nThis function now takes a third parameter `envPubKeyHash: string`\n```javascript\nfunction deserializeTx (\n   hexStr: string,\n   withPrevScriptPubKey: boolean = false,\n   envPubKeyHash: string = zconfig.mainnet.pubKeyHash\n): TXOBJ {}\n```\n This parameter `envPubKeyHash` is a constant hashed value representing the environment (mainnet/testnet).  These constants are stored on the `zencashjs.config` object.\n\n For example,\n ```javascript\n// Testnet\nconst testnetTxHex = 'fcff...';\n\nzencashjs.transaction.deserializeTx(\n   testnetTxHex,\n   false,\n   zencashjs.config.testnet.pubKeyHash\n);\n\n\n// Mainnet\nconst mainnetTxHex = 'fcff...';\n\nzencashjs.transaction.deserializeTx(\n   mainnetTxHex,\n   false,\n   zencashjs.config.mainnet.pubKeyHash // Could be omitted, as it defaults to mainnet\n);\n ```\n\n### `zencashjs.transaction.createRawTx`\nThis function now takes a fifth optional parameter `vft` to be used for a forward transfer transaction\n```javascript\nfunction createRawTx (\n   history: HISTORY[],\n   recipients: RECIPIENTS[],\n   blockHeight: number,\n   blockHash: string,\n   vft: TXOBJ.vft_ccout\n): TXOBJ {}\n```\n\n### Example forward transfer transaction\n```javascript\n\n// Sending 10 ZEN from address 'ztphoWCQmyJVuNq2L3SLnRgy2Lw5i5a7hxL' to address '8d8137d57eee250bdd0302fcad05243276ba059556165517c3d919331cd5bdc8' on sidechain with sidechain id '1a4d5813b260d0cb456c649b005840e1a1eb6eb2e0f98f3af7d201ea1e95d0b8'\nvar blockHeight = 937649\nvar blockHash = '0002d980065e2bb502a302905ed81229aa467a9502b527a491d7978b970b1ae5'\n\nvar txobj = zencashjs.transaction.createRawTx(\n  [{\n      txid: '087faec93611add81dcf0ec31df934248e63c4abde21ee81d65584c7396feb2b', vout: 0,\n      scriptPubKey: ''\n  }],\n  [{address: 'ztphoWCQmyJVuNq2L3SLnRgy2Lw5i5a7hxL', satoshis: 297799952794}],\n  blockHeight,\n  blockHash,\n  [{\n    scid: \"1a4d5813b260d0cb456c649b005840e1a1eb6eb2e0f98f3af7d201ea1e95d0b8\",\n    n: 0,\n    value: 1000000000,\n    address: \"8d8137d57eee250bdd0302fcad05243276ba059556165517c3d919331cd5bdc8\",\n    mcReturnAddress: \"ztphoWCQmyJVuNq2L3SLnRgy2Lw5i5a7hxL\"\n  }]\n)\n// { locktime: 0,\n//   version: -4,\n//   ins:\n//    [ { output: { hash: '087faec93611add81dcf0ec31df934248e63c4abde21ee81d65584c7396feb2b', vout: 0 },\n//        script: '',\n//        prevScriptPubKey: '',\n//        sequence: 'ffffffff' } ],\n//   outs:\n//    [ { script:\n//         '76a914ec6039c0505e74b8f74fb1e22b77da64d30ce6b388ac20e51a0b978b97d791a427b502957a46aa2912d85e9002a302b52b5e0680d9020003b14e0eb4',\n//        satoshis: 297799952794 } ],\n//   vft_ccout:\n//    [ { scid:\n//         '1a4d5813b260d0cb456c649b005840e1a1eb6eb2e0f98f3af7d201ea1e95d0b8',\n//        n: 0,\n//        value: 1000000000,\n//        address:\n//         '8d8137d57eee250bdd0302fcad05243276ba059556165517c3d919331cd5bdc8',\n//        mcReturnAddress: 'ztphoWCQmyJVuNq2L3SLnRgy2Lw5i5a7hxL' } ],\n//   vsc_ccout: [],\n//   vcsw_ccin: [],\n//   vmbtr_out: [] }\n\nzencashjs.transaction.serializeTx(txobj)\n// fcffffff012beb6f39c78455d681ee21deabc4638e2434f91dc30ecf1dd8ad1136c9ae7f080000000000ffffffff019aa94256450000003f76a914ec6039c0505e74b8f74fb1e22b77da64d30ce6b388ac20e51a0b978b97d791a427b502957a46aa2912d85e9002a302b52b5e0680d9020003b14e0eb400000100ca9a3b00000000c8bdd51c3319d9c3175516569505ba76322405adfc0203dd0b25ee7ed537818db8d0951eea01d2f73a8ff9e0b26eeba1e14058009b646c45cbd060b213584d1aec6039c0505e74b8f74fb1e22b77da64d30ce6b30000000000\n```\n\n### New Transaction Types\n\nZendoo introduces new transaction types related to sidechains.  Therefore, `deserializeTx` will return extra fields if applicable. See the [Zendoo Upgrade Guide](https://downloads.horizen.io/file/web-assets/Zend_to_Zend_oo_Exchanges_v1.4.pdf) for more details on these transaction types.\n\nSee also the updated [TX_OBJ](src/types.js) type declaration.\n\n\u003e Note: `serializeTx` and `createRawTx` do not yet support all the new types (only forward transfers are supported), but will in future releases.\n\n## Version 1\n### Example usage (Transparent address)\n```javascript\nvar zencashjs = require('zencashjs')\n\nvar priv = zencashjs.address.mkPrivKey('chris p. bacon, defender of the guardians')\n// 2c3a48576fe6e8a466e78cd2957c9dc62128135540bbea0685d7c4a23ea35a6c\n\nvar privWIF = zencashjs.address.privKeyToWIF(priv)\n// 5J9mKPd531Tk4A73kKp4iowoi6EvhEp8QSMAVzrZhuzZkdpYbK8\n\nvar pubKey = zencashjs.address.privKeyToPubKey(priv, true) // generate compressed pubKey\n// 038a789e0910b6aa314f63d2cc666bd44fa4b71d7397cb5466902dc594c1a0a0d2\n\nvar zAddr = zencashjs.address.pubKeyToAddr(pubKey)\n// znnjppzJG7ajT7f6Vp1AD6SjgcXBVPA2E6c\n\n// It is imperative that the block used for bip115BlockHeight and bip115BlockHash has a sufficient number of\n// confirmations (recommded values: 150 to 600 blocks older than current BLOCKHEIGHT). If the block used for\n// the replay protection should get orphaned the transaction will be unspendable for at least 52596 blocks.\n// For details on the replay protection please see: https://github.com/bitcoin/bips/blob/master/bip-0115.mediawiki\n\n// To create and sign a raw transaction at BLOCKHEIGHT with BIP115BLOCKHEIGHT and BIP115BLOCKHASH\nconst blockHeight = 450150 // Example of current BLOCKHEIGHT\nconst bip115BlockHeight = blockHeight - 150 // Chaintip - 150 blocks, the block used for the replay protection needs a sufficient number of confirmations\nconst bip115BlockHash = '0000000007844e62d471b966cc5926bd92e56a27d2c6a6ac8f90d34e11d3028d' // Blockhash of block 450000\n\n// If it is unfeasable to get the current BLOCKHEIGHT or transactions are to be signed completely offline\n// use hard coded values for BIP115BLOCKHEIGHT and BIP115BLOCKHASH that are at least 52596 blocks older than the\n// current BLOCKHEIGHT. For example:\nconst bip115BlockHeight = 142091\nconst bip115BlockHash = '00000001cf4e27ce1dd8028408ed0a48edd445ba388170c9468ba0d42fff3052'\n\nvar txobj = zencashjs.transaction.createRawTx(\n  [{\n      txid: '196173ec34d22a52cc689a21d01dd33b633671cbe1141e7e66240c7f3b4ccf7b', vout: 0,\n      scriptPubKey: '76a914da46f44467949ac9321b16402c32bbeede5e3e5f88ac20ebd78933082d25d56a47d471ee5d57793454cf3d2787f77c21f9964b02000000034f2902b4'\n  }],\n  [{address: 'znkz4JE6Y4m8xWoo4ryTnpxwBT5F7vFDgNf', satoshis: 100000}],\n  bip115BlockHeight,\n  bip115BlockHash\n)\n\n// To do a NULL_DATA transaction\n// var txobj = zencashjs.transaction.createRawTx(\n//   [{\n//       txid: '196173ec34d22a52cc689a21d01dd33b633671cbe1141e7e66240c7f3b4ccf7b', vout: 0,\n//       scriptPubKey: '76a914da46f44467949ac9321b16402c32bbeede5e3e5f88ac20ebd78933082d25d56a47d471ee5d57793454cf3d2787f77c21f9964b02000000034f2902b4'\n//   }],\n//   [{address: 'znkz4JE6Y4m8xWoo4ryTnpxwBT5F7vFDgNf', satoshis: 99000},\n//    {address: undefined, data: 'hello world', satoshis: 900}],\n//   bip115BlockHeight,\n//   bip115BlockHash\n// )\n\n// zencashjs.transaction.serializeTx(txobj)\n// 01000000019dd5ae887ce5e354c4cabe75230a439b03e494f36c5e7726cb7385f892a304270000000000ffffffff01a0860100000000003f76a914da46f44467949ac9321b16402c32bbeede5e3e5f88ac205230ff2fd4a08b46c9708138ba45d4ed480aed088402d81dce274ecf01000000030b2b02b400000000\n\nvar tx0 = zencashjs.transaction.signTx(txobj, 0, '2c3a48576fe6e8a466e78cd2957c9dc62128135540bbea0685d7c4a23ea35a6c', true) // The final argument sets the `compressPubKey` boolean. It is `false` by default.\n// zencashjs.transaction.serializeTx(tx0)\n// 01000000017bcf4c3b7f0c24667e1e14e1cb7136633bd31dd0219a68cc522ad234ec736119000000008b483045022100b69baff0eb5570fd8ddda7b180463035d47eb3b1c07a808a68085fd58e9e22b102202eb3983a2137af4f8c3967b3c6c16c024ad952a712ab92b8911a8797f1864d3d0141048a789e0910b6aa314f63d2cc666bd44fa4b71d7397cb5466902dc594c1a0a0d2e4d234528ff87b83f971ab2b12cd2939ff33c7846716827a5b0e8233049d8aadffffffff01a0860100000000003f76a914da46f44467949ac9321b16402c32bbeede5e3e5f88ac205230ff2fd4a08b46c9708138ba45d4ed480aed088402d81dce274ecf01000000030b2b02b400000000\n\n// You can now do zen-cli sendrawtransaction `SERIALIZED_TRANSACTION`\n\n// To serialize and deserialize an unsigned raw transaction for signing on a separate machine, 'prevScriptPubKey' can be\n// encoded in the raw transaction by passing 'true' as a second optional parameter to serializeTx/deserializeTx.\n// Take note that the final signed transaction has to be serialized with serializeTx(tx, false).\n\n// Default serializeTx/deserializeTx setting 'prevScriptPubKey' to '':\nzencashjs.transaction.deserializeTx(zencashjs.transaction.serializeTx(txobj))\n// {\n//   version: 1,\n//   locktime: 0,\n//   ins: [\n//     {\n//       output: [Object],\n//       script: '',\n//       sequence: 'ffffffff',\n//       prevScriptPubKey: ''\n//     }\n//   ],\n//   outs: [\n//     {\n//       satoshis: 100000,\n//       script: '76a914da46f44467949ac9321b16402c32bbeede5e3e5f88ac200206260143838b5ff52dc2eb7b4b8099d4e4c99dc3ef19794289a2cd4c10070000b4'\n//     }\n//   ]\n// }\n\n// serializeTx/deserializeTx with 2nd argument 'true' keeping 'prevScriptPubKey':\nzencashjs.transaction.deserializeTx(zencashjs.transaction.serializeTx(txobj, true), true)\n// {\n//   version: 1,\n//   locktime: 0,\n//   ins: [\n//     {\n//       output: [Object],\n//       script: '',\n//       sequence: 'ffffffff',\n//       prevScriptPubKey: '76a914da46f44467949ac9321b16402c32bbeede5e3e5f88ac20ebd78933082d25d56a47d471ee5d57793454cf3d2787f77c21f9964b02000000034f2902b4'\n//     }\n//   ],\n//   outs: [\n//     {\n//       satoshis: 100000,\n//       script: '76a914da46f44467949ac9321b16402c32bbeede5e3e5f88ac200206260143838b5ff52dc2eb7b4b8099d4e4c99dc3ef19794289a2cd4c10070000b4'\n//     }\n//   ]\n// }\n```\n\n### Example Usage (Multi-sig)\n```javascript\nvar zencashjs = require('zencashjs')\n\n// Private keys in wallet import format\nvar privKeysWIF = ['L2sjwCsdZQmckKkTKGDqhKcWtbe3EU2FL4N1YHpD2SC1GhHRhqxF', 'L5bpskJWAGGWR1GA9SJkCQ2ndHkezqm8GuoWaBesrrwnsa1roSN6',\n'KxvE58rxEwckkCjemDVdMDp7wzgosnyX1oyjzWmrcAVpV7EaZdSP']\n\n// Converts Private keys in WIF to its original form\nvar privKeys = privKeysWIF.map((x) =\u003e zencashjs.address.WIFToPrivKey(x))\n// [ 'a8c04b7209d16606532bbbd158420bd7dcde415db5ff3ec269f9c3cb327661d6', 'fa137ed90f4876b7154884caf2d889de9ea9a838e1c938380c2de25d4de613f7', '32ae14a84a5f4e0ec804daef223cc7f48412abde76f78a2d2df463bb065d6617' ]\n\n// Get public keys (NOT address)\nvar pubKeys = privKeys.map((x) =\u003e zencashjs.address.privKeyToPubKey(x, true))\n// [ '03519842d08ea56a635bfa8dd617b8e33f0426530d8e201107dd9a6af9493bd487', '02d3ac8c0cb7b99a26cd66269a312afe4e0a621579dfe8b33e29c597a32a616544', '02696187262f522cf1fa2c30c5cd6853c4a6c51ad5ba418abb4e3898dbc5a93d2e' ]\n\n// Make a 2-of-3 multisig address\n// NOTE: The redeemScript determines the order of your signatures for multisign\n//       E.g. I made an address with pk1, pk3, pk2 for a 2-of-3 multisig\n//            Valid Sigs: [pk1, pk2] OR [pk3, pk2] OR [pk1, pk3] ...\n//            Invalid Sigs: [pk3, pk1], [pk2, pk1]\nvar redeemScript = zencashjs.address.mkMultiSigRedeemScript(pubKeys, 2, 3)\n// 522103519842d08ea56a635bfa8dd617b8e33f0426530d8e201107dd9a6af9493bd4872102d3ac8c0cb7b99a26cd66269a312afe4e0a621579dfe8b33e29c597a32a6165442102696187262f522cf1fa2c30c5cd6853c4a6c51ad5ba418abb4e3898dbc5a93d2e53ae\n\nvar multiSigAddress = zencashjs.address.multiSigRSToAddress(redeemScript)\n// zsmSCni8GXoCdTGqUfn26QJVGh6rpaFs17T\n\n// It is imperative that the block used for bip115BlockHeight and bip115BlockHash has a sufficient number of\n// confirmations (recommded values: 150 to 600 blocks older than current BLOCKHEIGHT). If the block used for\n// the replay protection should get orphaned the transaction will be unspendable for at least 52596 blocks.\n// For details on the replay protection please see: https://github.com/bitcoin/bips/blob/master/bip-0115.mediawiki\n\n// To create and sign a raw transaction at BLOCKHEIGHT with BIP115BLOCKHEIGHT and BIP115BLOCKHASH\nconst blockHeight = 450150 // Example of current BLOCKHEIGHT\nconst bip115BlockHeight = blockHeight - 150 // Chaintip - 150 blocks, the block used for the replay protection needs a sufficient number of confirmations\nconst bip115BlockHash = '0000000007844e62d471b966cc5926bd92e56a27d2c6a6ac8f90d34e11d3028d' // Blockhash of block 450000\n\n// If it is unfeasable to get the current BLOCKHEIGHT or transactions are to be signed completely offline\n// use hard coded values for BIP115BLOCKHEIGHT and BIP115BLOCKHASH that are at least 52596 blocks older than the\n// current BLOCKHEIGHT. For example:\nconst bip115BlockHeight = 142091\nconst bip115BlockHash = '00000001cf4e27ce1dd8028408ed0a48edd445ba388170c9468ba0d42fff3052'\n\nvar txobj = zencashjs.transaction.createRawTx(\n  [{\n      txid: 'f5f324064de9caab9353674c59f1c3987ca997bf5882a41a722686883e089581', vout: 0,\n      scriptPubKey: '' // Don't need script pub key since we'll be using redeemScript to sign\n  }],\n  [{address: 'zneng6nRqTrqTKfjYAqXT86HWtk96ftPjtX', satoshis: 10000}],\n  bip115BlockHeight,\n  bip115BlockHash\n)\n\n// Prepare our signatures for mutli-sig\nvar sig1 = zencashjs.transaction.multiSign(txobj, 0, privKeys[0], redeemScript)\n// 3045022100c65ec438dc13028b1328a0f8426e1970ef202cba168772fe9d91d141e3020413022021b038c2098c29014aa7feef1624c3d9e4035ca960791f3bbe256df9f008038d01\n\nvar sig2 = zencashjs.transaction.multiSign(txobj, 0, privKeys[1], redeemScript)\n// 3045022100db1f423fe11bf06c9c97692e8086f5743653cad289e3a1c085ae656847ffb9d10220063c103d8c7c54597b055106ab70a45a2254c63435b64375a966c002f85d141901\n\n// NOTE: If you wanna send the tx to someone to get their signature, you can serialize the txObj and send it over in bytes, they can also deserialize it: e.g.\n// var txBytes = zencashjs.transaction.serializeTx(txobj)\n// var txObj = zencashjs.transaction.deserializeTx(txBytes)\n\n// Apply the signatures to the transaction object\nvar tx0 = zencashjs.transaction.applyMultiSignatures(txobj, 0, [sig1, sig2], redeemScript)\n\n// Serialize the transaction\nvar serializedTx = zencashjs.transaction.serializeTx(tx0)\n\n// You can now send the serializedTx using the RPC command sendrawtransaction or through an API like insight\n```\n\n### Example usage (Private address)\n```javascript\nvar zencashjs = require('zencashjs')\n\nvar z_secretKey = zencashjs.zaddress.mkZSecretKey('Z pigs likes to snooze. ZZZZ')\n// 0c10a61a669bc4a51000c4c74ff58c151912889891089f7bae5e4994a73af7a8\n\n// Spending key (this is what you import into your wallet)\nvar spendingKey = zencashjs.zaddress.zSecretKeyToSpendingKey(z_secretKey)\n// SKxtHJsneoLByrwME9Nh4cd4AvYLNK9jJkAnB3AHNW794udD1qpx\n\n// Paying key\nvar a_pk = zencashjs.zaddress.zSecretKeyToPayingKey(z_secretKey)\n// 927a3819627247c0dd39102ec5449fc6fc952e242aad08615df9f26718912e27\n\n// Transmission key\nvar pk_enc = zencashjs.zaddress.zSecretKeyToTransmissionKey(z_secretKey)\n// 22d666c34ababacf6a9a4a752cc7870b505b64e85638aa45d23ac32992397960\n\nvar Zaddress = zencashjs.zaddress.mkZAddress(a_pk, pk_enc)\n// zcTPZR8Hqz2ZcStwMJju9L4VBHW7YWmNyL6tDAT4eVmzmxLaG7h4QmqUXfmrjz8twizH4piDGiRYJRZ1bhHhT5gFL6TKsQZ\n```\n\n### Example usage (Sign/Verify message)\n```javascript\nvar zencashjs = require('zencashjs')\n\nvar priv = zencashjs.address.mkPrivKey('chris p. bacon, defender of the guardians')\n// 2c3a48576fe6e8a466e78cd2957c9dc62128135540bbea0685d7c4a23ea35a6c\n\nvar privWIF = zencashjs.address.privKeyToWIF(priv)\n// 5J9mKPd531Tk4A73kKp4iowoi6EvhEp8QSMAVzrZhuzZkdpYbK8\n\nvar pubKey = zencashjs.address.privKeyToPubKey(priv, true) // generate compressed pubKey\n// 038a789e0910b6aa314f63d2cc666bd44fa4b71d7397cb5466902dc594c1a0a0d2\n\nvar zAddr = zencashjs.address.pubKeyToAddr(pubKey)\n// znnjppzJG7ajT7f6Vp1AD6SjgcXBVPA2E6c\n\nvar message = 'ciao'\n\n/**\n * Will sign a message with a given zen private key.\n *\n * @param {string} message - The message to be signed\n * @param {string} privateKey - A private key\n * @param {Boolean} compressed\n * @returns {Buffer} The signature\n */\nvar signature = zencashjs.message.sign(message, priv, true)\n// signature.toString('base64')\n// IC7SPUlfyjKjG7hrrPWc6WTsm79ksjHAYXSFmjlGwAL9SSvAIvpYmOm3U5CzG2k0QBxDYuzpltw+UAET3J8e7Gg=\n\n/**\n * Validate a signature against a given zend address.\n *\n * @param {String} message - the message to verify\n * @param {String} zenAddress - A zen address\n * @param {String|Buffer} signature - A base64 encoded compact signature\n * @returns {Boolean} true if the signature is valid\n */\nvar verification = zencashjs.message.verify(message, zAddr, signature)\n // true\n```\n\n# Development guide (more to come..)\n```bash\n# src is where the source code resides.\n# lib is where the transpiled code resides in.\n# edit src if you wanna make a PR\ngit clone https://github.com/HorizenOfficial/zencashjs.git\ncd zencashjs\nnpm install\nnpm run [dev | build | test]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhorizenofficial%2Fzencashjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhorizenofficial%2Fzencashjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhorizenofficial%2Fzencashjs/lists"}