{"name":"@ethereumjs/ethash","version":"1.0.0","keywords":["ethash","ethereum","POW"],"author":{"name":"mjbecze","email":"mjbecze@gmail.com"},"license":"MPL-2.0","_id":"@ethereumjs/ethash@1.0.0","homepage":"https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/ethash#readme","bugs":{"url":"https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aissue+label%3A%22package%3A+ethash%22"},"dist":{"shasum":"4e77f85b37be1ade5393e8719bdabac3e796ddaa","tarball":"http://registry-npm.ywwl.com/@ethereumjs/ethash/download/@ethereumjs/ethash-1.0.0.tgz","fileCount":16,"integrity":"sha512-iIqnGG6NMKesyOxv2YctB2guOVX18qMAWlj3QlZyrc+GqfzLqoihti+cVNQnyNxr7eYuPdqwLQOFuPe6g/uKjw==","signatures":[{"sig":"MEUCIHD2ay/oboNMFE6l4qjPCQZ3i0qkc+2ua+UdF4jowxDAAiEAxLRYZ4uhXFRwzbVe9gSr2mEKKMWThT6BHzNGhSBbCts=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":79715,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfviSICRA9TVsSAnZWagAAYjsP/3qL7xYtUw3Io9PDTxLm\nKXIB7ciuZhmB8ZBia7wDbjdXF4TD8N3lQ/ZTVxvUz0gMzscOMyedz3/tdVHY\n4v9bwghVcxO4bMiuQHXV2qcRDYb4VRQstvH08z1usltBKKBKK1KW56JtAYW6\nUQoNQcY8Cf7lyo9GDt8KeRQHoa1YBp4Nbr+K/NJWc7VSRwyFs+vTggy90aoz\npgaMTT0IUHaDE0N+0bc/6EnhcFIyylfZrDdYf+fr7NZoZNlS3In2UZWA2VVX\n4WqoKQM/ChSqvYRZdeSoc05FWHe1nlqFQyfItnNe/ILfGwhHk/s5k442bO42\n06/n3GS5uQouqOM2tf+eGmHTzLGTq8WmxuACq/SYPKsDEDElfHZ0eOj8wQ9r\nJ0HG0t/D5B5bQ0m7hgYQCHZsqevfARWLhuiLDo8hRtIAIMfAp5cO0A+Q/U2V\nihUijN7rdCIdSOrRlOBdiSq+lNGR1hagew9mBM2eFtaMuQ2VbEbuHhDpzilc\ngD4+3OOGnnRMjZKZOeEJ9Ptz5K85qmGAT3HtHWlSVD9nNBQic+UTDtqfP3az\nkDIfNenxqOaex8ZTB1N8adzW8tucp4sTyjqZ5LqAJUoKCBQXxgXkH2N53AKE\nmoQlBV6GzDmxJQvSkdDP8ARUEbYJH2fMLexpRRhBkgQ6N5w0SKnFQKD8+54g\nKoN6\r\n=D09N\r\n-----END PGP SIGNATURE-----\r\n","size":18171,"noattachment":false,"key":"/@ethereumjs/ethash/-/@ethereumjs/ethash-1.0.0.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","browser":"dist.browser/index.js","scripts":{"tsc":"ethereumjs-config-tsc","lint":"ethereumjs-config-lint","test":"tape -r ts-node/register test/*.spec.ts","build":"ethereumjs-config-ts-build","coverage":"ethereumjs-config-coverage","lint:fix":"ethereumjs-config-lint-fix","prepublishOnly":"npm run test && npm run build"},"_npmUser":{"name":"holgerd77","email":"Holger.Drewes@gmail.com"},"repository":{"url":"git+https://github.com/ethereumjs/ethereumjs-vm.git","type":"git"},"_npmVersion":"6.14.4","description":"An ethash implementation in JS.","directories":{},"_nodeVersion":"12.15.0","dependencies":{"buffer-xor":"^2.0.1","miller-rabin":"^4.0.0","@types/levelup":"^4.3.0","ethereumjs-util":"^7.0.7"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^14.0.0","tape":"^4.10.1","eslint":"^6.8.0","tslint":"^5.16.0","ts-node":"^8.8.2","prettier":"^2.0.5","level-mem":"^5.0.1","typescript":"^3.9.3","@types/tape":"^4.13.0","@ethereumjs/block":"^3.0.0","eslint-config-prettier":"^6.11.0","@ethereumjs/config-coverage":"^2.0.0","@ethereumjs/config-typescript":"^2.0.0","@typescript-eslint/eslint-plugin":"^4.1.1","@ethereumjs/eslint-config-defaults":"^2.0.0","eslint-plugin-implicit-dependencies":"^1.0.4"},"_npmOperationalInternal":{"tmp":"tmp/ethash_1.0.0_1606296712284_0.013353678280635384","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":1606296712419,"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":1606296712419,"dist-tags":{"alpha":"4.0.0-alpha.1","beta":"2.0.0-beta.3","latest":"10.0.0","rc":"10.0.0-rc.1"}}