{"name":"@ethereumjs/ethash","version":"2.0.4","keywords":["ethash","ethereum","POW"],"author":{"name":"mjbecze","email":"mjbecze@gmail.com"},"license":"MPL-2.0","_id":"@ethereumjs/ethash@2.0.4","homepage":"https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/ethash#readme","bugs":{"url":"https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aissue+label%3A%22package%3A+ethash%22"},"dist":{"shasum":"1892e8e17a11b10efeee3075fb09cd3cbd12c33b","tarball":"http://registry-npm.ywwl.com/@ethereumjs/ethash/download/@ethereumjs/ethash-2.0.4.tgz","fileCount":13,"integrity":"sha512-WREZZEZKh8baGbG4IwLXvjA+ItFWzD/myUnefKALuAcB9+um93e1YBaeSQzeyY6m5jiDmpxu55SxF0mB8e+xdQ==","signatures":[{"sig":"MEUCIDGYsBKwgI+YayBOihNFYj9iOVQYph/ACYTfEV3HhHwxAiEAlgIzo+L+iArsCbxRulI03SfKvNSKHKHtnzNmFRvA1pU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":70869,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj/LqaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrQ8g//eHwjdXUop7zOmsL8zJ+klCro7V9IIY1SF6OdrFzB7dHqDk5+\r\nQ0ms+BqCP8Xpy2oC5U1lJGMADFKp7vKCIw9nWnb5a0lYlwz+0L6rr8AsoS+H\r\nLSM7TZPLnAqxVtd8AshbZ2WFCCl60W2MEf9W4onlgNkrKkXKsYcRQw6VSfDZ\r\npL7odDqK6dTCjpd4SajzUGSlO/TFxmOC5N5l5XMn8pxsbRn57i/0GxP+7Cqo\r\nWtS7JI9ONxa93CPLrO077eTng9cnyruS8CMxVAvoV9jyE1/U6k2dsBS7ou74\r\nkzQhc3tiZZfbrecdXmHlK83pq4c0jp16wI9/XW6B1lu0gGAygAZvn7o7VvdA\r\nhDfdHj6hmcqmBfLjDN5r6E/4AsD4ZCrMIihWVVbRAbnJ9DgOejDzhFfH/3dh\r\nIA9/10ba0aB5ZheP+TFrl0/Sd+/KujQL5WX8DNLhZ74uPhFl0z2Gx3bC/Nq4\r\n/aoIWCZ9bNdnQJqHQDePL3JyVQJa0hCUzOmsfuMYU6+SIHL33OIbupuj33LB\r\nXAtofszZrFoOMcjeRxmffv7Bs8U3IRqBsxnn/M2YcuFJm35TVBisQWmqyTyU\r\nSXNGCRqS+2gLhjp6Ch1q6iGO6S05RUEX0C8FpfcQeg72tty/pTHyHFEYgBl9\r\ny1vjpiE47SX4P2qTL32F+idMnV7RUs8BRpw=\r\n=Nkdk\r\n-----END PGP SIGNATURE-----\r\n","size":19462,"noattachment":false,"key":"/@ethereumjs/ethash/-/@ethereumjs/ethash-2.0.4.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=14"},"gitHead":"295e5a3caa69c226e8f8edfad4ea72a843bc0b4f","scripts":{"tsc":"../../config/cli/ts-compile.sh","lint":"../../config/cli/lint.sh","test":"tape -r ts-node/register test/*.spec.ts","build":"../../config/cli/ts-build.sh","clean":"../../config/cli/clean-package.sh","coverage":"../../config/cli/coverage.sh","lint:fix":"../../config/cli/lint-fix.sh","lint:diff":"../../config/cli/lint-diff.sh","docs:build":"typedoc --options typedoc.js","prepublishOnly":"../../config/cli/prepublish.sh"},"_npmUser":{"name":"holgerd77","email":"Holger.Drewes@gmail.com"},"repository":{"url":"git+https://github.com/ethereumjs/ethereumjs-monorepo.git","type":"git"},"_npmVersion":"8.19.3","description":"An ethash implementation in JavaScript","directories":{},"_nodeVersion":"18.13.0","dependencies":{"abstract-level":"^1.0.3","@ethereumjs/rlp":"^4.0.1","@ethereumjs/util":"^8.0.5","@ethereumjs/block":"^4.2.1","bigint-crypto-utils":"^3.0.23","ethereum-cryptography":"^1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"memory-level":"^1.0.0","@ethereumjs/common":"^3.1.1"},"_npmOperationalInternal":{"tmp":"tmp/ethash_2.0.4_1677507225863_0.0032936866151391797","host":"s3://npm-registry-packages"},"readme":"# @ethereumjs/ethash\n\n[![NPM Package][ethash-npm-badge]][ethash-npm-link]\n[![GitHub Issues][ethash-issues-badge]][ethash-issues-link]\n[![Actions Status][ethash-actions-badge]][ethash-actions-link]\n[![Code Coverage][ethash-coverage-badge]][ethash-coverage-link]\n[![Discord][discord-badge]][discord-link]\n\n| [Ethash](https://github.com/ethereum/wiki/wiki/Ethash) implementation in TypeScript. |\n| ------------------------------------------------------------------------------------ |\n\nNote: this `README` reflects the state of the library from `v1.0.0` onwards. See `README` from the [standalone repository](https://github.com/ethereumjs/ethashjs) for an introduction on the last preceding release.\n\n## Installation\n\nTo obtain the latest version, simply require the project using `npm`:\n\n```shell\nnpm install @ethereumjs/ethash\n```\n\n## Usage\n\n### PoW Validation\n\n```ts\n// ./examples/powBlock.ts\n\nimport { Ethash } from '@ethereumjs/ethash'\nimport { Block } from '@ethereumjs/block'\nimport { DBObject, hexToBytes, MapDB } from '@ethereumjs/util'\n\nconst cacheDB = new MapDB<number, DBObject>()\n\nconst ethash = new Ethash(cacheDB)\nconst validblockRlp =\n  '0xf90667f905fba0a8d5b7a4793baaede98b5236954f634a0051842df6a252f6a80492fd888678bda01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0f93c8db1e931daa2e22e39b5d2da6fb4074e3d544094857608536155e3521bc1a0bb7495628f9160ddbcf6354380ee32c300d594e833caec3a428041a66e7bade1a0c7778a7376099ee2e5c455791c1885b5c361b95713fddcbe32d97fd01334d296b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008302000001832fefd882560b84559c17b9b9040001020304050607080910111213141516171819202122232410000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000a09c7b47112a3afb385c12924bf6280d273c106eea7caeaf5131d8776f61056c148876ae05d46b58d1fff866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ba01d2c92cfaeb04e53acdff2b5d42005ff6aacdb0105e64eb8c30c273f445d2782a01e7d50ffce57840360c57d94977b8cdebde614da23e8d1e77dc07928763cfe21c0'\n\nconst validBlock = Block.fromRLPSerializedBlock(hexToBytes(validblockRlp), {\n  setHardfork: true,\n  skipConsensusFormatValidation: true,\n})\n\nconst result = await ethash.verifyPOW(validBlock)\nconsole.log(result) // => true\n```\n\n### PoW Ethash CPU Miner\n\nThere is a simple CPU miner included within `Ethash` package which can be used for testing purposes.\n\nSee the following example on how to use the new `Miner` class:\n\n```ts\n// ./examples/miner.ts\n\nimport { Block } from '@ethereumjs/block'\nimport { Ethash } from '@ethereumjs/ethash'\nimport { DBObject, MapDB, bytesToHex } from '@ethereumjs/util'\n\nconst block = Block.fromBlockData(\n  {\n    header: {\n      difficulty: BigInt(100),\n      number: BigInt(1),\n    },\n  },\n  { setHardfork: true, skipConsensusFormatValidation: true }\n)\n\nconst cacheDB = new MapDB<number, DBObject>()\n\nconst e = new Ethash(cacheDB)\nconst miner = e.getMiner(block.header)\nconst solution = await miner.iterate(-1) // iterate until solution is found\nconsole.log(bytesToHex(solution!.mixHash)) // 0x892177e7bbb1f31ade0610707c96c6bf86e1415b26073d17b2da2dbd2daefd1e\n```\n\n## API\n\n### Docs\n\nGenerated TypeDoc API [Documentation](./docs/README.md)\n\n### Hybrid CJS/ESM Builds\n\nWith the breaking releases from Summer 2023 we have started to ship our libraries with both CommonJS (`cjs` folder) and ESM builds (`esm` folder), see `package.json` for the detailed setup.\n\nIf you use an ES6-style `import` in your code files from the ESM build will be used:\n\n```ts\nimport { EthereumJSClass } from '@ethereumjs/[PACKAGE_NAME]'\n```\n\nIf you use Node.js specific `require`, the CJS build will be used:\n\n```ts\nconst { EthereumJSClass } = require('@ethereumjs/[PACKAGE_NAME]')\n```\n\nUsing ESM will give you additional advantages over CJS beyond browser usage like static code analysis / Tree Shaking which CJS can not provide.\n\n### Buffer -> Uint8Array\n\nWith the breaking releases from Summer 2023 we have removed all Node.js specific `Buffer` usages from our libraries and replace these with [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) representations, which are available both in Node.js and the browser (`Buffer` is a subclass of `Uint8Array`).\n\nWe have converted existing Buffer conversion methods to Uint8Array conversion methods in the [@ethereumjs/util](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util) `bytes` module, see the respective README section for guidance.\n\n### BigInt Support\n\nStarting with v2 the usage of [BN.js](https://github.com/indutny/bn.js/) for big numbers has been removed from the library and replaced with the usage of the native JS [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) data type (introduced in `ES2020`).\n\nPlease note that number-related API signatures have changed along with this version update and the minimal build target has been updated to `ES2020`.\n\n## EthereumJS\n\nSee our organizational [documentation](https://ethereumjs.readthedocs.io) for an introduction to `EthereumJS` as well as information on current standards and best practices. If you want to join for work or carry out improvements on the libraries, please review our [contribution guidelines](https://ethereumjs.readthedocs.io/en/latest/contributing.html) first.\n\n# LICENSE\n\n[MPL-2.0](<https://tldrlegal.com/license/mozilla-public-license-2.0-(mpl-2)>)\n\n[discord-badge]: https://img.shields.io/static/v1?logo=discord&label=discord&message=Join&color=blue\n[discord-link]: https://discord.gg/TNwARpR\n[ethash-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/ethash.svg\n[ethash-npm-link]: https://www.npmjs.org/package/@ethereumjs/ethash\n[ethash-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-monorepo/package:%20ethash?label=issues\n[ethash-issues-link]: https://github.com/ethereumjs/ethereumjs-monorepo/issues?q=is%3Aopen+is%3Aissue+label%3A\"package%3A+ethash\"\n[ethash-actions-badge]: https://github.com/ethereumjs/ethereumjs-monorepo/workflows/Ethash/badge.svg\n[ethash-actions-link]: https://github.com/ethereumjs/ethereumjs-monorepo/actions?query=workflow%3A%22Ethash%22\n[ethash-coverage-badge]: https://codecov.io/gh/ethereumjs/ethereumjs-monorepo/branch/master/graph/badge.svg?flag=ethash\n[ethash-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-monorepo/tree/master/packages/ethash\n","publish_time":1677507226075,"maintainers":[{"name":"acolytec3","email":"metroman374@gmail.com"},{"name":"g11tech","email":"gajinder@g11.in"},{"name":"axic","email":"alex@rtfs.hu"},{"name":"holgerd77","email":"Holger.Drewes@gmail.com"}],"_cnpm_publish_time":1677507226075,"dist-tags":{"alpha":"4.0.0-alpha.1","beta":"2.0.0-beta.3","latest":"10.0.0","rc":"10.0.0-rc.1"}}