{"id":19291757,"url":"https://github.com/hirosystems/stacks-encoding-native-js","last_synced_at":"2025-04-22T06:31:45.619Z","repository":{"id":39581601,"uuid":"463637960","full_name":"hirosystems/stacks-encoding-native-js","owner":"hirosystems","description":"Encoding \u0026 decoding functions for the Stacks blockchain exposed as a fast native Node.js addon","archived":false,"fork":false,"pushed_at":"2024-12-10T10:58:16.000Z","size":6000,"stargazers_count":7,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-15T21:43:55.182Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hirosystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-02-25T18:32:54.000Z","updated_at":"2024-12-10T17:15:46.000Z","dependencies_parsed_at":"2024-07-31T18:48:40.367Z","dependency_job_id":null,"html_url":"https://github.com/hirosystems/stacks-encoding-native-js","commit_stats":{"total_commits":182,"total_committers":1,"mean_commits":182.0,"dds":0.0,"last_synced_commit":"4e3cdb58a75e16d3b6ca3ec5017f68c8e6e47f30"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirosystems%2Fstacks-encoding-native-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirosystems%2Fstacks-encoding-native-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirosystems%2Fstacks-encoding-native-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hirosystems%2Fstacks-encoding-native-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hirosystems","download_url":"https://codeload.github.com/hirosystems/stacks-encoding-native-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250183244,"owners_count":21388682,"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":[],"created_at":"2024-11-09T22:27:47.075Z","updated_at":"2025-04-22T06:31:45.218Z","avatar_url":"https://github.com/hirosystems.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stacks-encoding-native-js\n\n[![npm version](https://badge.fury.io/js/stacks-encoding-native-js.svg)](https://www.npmjs.com/package/stacks-encoding-native-js)\n[![ci](https://github.com/hirosystems/stacks-encoding-native-js/actions/workflows/ci.yml/badge.svg)](https://github.com/hirosystems/stacks-encoding-native-js/actions/workflows/ci.yml)\n\n`stacks-encoding-native-js` is a Node.js [native addon](https://nodejs.org/api/addons.html) library written in Rust, which provides functions for decoding binary/wire formats used in the Stacks blockchain. Features include Clarity values, transactions, post-conditions, Stacks and Bitcoin addresses, and more. \n\nVarious ASM/SIMD optimizations are used in areas which are prone to causing CPU bottlenecks when used in hot paths, e.g. decoding raw Clarity values on the fly.\n\n_This project was bootstrapped by [create-neon](https://www.npmjs.com/package/create-neon)._\n\n### Runtime Support\n* Node.js v16+\n\n### Platform Support\n\n* Linux (glibc) x86_64\n* Linux (glibc) aarch64\n* Linux (musl) x86_64\n* Linux (musl) aarch64\n* MacOS x86_64\n* MacOS aarch64 (Apple Silicon M1)\n* Windows x86_64\n\n## Installation and Usage\n\n```shell\nnpm install stacks-encoding-native-js\n```\n\n### Decoding serialized Clarity values\n_Example Clarity value:_\n\u003cdetails\u003e\n\u003csummary\u003eExpand\u003c/summary\u003e\n\n```clar\n(tuple \n  (active true) \n  (address 'SPA2MZWV9N67TBYVWTE0PSSKMJ2F6YXW7CBE6YPW) \n  (alias \"Alice\") \n  (balance u2000) \n  (ping (ok 250)) \n  (public_key (some 0x02d4dada83bff981f0cb7ebafcfc6fc7cb5e078b9ee2302a93aae19fb90f872e58)) \n  (tags (list u\"contributor\" u\"og \\u{e2ad90}\" u\"clarity\"))\n)\n```\n\u003c/details\u003e\n\n#### Decode serialized Clarity value to repr string\n```ts\nimport * as assert from 'node:assert';\nimport { decodeClarityValueToRepr } from 'stacks-encoding-native-js';\n\n// Serialized hex string of the example Clarity value (0x-prefix optional, Buffer / Uint8Array also accepted)\nconst hex = '0x0c00000007066163746976650307616464726573730516142a7f9b4d4c7d2fdbe69c0b6733a484f37bbc3b05616c6961730d00000005416c6963650762616c616e636501000000000000000000000000000007d00470696e670700000000000000000000000000000000fa0a7075626c69635f6b65790a020000002102d4dada83bff981f0cb7ebafcfc6fc7cb5e078b9ee2302a93aae19fb90f872e5804746167730b000000030e0000000b636f6e7472696275746f720e000000066f6720e2ad900e00000007636c6172697479';\n\nconst reprStr = decodeClarityValueToRepr(hex);\n\nassert.strictEqual(\n  reprStr, \n  `(tuple (active true) (address 'SPA2MZWV9N67TBYVWTE0PSSKMJ2F6YXW7CBE6YPW) (alias \"Alice\") (balance u2000) (ping (ok 250)) (public_key (some 0x02d4dada83bff981f0cb7ebafcfc6fc7cb5e078b9ee2302a93aae19fb90f872e58)) (tags (list u\"contributor\" u\"og \\\\u{e2ad90}\" u\"clarity\")))`\n);\n```\n\n#### Decode serialized Clarity value to object\n```ts\nimport * as assert from 'node:assert';\nimport { decodeClarityValue } from 'stacks-encoding-native-js';\n\n// Serialized hex string of the example Clarity value (0x-prefix optional, Buffer / Uint8Array also accepted)\nconst hex = '0x0c00000007066163746976650307616464726573730516142a7f9b4d4c7d2fdbe69c0b6733a484f37bbc3b05616c6961730d00000005416c6963650762616c616e636501000000000000000000000000000007d00470696e670700000000000000000000000000000000fa0a7075626c69635f6b65790a020000002102d4dada83bff981f0cb7ebafcfc6fc7cb5e078b9ee2302a93aae19fb90f872e5804746167730b000000030e0000000b636f6e7472696275746f720e000000066f6720e2ad900e00000007636c6172697479';\n\n// Decode into JSON object\nconst decoded = decodeClarityValue(hex);\n```\n\nDecoded Clarity value output result:\n\n\u003cdetails\u003e\n\u003csummary\u003eExpand\u003c/summary\u003e\n\n```ts\n// Result object\nassert.deepStrictEqual(decoded, {\n  repr: `(tuple (active true) (address 'SPA2MZWV9N67TBYVWTE0PSSKMJ2F6YXW7CBE6YPW) (alias \"Alice\") (balance u2000) (ping (ok 250)) (public_key (some 0x02d4dada83bff981f0cb7ebafcfc6fc7cb5e078b9ee2302a93aae19fb90f872e58)) (tags (list u\"contributor\" u\"og \\\\u{e2ad90}\" u\"clarity\")))`,\n  hex: '0x0c00000007066163746976650307616464726573730516142a7f9b4d4c7d2fdbe69c0b6733a484f37bbc3b05616c6961730d00000005416c6963650762616c616e636501000000000000000000000000000007d00470696e670700000000000000000000000000000000fa0a7075626c69635f6b65790a020000002102d4dada83bff981f0cb7ebafcfc6fc7cb5e078b9ee2302a93aae19fb90f872e5804746167730b000000030e0000000b636f6e7472696275746f720e000000066f6720e2ad900e00000007636c6172697479',\n  type_id: 12,\n  data: {\n    active: { repr: 'true', hex: '0x03', type_id: 3, value: true },\n    address: {\n      repr: \"'SPA2MZWV9N67TBYVWTE0PSSKMJ2F6YXW7CBE6YPW\",\n      hex: '0x0516142a7f9b4d4c7d2fdbe69c0b6733a484f37bbc3b',\n      type_id: 5,\n      address_version: 22,\n      address_hash_bytes: '0x142a7f9b4d4c7d2fdbe69c0b6733a484f37bbc3b',\n      address: 'SPA2MZWV9N67TBYVWTE0PSSKMJ2F6YXW7CBE6YPW'\n    },\n    alias: {\n      repr: '\"Alice\"',\n      hex: '0x0d00000005416c696365',\n      type_id: 13,\n      data: 'Alice'\n    },\n    balance: {\n      repr: 'u2000',\n      hex: '0x01000000000000000000000000000007d0',\n      type_id: 1,\n      value: '2000'\n    },\n    ping: {\n      repr: '(ok 250)',\n      hex: '0x0700000000000000000000000000000000fa',\n      type_id: 7,\n      value: {\n        repr: '250',\n        hex: '0x00000000000000000000000000000000fa',\n        type_id: 0,\n        value: '250'\n      }\n    },\n    public_key: {\n      repr: '(some 0x02d4dada83bff981f0cb7ebafcfc6fc7cb5e078b9ee2302a93aae19fb90f872e58)',\n      hex: '0x0a020000002102d4dada83bff981f0cb7ebafcfc6fc7cb5e078b9ee2302a93aae19fb90f872e58',\n      type_id: 10,\n      value: {\n        repr: '0x02d4dada83bff981f0cb7ebafcfc6fc7cb5e078b9ee2302a93aae19fb90f872e58',\n        hex: '0x020000002102d4dada83bff981f0cb7ebafcfc6fc7cb5e078b9ee2302a93aae19fb90f872e58',\n        type_id: 2,\n        buffer: '0x02d4dada83bff981f0cb7ebafcfc6fc7cb5e078b9ee2302a93aae19fb90f872e58'\n      }\n    },\n    tags: {\n      repr: '(list u\"contributor\" u\"og \\\\u{e2ad90}\" u\"clarity\")',\n      hex: '0x0b000000030e0000000b636f6e7472696275746f720e000000066f6720e2ad900e00000007636c6172697479',\n      type_id: 11,\n      list: [\n        {\n          repr: 'u\"contributor\"',\n          hex: '0x0e0000000b636f6e7472696275746f72',\n          type_id: 14,\n          data: 'contributor'\n        },\n        {\n          repr: 'u\"og \\\\u{e2ad90}\"',\n          hex: '0x0e000000066f6720e2ad90',\n          type_id: 14,\n          data: 'og ⭐'\n        },\n        {\n          repr: 'u\"clarity\"',\n          hex: '0x0e00000007636c6172697479',\n          type_id: 14,\n          data: 'clarity'\n        }\n      ]\n    }\n  }\n});\n```\n\u003c/details\u003e\n\n#### Decode serialized Clarity value to typed object\n\n```ts\nimport * as assert from 'node:assert';\nimport { \n  decodeClarityValue,\n  ClarityTypeID,\n  ClarityValueTuple,\n  ClarityValuePrincipalStandard,\n  ClarityValueStringAscii,\n  ClarityValueInt,\n  ClarityValueBoolTrue,\n  ClarityValueResponseOk,\n  ClarityValueBuffer,\n  ClarityValueList,\n  ClarityValueStringUtf8,\n  ClarityValueOptionalSome,\n  ClarityValueUInt,\n} from 'stacks-encoding-native-js';\n\n// Serialized hex string of the example Clarity value (0x-prefix optional, Buffer / Uint8Array also accepted)\nconst hex = '0x0c00000007066163746976650307616464726573730516142a7f9b4d4c7d2fdbe69c0b6733a484f37bbc3b05616c6961730d00000005416c6963650762616c616e636501000000000000000000000000000007d00470696e670700000000000000000000000000000000fa0a7075626c69635f6b65790a020000002102d4dada83bff981f0cb7ebafcfc6fc7cb5e078b9ee2302a93aae19fb90f872e5804746167730b000000030e0000000b636f6e7472696275746f720e000000066f6720e2ad900e00000007636c6172697479';\n\n// Provide a typed view of the decoded value\nconst decoded = decodeClarityValue\u003cClarityValueTuple\u003c{\n  active: ClarityValueBoolTrue;\n  address: ClarityValuePrincipalStandard;\n  alias: ClarityValueStringAscii;\n  balance: ClarityValueUInt;\n  ping: ClarityValueResponseOk\u003cClarityValueInt\u003e;\n  public_key: ClarityValueOptionalSome\u003cClarityValueBuffer\u003e;\n  tags: ClarityValueList\u003cClarityValueStringUtf8\u003e;\n}\u003e\u003e(hex);\n\nassert.deepStrictEqual(decoded.data.tags.list.map(v =\u003e v.data), ['contributor', 'og ⭐', 'clarity']);\n```\n\nThe annotated types are _not_ automatically checked at runtime, so type checks are needed for error handling:\n\n\u003cdetails\u003e\n\u003csummary\u003eExpand\u003c/summary\u003e\n\n```ts\nassert.strictEqual(decoded.type_id, ClarityTypeID.Tuple);\nassert.strictEqual(decoded.data.active.type_id, ClarityTypeID.BoolTrue);\nassert.strictEqual(decoded.data.address.type_id, ClarityTypeID.PrincipalStandard);\nassert.strictEqual(decoded.data.alias.type_id, ClarityTypeID.StringAscii);\nassert.strictEqual(decoded.data.balance.type_id, ClarityTypeID.UInt);\nassert.strictEqual(decoded.data.ping.type_id, ClarityTypeID.ResponseOk);\nassert.strictEqual(decoded.data.ping.value.type_id, ClarityTypeID.Int);\nassert.strictEqual(decoded.data.public_key.type_id, ClarityTypeID.OptionalSome);\nassert.strictEqual(decoded.data.public_key.value.type_id, ClarityTypeID.Buffer);\nassert.strictEqual(decoded.data.tags.type_id, ClarityTypeID.List);\nassert.strictEqual(decoded.data.tags.list[0].type_id, ClarityTypeID.StringUtf8);\n\n// Now we can safely access typed properties\nassert.strictEqual(decoded.data.active.value, true);\nassert.strictEqual(decoded.data.address.address, 'SPA2MZWV9N67TBYVWTE0PSSKMJ2F6YXW7CBE6YPW');\nassert.strictEqual(decoded.data.alias.data, 'Alice');\nassert.strictEqual(decoded.data.balance.value, '2000');\nassert.strictEqual(decoded.data.ping.value.value, '250');\nassert.strictEqual(decoded.data.public_key.value.buffer, '0x02d4dada83bff981f0cb7ebafcfc6fc7cb5e078b9ee2302a93aae19fb90f872e58');\nassert.deepStrictEqual(decoded.data.tags.list.map(v =\u003e v.data), ['contributor', 'og ⭐', 'clarity']);\n```\n\u003c/details\u003e\n\n### Decoding principals\n\n#### Principal from serialized Clarity value\n\n```ts\nimport * as assert from 'node:assert';\nimport { decodeClarityValueToPrincipal } from 'stacks-encoding-native-js';\n\n// Serialized hex string of an example Clarity value (0x-prefix optional, Buffer / Uint8Array also accepted)\nconst standardPrincipal = decodeClarityValueToPrincipal('0x0516a13dce8114be0f707f94470a2e5e86eb402f2923');\nassert.strictEqual(principal, 'SP2GKVKM12JZ0YW3ZJH3GMBJYGVNM0BS94ERA45AM');\n\nconst contractPrincipal = decodeClarityValueToPrincipal('0x0616a6a7a70f41adbe8eae708ed7ec2cbf41a272182014626974636f696e2d6d6f6e6b6579732d6c616273');\nassert.strictEqual(contractPrincipal, 'SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C.bitcoin-monkeys-labs');\n```\n\n#### Stacks address from parts\n\n```ts\nimport * as assert from 'node:assert';\nimport { stacksAddressFromParts } from 'stacks-encoding-native-js';\n\nconst stacksAddressData = {\n  version: 26,\n  // Serialized hex string (0x-prefix optional, Buffer / Uint8Array also accepted)\n  hash160: '0xcd1f5bc9aa49e7417cee3e5dba1a92567da41af6'\n};\n\nconst stacksAddress = stacksAddressFromParts(stacksAddressData.version, stacksAddressData.hash160);\nassert.strictEqual(stacksAddress, 'ST36HYPY9N94YEGBWXRZ5VEGTJ9B7V90TYTM9HGTJ');\n```\n\n#### Stacks address to parts\n\n```ts\nimport * as assert from 'node:assert';\nimport { decodeStacksAddress } from 'stacks-encoding-native-js';\n\nconst [version, hash160] = decodeStacksAddress('ST36HYPY9N94YEGBWXRZ5VEGTJ9B7V90TYTM9HGTJ');\nassert.strictEqual(version, 26);\nassert.strictEqual(hash160, '0xcd1f5bc9aa49e7417cee3e5dba1a92567da41af6');\n```\n\n### Decoding transactions\n\n```ts\nimport * as assert from 'node:assert';\nimport { \n  decodeTransaction,\n  AnchorModeID,\n  TransactionVersion,\n  TxPayloadTypeID,\n  TxSpendingConditionSingleSigHashMode,\n  TxPublicKeyEncoding,\n  ClarityTypeID,\n  PostConditionModeID,\n  PostConditionAuthFlag,\n  PostConditionAssetInfoID,\n  PostConditionNonfungibleConditionCodeID,\n  PostConditionNonFungibleConditionName\n} from 'stacks-encoding-native-js';\n\n// Serialized hex string (0x-prefix optional, Buffer / Uint8Array also accepted)\nconst rawTx = '0000000001040089f5fd1f719e4449c980de38e3504be6770a2698000000000000014500000000000001f400008b510c9e20dc22040953d9d7eabf2038008fa4d89a5a6cb78bb9d513e75cd0df3924af9ce3b5f185705bc2f6ba3071710ec6a8803ed6da4addc40a05a01ee0f503020000000102021689f5fd1f719e4449c980de38e3504be6770a269816a6a7a70f41adbe8eae708ed7ec2cbf41a272182014626974636f696e2d6d6f6e6b6579732d6c61627314626974636f696e2d6d6f6e6b6579732d6c61627301000000000000000000000000000008ba1002162bcf9762d5b90bc36dc1b4759b1727690f92ddd30e6d61726b6574706c6163652d76340a6c6973742d6173736574000000040616a6a7a70f41adbe8eae708ed7ec2cbf41a272182014626974636f696e2d6d6f6e6b6579732d6c61627301000000000000000000000000000008ba010000000000000000000000000c84588001000000000000000000000000000000c8';\n\nconst decoded = decodeTransaction(rawTx);\n```\n\nDecoded transaction output result:\n\u003cdetails\u003e\n\u003csummary\u003eExpand\u003c/summary\u003e\n\n```ts\nassert.deepStrictEqual(decoded, {\n  tx_id: \"0x49bcdba540d5c486f6f7a71de639a128a65f0378d7571e20c75a61661dd5b469\",\n  chain_id: 1,\n  version: TransactionVersion.Mainnet,\n  anchor_mode: AnchorModeID.Any,\n  auth: {\n    type_id: PostConditionAuthFlag.Standard,\n    origin_condition: {\n      hash_mode: TxSpendingConditionSingleSigHashMode.P2PKH,\n      key_encoding: TxPublicKeyEncoding.Compressed,\n      nonce: \"325\",\n      signature: \"0x008b510c9e20dc22040953d9d7eabf2038008fa4d89a5a6cb78bb9d513e75cd0df3924af9ce3b5f185705bc2f6ba3071710ec6a8803ed6da4addc40a05a01ee0f5\",\n      signer: {\n        address: \"SP24ZBZ8ZE6F48JE9G3F3HRTG9FK7E2H6K2QZ3Q1K\",\n        address_hash_bytes: \"0x89f5fd1f719e4449c980de38e3504be6770a2698\",\n        address_version: 22\n      },\n      tx_fee: \"500\"\n    }\n  },\n  payload: {\n    type_id: TxPayloadTypeID.ContractCall,\n    address: \"SPNWZ5V2TPWGQGVDR6T7B6RQ4XMGZ4PXTEE0VQ0S\",\n    address_hash_bytes: \"0x2bcf9762d5b90bc36dc1b4759b1727690f92ddd3\",\n    address_version: 22,\n    contract_name: \"marketplace-v4\",\n    function_name: \"list-asset\",\n    function_args: [\n      {\n        type_id: ClarityTypeID.PrincipalContract,\n        hex: \"0x0616a6a7a70f41adbe8eae708ed7ec2cbf41a272182014626974636f696e2d6d6f6e6b6579732d6c616273\",\n        repr: \"'SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C.bitcoin-monkeys-labs\"\n      },\n      {\n        type_id: ClarityTypeID.UInt,\n        hex: \"0x01000000000000000000000000000008ba\",\n        repr: \"u2234\"\n      },\n      {\n        type_id: ClarityTypeID.UInt,\n        hex: \"0x010000000000000000000000000c845880\",\n        repr: \"u210000000\"\n      },\n      {\n        type_id: ClarityTypeID.UInt,\n        hex: \"0x01000000000000000000000000000000c8\",\n        repr: \"u200\"\n      }\n    ],\n    function_args_buffer: \"0x000000040616a6a7a70f41adbe8eae708ed7ec2cbf41a272182014626974636f696e2d6d6f6e6b6579732d6c61627301000000000000000000000000000008ba010000000000000000000000000c84588001000000000000000000000000000000c8\"\n  },\n  post_condition_mode: PostConditionModeID.Deny,\n  post_conditions: [\n    {\n      condition_code: PostConditionNonfungibleConditionCodeID.Sent,\n      condition_name: PostConditionNonFungibleConditionName.Sent,\n      asset: {\n        asset_name: \"bitcoin-monkeys-labs\",\n        contract_address: \"SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C\",\n        contract_name: \"bitcoin-monkeys-labs\"\n      },\n      asset_info_id: PostConditionAssetInfoID.NonfungibleAsset,\n      asset_value: {\n        hex: \"0x01000000000000000000000000000008ba\",\n        repr: \"u2234\",\n        type_id: ClarityTypeID.UInt\n      },\n      principal: {\n        address: \"SP24ZBZ8ZE6F48JE9G3F3HRTG9FK7E2H6K2QZ3Q1K\",\n        address_hash_bytes: \"0x89f5fd1f719e4449c980de38e3504be6770a2698\",\n        address_version: 22,\n        type_id: ClarityTypeID.Buffer\n      }\n    }\n  ],\n  post_conditions_buffer: \"0x020000000102021689f5fd1f719e4449c980de38e3504be6770a269816a6a7a70f41adbe8eae708ed7ec2cbf41a272182014626974636f696e2d6d6f6e6b6579732d6c61627314626974636f696e2d6d6f6e6b6579732d6c61627301000000000000000000000000000008ba10\"\n});\n```\n\u003c/details\u003e\n\n## Project Layout\n\nThe directory structure of this project is:\n\n\u003cpre\u003e\n/\n├── Cargo.toml    # The Cargo \u003ca href=\"https://doc.rust-lang.org/cargo/reference/manifest.html\"\u003emanifest file\u003c/a\u003e\n├── package.json  # The npm \u003ca href=\"https://docs.npmjs.com/cli/v7/configuring-npm/package-json\"\u003emanifest file\u003c/a\u003e\n├── native/       # The \u003ca href=\"https://nodejs.org/api/addons.html\"\u003eNode addon\u003c/a\u003e modules built by this project, these are \u003ca href=\"https://en.wikipedia.org/wiki/Library_(computing)#Shared_libraries\"\u003edynamically-linked shared objects\u003c/a\u003e\n├── src/**/*.rs   # Directory containing the Rust source code for the project\n|── index.ts      # Typescript definitions for the js interface exposed by the Node addon\n|── loader.js     # Script to determine which addon file to load based on the executing target platform\n|── loader.d.ts   # Type defintions for the functions exported by the Node addon\n|── builder.js    # Script to build the native Node addon for the executing host platform\n├── tests/*.ts    # Js/ts unit tests, primarily testing the Neon (rust\u003c-\u003enodejs) interop layer\n└── perf-tests/   # Scripts to run performance benchmarks used by commands in package.json\n\u003c/pre\u003e\n\nThe Rust source code inside the `src/**/deserialize.rs` files are responsible for deserializing the Stacks blockchain wire/binary formats defined in [SIP-005](https://github.com/stacksgov/sips/blob/main/sips/sip-005/sip-005-blocks-and-transactions.md). \n\n## NPM Library Bundling\n\nThe Node addon modules for all supported platforms are compiled by [CI](.github/workflows/build.yml) and bundled inside the npm package. The native binary files are small enough that the bundled npm package is an acceptable ~20 MB in size. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhirosystems%2Fstacks-encoding-native-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhirosystems%2Fstacks-encoding-native-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhirosystems%2Fstacks-encoding-native-js/lists"}