This documentation is under construction and the web3.js 1.0 stable version isn’t released. If your using a version v0.x.x of web3.js then please have a look at

Contract Module API

The Contract Module API does provide to possibility to create project specific contracts with pre-injecting of the ABI or customizing of the default behaviour of a Web3 contract.


The exported class Contract is here to simply pre-inject a contract ABI.


  1. provider - AbstractSocketProvider | HttpProvider | CustomProvider | String: A Web3.js provider.
  2. abi - Array: Contract ABI
  3. accounts - Accounts
  4. options - Web3ModuleOptions


import {MyABI, options} from '../folder/file.js';
import {Accounts} from 'web3-eth-accounts';
import {Contract} from 'web3-eth-contract';

export class MyContract extends Contract {
    constructor(provider) {
        super(provider, MyAbi, new Accounts(...), '0x0', options);