Socket
Socket
Sign inDemoInstall

@ethereumjs/common

Package Overview
Dependencies
Maintainers
6
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethereumjs/common - npm Package Compare versions

Comparing version 2.0.0-beta.1 to 2.0.0-beta.2

6

CHANGELOG.md

@@ -9,2 +9,8 @@ # Changelog

## 2.0.0-beta.2 - 2020-11-12
This is the second beta release towards a final library release, see [beta.1 release notes](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fcommon%402.0.0-beta.1) for an overview on the full changes since the last publicly released version.
- Added consensus information to chains, new functions `Common.consensusType()` for consensus type access ("pow" or "poa") and `Common.consensusAlgorithm()` to get the associated algorithm or protocol (e.g. "ethash" PoW algorithm or "clique" PoA protocol), see PR [#937](https://github.com/ethereumjs/ethereumjs-vm/pull/937)
## 2.0.0-beta.1 - 2020-10-22

@@ -11,0 +17,0 @@

4

dist.browser/chains/goerli.json

@@ -5,2 +5,6 @@ {

"networkId": 5,
"consensus": {
"type": "poa",
"algorithm": "clique"
},
"comment": "Cross-client PoA test network",

@@ -7,0 +11,0 @@ "url": "https://github.com/goerli/testnet",

@@ -5,2 +5,6 @@ {

"networkId": 42,
"consensus": {
"type": "poa",
"algorithm": "aura"
},
"comment": "Parity PoA test network",

@@ -7,0 +11,0 @@ "url": "https://kovan-testnet.github.io/website/",

@@ -5,2 +5,6 @@ {

"networkId": 1,
"consensus": {
"type": "pow",
"algorithm": "ethash"
},
"comment": "The Ethereum main chain",

@@ -7,0 +11,0 @@ "url": "https://ethstats.net/",

@@ -5,2 +5,6 @@ {

"networkId": 4,
"consensus": {
"type": "poa",
"algorithm": "clique"
},
"comment": "PoA test network",

@@ -7,0 +11,0 @@ "url": "https://www.rinkeby.io",

@@ -5,2 +5,6 @@ {

"networkId": 3,
"consensus": {
"type": "pow",
"algorithm": "ethash"
},
"comment": "PoW test network",

@@ -7,0 +11,0 @@ "url": "https://github.com/ethereum/ropsten",

@@ -250,3 +250,3 @@ import { Chain } from './types';

*/
hardfork(): string | null;
hardfork(): string;
/**

@@ -272,3 +272,15 @@ * Returns the Id of current chain

eips(): number[];
/**
* Returns the consensus type of the network
* Possible values: "pow"|"poa"
*/
consensusType(): string;
/**
* Returns the concrete consensus implementation
* algorithm or protocol for the network
* e.g. "ethash" for "pow" consensus type or
* "clique" for "poa" consensus type
*/
consensusAlgorithm(): string;
}
export {};

@@ -709,2 +709,18 @@ "use strict";

};
/**
* Returns the consensus type of the network
* Possible values: "pow"|"poa"
*/
Common.prototype.consensusType = function () {
return this._chainParams['consensus']['type'];
};
/**
* Returns the concrete consensus implementation
* algorithm or protocol for the network
* e.g. "ethash" for "pow" consensus type or
* "clique" for "poa" consensus type
*/
Common.prototype.consensusAlgorithm = function () {
return this._chainParams['consensus']['algorithm'];
};
return Common;

@@ -711,0 +727,0 @@ }());

@@ -5,2 +5,6 @@ {

"networkId": 5,
"consensus": {
"type": "poa",
"algorithm": "clique"
},
"comment": "Cross-client PoA test network",

@@ -7,0 +11,0 @@ "url": "https://github.com/goerli/testnet",

@@ -5,2 +5,6 @@ {

"networkId": 42,
"consensus": {
"type": "poa",
"algorithm": "aura"
},
"comment": "Parity PoA test network",

@@ -7,0 +11,0 @@ "url": "https://kovan-testnet.github.io/website/",

@@ -5,2 +5,6 @@ {

"networkId": 1,
"consensus": {
"type": "pow",
"algorithm": "ethash"
},
"comment": "The Ethereum main chain",

@@ -7,0 +11,0 @@ "url": "https://ethstats.net/",

@@ -5,2 +5,6 @@ {

"networkId": 4,
"consensus": {
"type": "poa",
"algorithm": "clique"
},
"comment": "PoA test network",

@@ -7,0 +11,0 @@ "url": "https://www.rinkeby.io",

@@ -5,2 +5,6 @@ {

"networkId": 3,
"consensus": {
"type": "pow",
"algorithm": "ethash"
},
"comment": "PoW test network",

@@ -7,0 +11,0 @@ "url": "https://github.com/ethereum/ropsten",

@@ -250,3 +250,3 @@ import { Chain } from './types';

*/
hardfork(): string | null;
hardfork(): string;
/**

@@ -272,3 +272,15 @@ * Returns the Id of current chain

eips(): number[];
/**
* Returns the consensus type of the network
* Possible values: "pow"|"poa"
*/
consensusType(): string;
/**
* Returns the concrete consensus implementation
* algorithm or protocol for the network
* e.g. "ethash" for "pow" consensus type or
* "clique" for "poa" consensus type
*/
consensusAlgorithm(): string;
}
export {};

@@ -543,4 +543,20 @@ "use strict";

}
/**
* Returns the consensus type of the network
* Possible values: "pow"|"poa"
*/
consensusType() {
return this._chainParams['consensus']['type'];
}
/**
* Returns the concrete consensus implementation
* algorithm or protocol for the network
* e.g. "ethash" for "pow" consensus type or
* "clique" for "poa" consensus type
*/
consensusAlgorithm() {
return this._chainParams['consensus']['algorithm'];
}
}
exports.default = Common;
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "@ethereumjs/common",
"version": "2.0.0-beta.1",
"version": "2.0.0-beta.2",
"description": "Resources common to all Ethereum implementations",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -11,3 +11,3 @@ # ethereumjs-common

Succeeds the old [ethereum/common](https://github.com/ethereumjs/common/) library.
Note: this `README` reflects the state of the library from `v2.0.0` onwards. See `README` from the [standalone repository](https://github.com/ethereumjs/ethereumjs-common) for an introduction on the last preceeding release.

@@ -24,10 +24,14 @@ # INSTALL

If no hardfork is provided the common is initialized with the default hardfork.
Current `DEFAULT_HARDFORK`: `istanbul`
Here are some simple usage examples:
```javascript
const Common = require('@ethereumjs/common')
```typescript
import Common from '@ethereumjs/common'
// Instantiate with only the chain
let c = new Common({ chain: 'ropsten' })
c.param('gasPrices', 'ecAddGas', 'byzantium') // 500
// Instantiate with the chain (and the default hardfork)
const c = new Common({ chain: 'ropsten' })
c.param('gasPrices', 'ecAddGas') // 500

@@ -38,2 +42,5 @@ // Chain and hardfork provided

// Instantiate with an EIP activated
const c = new Common({ chain: 'mainnet', eips: [2537] })
// Access genesis data for Ropsten network

@@ -46,6 +53,5 @@ c.genesis().hash // 0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d

It is encouraged to also explicitly set the `supportedHardforks` if the initializing library
only supports a certain range of `hardforks`:
If the initializing library only supports a certain range of `hardforks` you can use the `supportedHardforks` option to restrict hardfork access on the `Common` instance:
```javascript
```typescript
let c = new Common({

@@ -84,10 +90,13 @@ chain: 'ropsten',

- `petersburg` (aka `constantinopleFix`, apply together with `constantinople`)
- `istanbul` (`DEFAULT_HARDFORK`)
- `muirGlacier`
- `istanbul` (`DEFAULT_HARDFORK` (`v2.0.0` release series))
- `muirGlacier` (since `v1.5.0`)
## Future Hardforks
The `muirGlacier` HF delaying the difficulty bomb and scheduled for January 2020
is supported by the library since `v1.5.0`.
General support for the `berlin` hardfork has been added along `v2.0.0`, specification of the hardfork regarding EIPs included was not finalized upon release date.
Currently supported `berlin` EIPs:
- `EIP-2315`
## Parameter Access

@@ -110,5 +119,2 @@

Note: The list of `gasPrices` and gas price changes on hardforks is consistent
but not complete, so there are currently gas price values missing (PRs welcome!).
# Chain Params

@@ -122,3 +128,3 @@

- `kovan`
- `goerli` (final configuration since `v1.1.0`)
- `goerli`
- Private/custom chain parameters

@@ -131,2 +137,4 @@

- `networkId`
- `consensusType` (e.g. `pow` or `poa`)
- `consensusAlgorithm` (e.g. `ethash` or `clique`)
- `genesis` block header values

@@ -133,0 +141,0 @@ - `hardforks` block numbers

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc