web3.js - Ethereum JavaScript API¶
web3.js is a collection of libraries that allow you to interact with a local or remote ethereum node using HTTP, IPC or WebSocket.
The following documentation will guide you through installing and running web3.js as well as providing an API reference documentation with examples.
Note
Web3.js 4.x has been released. Checkout 4.x API documentation and migration guide for testing, early feedback and contributions.
Contents:
- Web3
- web3.eth
- Note on checksum addresses
- subscribe
- Contract
- Iban
- personal
- accounts
- ens
- abi
- net
- setProvider
- providers
- givenProvider
- currentProvider
- BatchRequest
- extend
- defaultAccount
- defaultBlock
- defaultHardfork
- defaultChain
- defaultCommon
- transactionBlockTimeout
- blockHeaderTimeout
- transactionConfirmationBlocks
- transactionPollingTimeout
- transactionPollingInterval
- handleRevert
- maxListenersWarningThreshold
- getProtocolVersion
- isSyncing
- getCoinbase
- isMining
- getHashrate
- getGasPrice
- getFeeHistory
- getAccounts
- getBlockNumber
- getBalance
- getStorageAt
- getCode
- getBlock
- getBlockTransactionCount
- getBlockUncleCount
- getUncle
- getTransaction
- getPendingTransactions
- getTransactionFromBlock
- getTransactionReceipt
- getTransactionCount
- sendTransaction
- sendSignedTransaction
- sign
- signTransaction
- call
- estimateGas
- getPastLogs
- getWork
- submitWork
- requestAccounts
- getChainId
- getNodeInfo
- getProof
- createAccessList
- web3.eth.subscribe
- web3.eth.Contract
- new contract
- = Properties =
- defaultAccount
- defaultBlock
- defaultHardfork
- defaultChain
- defaultCommon
- transactionBlockTimeout
- blockHeaderTimeout
- transactionConfirmationBlocks
- transactionPollingTimeout
- transactionPollingInterval
- handleRevert
- options
- options.address
- options.jsonInterface
- = Methods =
- clone
- deploy
- methods
- methods.myMethod.call
- methods.myMethod.send
- methods.myMethod.estimateGas
- methods.myMethod.encodeABI
- methods.myMethod.createAccessList
- = Events =
- once
- events
- events.allEvents
- getPastEvents
- web3.eth.accounts
- web3.eth.personal
- web3.eth.ens
- registryAddress
- registry
- resolver
- getResolver
- setResolver
- getOwner
- setOwner
- getTTL
- setTTL
- setSubnodeOwner
- setRecord
- setSubnodeRecord
- setApprovalForAll
- isApprovedForAll
- recordExists
- getAddress
- setAddress
- getPubkey
- setPubkey
- getContent
- setContent
- getContenthash
- setContenthash
- getMultihash
- supportsInterface
- setMultihash
- ENS events
- web3.eth.Iban
- web3.eth.abi
- web3.*.net
- web3.bzz
- web3.shh
- setProvider
- providers
- givenProvider
- currentProvider
- BatchRequest
- extend
- getId
- isListening
- getPeerCount
- getVersion
- getInfo
- setMaxMessageSize
- setMinPoW
- markTrustedPeer
- newKeyPair
- addPrivateKey
- deleteKeyPair
- hasKeyPair
- getPublicKey
- getPrivateKey
- newSymKey
- addSymKey
- generateSymKeyFromPassword
- hasSymKey
- getSymKey
- deleteSymKey
- post
- subscribe
- clearSubscriptions
- newMessageFilter
- deleteMessageFilter
- getFilterMessages
- web3.utils
- Bloom Filters
- randomHex
- BN
- isBN
- isBigNumber
- sha3
- sha3Raw
- soliditySha3
- soliditySha3Raw
- isHex
- isHexStrict
- isAddress
- toChecksumAddress
- checkAddressChecksum
- toHex
- stripHexPrefix
- toBN
- hexToNumberString
- hexToNumber
- numberToHex
- hexToUtf8
- hexToAscii
- utf8ToHex
- asciiToHex
- hexToBytes
- bytesToHex
- toWei
- fromWei
- unitMap
- padLeft
- padRight
- toTwosComplement
Special thanks to Netlify for providing build and deploy services for our end-to-end integration tests.