{"name":"@ethereumjs/ethash","version":"10.0.0","description":"An implementation of the Ethash consensus algorithm in JavaScript","keywords":["ethash","ethereum","POW"],"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"},"repository":{"type":"git","url":"git+https://github.com/ethereumjs/ethereumjs-monorepo.git"},"license":"MPL-2.0","author":{"name":"mjbecze","email":"mjbecze@gmail.com"},"type":"module","sideEffects":false,"main":"dist/cjs/index.js","module":"dist/esm/index.js","exports":{".":{"import":{"typescript":"./src/index.ts","default":"./dist/esm/index.js"},"require":"./dist/cjs/index.js"}},"scripts":{"biome":"npx @biomejs/biome check","biome:fix":"npx @biomejs/biome check --write","build":"../../config/cli/ts-build.sh","clean":"../../config/cli/clean-package.sh","coverage":"DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts","coverage:istanbul":"DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.istanbul.mts","docs:build":"typedoc --options typedoc.mjs","examples":"tsx ../../scripts/examples-runner.ts -- ethash","examples:build":"npx embedme README.md","lint":"npm run biome && eslint  --config ./eslint.config.mjs .","lint:fix":"npm run biome:fix && eslint  --fix --config ./eslint.config.mjs .","prepublishOnly":"../../config/cli/prepublish.sh","sc":"npm run spellcheck","spellcheck":"npm run spellcheck:ts && npm run spellcheck:md","spellcheck:ts":"npx cspell --gitignore -c ../../config/cspell-ts.json \"./**/*.ts\" --cache --show-suggestions --show-context","spellcheck:md":"npx cspell --gitignore -c ../../config/cspell-md.json \"**.md\" --cache --show-suggestions --show-context","test":"npx vitest run -c ./vite.config.ts","tsc":"../../config/cli/ts-compile.sh"},"dependencies":{"@ethereumjs/block":"^10.0.0","@ethereumjs/rlp":"^10.0.0","@ethereumjs/util":"^10.0.0","bigint-crypto-utils":"^3.3.0","ethereum-cryptography":"^3.2.0"},"devDependencies":{"@ethereumjs/common":"^10.0.0"},"engines":{"node":">=18"},"_id":"@ethereumjs/ethash@10.0.0","gitHead":"9e461f54312bf20c710b43ab73f7d3ad753f8765","types":"./dist/cjs/index.d.ts","_nodeVersion":"23.10.0","_npmVersion":"11.2.0","dist":{"integrity":"sha512-R7H2RbdbqPwJj1Yxb6ESSebDnVDEPt2zEmtiwaZsXZ351syk2dLdJAa7rEJOShW2r3eRVZxBmLAmXSfxwf3faQ==","shasum":"2914e1dd32ea27a0683c37403db852c7ffd64287","tarball":"http://registry-npm.ywwl.com/@ethereumjs/ethash/download/@ethereumjs/ethash-10.0.0.tgz","fileCount":25,"unpackedSize":218679,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDuvIXLSKPrujNCCQp/U8HBCscrVh8k9VC5dKbWFwcvMQIgaoS+r2M756WjxaWWjxVv/4QmV+oHMr7NfigYM2GFxU8="}],"size":55916,"noattachment":false,"key":"/@ethereumjs/ethash/-/@ethereumjs/ethash-10.0.0.tgz"},"_npmUser":{"name":"holgerd77","email":"Holger.Drewes@gmail.com"},"directories":{},"maintainers":[{"name":"axic","email":"alex@rtfs.hu"},{"name":"holgerd77","email":"Holger.Drewes@gmail.com"},{"name":"acolytec3","email":"metroman374@gmail.com"},{"name":"g11tech","email":"gajinder@g11.in"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ethash_10.0.0_1745920040362_0.43915804368830114"},"_hasShrinkwrap":false,"readme":"# @ethereumjs/ethash `v10`\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\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [API](#api)\n- [EthereumJS](#ethereumjs)\n- [License](#license)\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 { createBlockFromRLP } from '@ethereumjs/block'\nimport { Ethash } from '@ethereumjs/ethash'\nimport { MapDB, hexToBytes } from '@ethereumjs/util'\n\nimport type { DBObject } from '@ethereumjs/util'\n\nconst cacheDB = new MapDB<number, DBObject>()\n\nconst ethash = new Ethash(cacheDB)\nconst validblockRlp =\n  '0xf90667f905fba0a8d5b7a4793baaede98b5236954f634a0051842df6a252f6a80492fd888678bda01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0f93c8db1e931daa2e22e39b5d2da6fb4074e3d544094857608536155e3521bc1a0bb7495628f9160ddbcf6354380ee32c300d594e833caec3a428041a66e7bade1a0c7778a7376099ee2e5c455791c1885b5c361b95713fddcbe32d97fd01334d296b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008302000001832fefd882560b84559c17b9b9040001020304050607080910111213141516171819202122232410000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000a09c7b47112a3afb385c12924bf6280d273c106eea7caeaf5131d8776f61056c148876ae05d46b58d1fff866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ba01d2c92cfaeb04e53acdff2b5d42005ff6aacdb0105e64eb8c30c273f445d2782a01e7d50ffce57840360c57d94977b8cdebde614da23e8d1e77dc07928763cfe21c0'\n\nconst validBlock = createBlockFromRLP(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 { createBlock } from '@ethereumjs/block'\nimport { Ethash } from '@ethereumjs/ethash'\nimport { MapDB, bytesToHex } from '@ethereumjs/util'\n\nimport type { DBObject } from '@ethereumjs/util'\n\nconst block = createBlock(\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## 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":1745920040582,"_cnpm_publish_time":1745920040582,"dist-tags":{"alpha":"4.0.0-alpha.1","beta":"2.0.0-beta.3","latest":"10.0.0","rc":"10.0.0-rc.1"}}