web3.js - 以太坊 JavaScript API¶
web3.js 是一组使用HTTP或IPC连接来和本地或远程以太坊节点进行交互的库。
译者注:如果我们使用JavaScript 来开发 DApp时,很多时候需要使用到 web3.js (当然也可以选择使用 ethers.js )。
这份文档有两个部分: 安装和运行web3.js 指导我们如何导入web3.js ,而 接口文档 API 说明了接口的时候,同时也包含了大量的实例。
内容:
- 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
- transactionConfirmationBlocks
- transactionPollingTimeout
- handleRevert
- getProtocolVersion
- isSyncing
- getCoinbase
- isMining
- getHashrate
- getGasPrice
- 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
- web3.eth.subscribe
- web3.eth.Contract
- new contract
- = 属性列表 =
- defaultAccount
- defaultBlock
- defaultHardfork
- defaultChain
- defaultCommon
- transactionBlockTimeout
- transactionConfirmationBlocks
- transactionPollingTimeout
- handleRevert
- 选项属性
- options.address
- options.jsonInterface
- = 方法 =
- clone
- deploy
- methods
- methods.myMethod.call
- methods.myMethod.send
- methods.myMethod.estimateGas
- methods.myMethod.encodeABI
- = 事件 =
- once
- events
- events.allEvents
- getPastEvents
- web3.eth.accounts
- web3.eth.personal
- web3.eth.ens
- 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
- 布隆过滤器
- randomHex
- _
- BN
- isBN
- isBigNumber
- sha3
- sha3Raw
- soliditySha3
- soliditySha3Raw
- isHex
- isHexStrict
- isAddress
- toChecksumAddress
- checkAddressChecksum
- toHex
- toBN
- hexToNumberString
- hexToNumber
- numberToHex
- hexToUtf8
- hexToAscii
- utf8ToHex
- asciiToHex
- hexToBytes
- bytesToHex
- toWei
- fromWei
- unitMap
- padLeft
- padRight
- toTwosComplement