yarn web3-eth 1.2.2
web3.js 1.2.2

latest releases: 4.11.1-dev.1b367e6.0, 4.11.1-dev.471c12b.0, 4.11.1-dev.8c55cb0.0...
5 years ago

TypeScript

We have back-ported all the types from 2.x to 1.x and do now provide the type definitions directly from the web3 repository. (Docs)

Thanks Josh Stevens for back-porting them for us!

Signing

We have improved the signing process and updated it to the latest version of ethereumjs-tx. This update brought up some newly required configuration properties for custom chains.

These new TransactionConfig config properties do also have the related default properties on the web3-eth and web3-eth-contract module:

Transaction Confirmation Workflow

We updated the confirmation workflow for the HttpProvider. A confirmation will now only get triggered if a new block is existing and not each second.

Additionally is it now possible to configure the confirmation workflow with the following default properties on the web3-eth and web3-eth-contract module:

New JSON-RPC Method

We added the JSON-RPC method eth_chainId as getChainId method on the web3-eth module.
The documentation for this method can be found here.

New utility Functions: Bloom-Filters

What are bloom filters?

A Bloom filter is a probabilistic, space-efficient data structure used for fast checks of set membership. That probably doesn’t mean much to you yet, and so let’s explore how bloom filters might be used.

Imagine that we have some large set of data, and we want to be able to quickly test if some element is currently in that set. The naive way of checking might be to query the set to see if our element is in there. That’s probably fine if our data set is relatively small. Unfortunately, if our data set is really big, this search might take a while. Luckily, we have tricks to speed things up in the Ethereum world!

A bloom-filter is one of these tricks. The basic idea behind the Bloom filter is to hash each new element that goes into the data set, take certain bits from this hash, and then use those bits to fill in parts of a fixed-size bit array (e.g. set certain bits to 1). This bit array is called a bloom filter.

Later, when we want to check if an element is in the set, we simply hash the element and check that the right bits are in the bloom filter. If at least one of the bits is 0, then the element definitely isn’t in our data set! If all of the bits are 1, then the element might be in the data set, but we need to actually query the database to be sure. So we might have false positives, but we’ll never have false negatives. This can greatly reduce the number of database queries we have to make.

Bloom filters benefits with a real-life example

An Ethereum real-life example in where this is useful is if you want to update a user's balance on every new block so it stays as close to real-time as possible. Without using a bloom filter on every new block you would have to force the balances even if that user may not have had any activity within that block. But if you use the logBlooms from the block you can test the bloom filter against the users Ethereum address before you do any more slow operations, this will dramatically decrease the number of calls you do as you will only be doing those extra operations if that Ethereum address is within that block (minus the false positives outcome which will be negligible). This will be highly performant for your app.

Added Functions:

Thanks Josh Stevens for adding these functions!

Subscription Events

We extended the subscription events with a connected event. The connected event will emit the subscription ID as a hex value when the subscription got established. This applies to Contract events as well.

Example:

var subscription = web3.eth.subscribe(
  'logs', 
  {
    address: '0x123456..',
    topics: ['0x12345...']
  }
)
.on('connected', console.log);
> '0x9ce59a13059e417087c02d3236a0b1cc'

Providers

We extend the provider interface with the method supportsSubscription. This will help the DApp developers to detect if the currentProvider does support subscriptions.

Changelog

Added

  • localStorage support detection added (#3031)
  • getNetworkType method extended with Görli testnet (#3095)
  • supportsSubscriptions method added to providers (#3116)
  • Add eth.getChainId method (#3113)
  • Minified file added to web3 package (#3131)
  • The transaction confirmation workflow can now be configured (#3130)
  • Additional parameters for accounts.signTransaction added (docs) (#3141)
  • Emit connected event on subscription creation (#3028)
  • TypeScript type definitions added for all modules (#3132)
  • Bloom filters added to web3.utils (#3137)

Fixed

  • Fix allow 0 as a valid fromBlock or toBlock filter param (#1100)
  • Fix randomHex returning inconsistent string lengths (#1490)
  • Fix make isBN minification safe (#1777)
  • Fix incorrect references to BigNumber in utils.fromWei and utils.toWei error messages (#2468)
  • Fix error incorrectly thrown when receipt.status is null (#2183)
  • Fix incorrectly populating chainId param with net_version when signing txs (#2378)
  • regeneratorRuntime error fixed (#3058)
  • Fix accessing event.name where event is undefined (#3014)
  • fixed Web3Utils toHex() for Buffer input (#3021)
  • Fix bubbling up tx signing errors (#2063, #3105)
  • HttpProvider: CORS issue with Firefox and Safari (#2978)
  • Ensure the immutability of the tx object passed to function signTransaction (#2190)
  • Gas check fixed (#2381)
  • Signing issues #1998, #2033, and #1074 fixed (#3125)
  • Fix hexToNumber and hexToNumberString prefix validation (#3086)
  • The receipt will now returned on a EVM error (this got removed on beta.18) (#3129)
  • Fixes transaction confirmations with the HttpProvider (#3140)

Don't miss a new web3-eth release

NewReleases is sending notifications on new releases.