{"name":"@ethereumjs/ethash","version":"1.0.0-beta.1","keywords":["ethash","ethereum","POW"],"author":{"name":"mjbecze","email":"mjbecze@gmail.com"},"license":"MPL-2.0","_id":"@ethereumjs/ethash@1.0.0-beta.1","homepage":"https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/ethash#readme","bugs":{"url":"https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aissue+is%3Aopen+label%3A'package%3A+ethash'"},"dist":{"shasum":"66debb762a37569aeb3053c9ed6da8da80852d58","tarball":"http://registry-npm.ywwl.com/@ethereumjs/ethash/download/@ethereumjs/ethash-1.0.0-beta.1.tgz","fileCount":16,"integrity":"sha512-FeqX0gPvp+kC/ELi6Wb/hoVgm5mA/AwerlQ2Ww+t+13j3lLSbFwGWw2SW6KpN36+d8UYCAo/Hn4AFXEuwUzYXQ==","signatures":[{"sig":"MEUCIQDnoiBkr1e2KMCHuxxgSu+BmB3kqWBV8DgIIbVfuKFm+QIgXsga1oo/JyveOXC+AZkAwSOJogRy7g5kYxWOlbjoNVo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":77126,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkVbeCRA9TVsSAnZWagAAhuoP/RCkeV/i7mhdok6loVPO\nsCQPRaNvO/QkFTF+ClQ3do2noFdTt/6eEvUDAcZrl2YFrj6qiknJKsZB0ImJ\nSM5EWIgcjNMmS2FttoVXI+cIGCZOfuXGavOK6xjL/4y/6EO5eY0+hFROEqxD\nU0iC9Ic08o7B3gt/x/L+bokQR5rQlKX3juSruQ5hD+8gKvS/P2E00iBczrCq\nVNYuB4dGoWteWMgJvyIYFWKJOAdaAWNULg2kAAyEDqX2BAg77EuDR14rqCtj\nCFujTp/HgIFvh3k5LDr8Qfe7qapxujJhWoFv6Nhk+6CLFzPOu+2PZ516Vo8Z\nAiFWTH1AMcX0xeJKL/eHJ9Tbj6X9kc5O1Mgm6YrpT+enCohxo04LI9KL9dWe\nQXHzcJeuHnVMGH9r5O2H4IhaWavQm6YqC1YA8jo25eNxJwkktc9Vc6vrVnGZ\nt9iRzTzP1gHw5EAEbAH/WGtMY/DnvMUawMbtEkb012V0ZpYPH++fL/8suiM8\nSBCIjUvKM5i9rzNIZ3eclft6iwyaZUKDrJfXlKoez/G5zXDMvpL72WsHCbX/\n/J+IZGwfZJltS29En80wzdkgwyhUhDMVya3sCYR6D2WcwNX8qPIaKr+leo9P\nyd9NSOx2G4PjQ5IUefz74DlvvyYq2k3PL5i5aGTdwC1IPDcMJGy/ivvvlb+D\n0ddK\r\n=Iyrr\r\n-----END PGP SIGNATURE-----\r\n","size":17910,"noattachment":false,"key":"/@ethereumjs/ethash/-/@ethereumjs/ethash-1.0.0-beta.1.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-beta.1","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-beta.1_1603360478066_0.11420076413355407","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":1603360478170,"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":1603360478170,"dist-tags":{"alpha":"4.0.0-alpha.1","beta":"2.0.0-beta.3","latest":"10.0.0","rc":"10.0.0-rc.1"}}