Feature | Web3.js | Ethers.js | Web3data.js |
---|---|---|---|
getHashrate | ✓ | × | ✓ |
getGasPrice | ✓ | ✓ | ✓ |
getAccounts | ✓ | ✓ | × |
getBlockNumber | ✓ | ✓ | ✓ |
getBalance | ✓ | ✓ | ✓ |
getStorageAt | ✓ | ✓ | ✓ |
getCode | ✓ | ✓ | ✓ |
getBlock | ✓ | ✓ | ✓ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We need a function that will evaluate the order that a set of tasks will be completed in. | |
// When idle, the CPU will take the next task that has been queued with the lowest time to complete. | |
// Tasks are queued at the moment in time given by queued_at. | |
// Tasks will keep the CPU busy for execution_duration units of time. queued_at and execution_duration are not in a particular unit of time, | |
// but you may consider them in seconds, milliseconds, or whatever makes sense to you. | |
// The CPU can only execute 1 task at a time. | |
// You can use anything from Rust's std library. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('dotenv').config(); // Load your environment variables with 'dotenv' | |
const EthereumTx = require('ethereumjs-tx').Transaction; | |
const { privateToAddress } = require('ethereumjs-util'); | |
const Web3Data = require("web3data-js"); | |
const w3d = new Web3Data(process.env.API_KEY); | |
const TO_ADDRESS = 'YOUR_ADDRESS'; | |
const API_KEY = 'YOUR_API_KEY'; // Need one? see amberdata.io/onboarding | |
const PRIV_KEY = Buffer.from('YOUR_PRIVATE_KEY', 'hex'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
import './ChainlinkClient.sol'; | |
contract AmberdataChainlink is ChainlinkClient { | |
bytes32 constant JOB_ID = bytes32("447f3b6fac1240ab91d3679fba00baf6"); | |
uint256 public currentPrice; | |
constructor() public { | |
setChainlinkToken(0x20fE562d797A42Dcb3399062AE9546cd06f63280); | |
setChainlinkOracle(0xc99B3D447826532722E41bc36e644ba3479E4365); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: @ensdomains/buffer/contracts/Buffer.sol | |
pragma solidity >0.4.18; | |
/** | |
* @dev A library for working with mutable byte buffers in Solidity. | |
* | |
* Byte buffers are mutable and expandable, and provide a variety of primitives | |
* for writing to them. At any time you can fetch a bytes object containing the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: @ensdomains/buffer/contracts/Buffer.sol | |
pragma solidity >0.4.18; | |
/** | |
* @dev A library for working with mutable byte buffers in Solidity. | |
* | |
* Byte buffers are mutable and expandable, and provide a variety of primitives | |
* for writing to them. At any time you can fetch a bytes object containing the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: @ensdomains/buffer/contracts/Buffer.sol | |
pragma solidity >0.4.18; | |
/** | |
* @dev A library for working with mutable byte buffers in Solidity. | |
* | |
* Byte buffers are mutable and expandable, and provide a variety of primitives | |
* for writing to them. At any time you can fetch a bytes object containing the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let config = {headers: {"x-api-key": "YOUR_API_KEY_HERE"}} | |
let getAddressTransactions = axios.get('https://web3api.io/api/v1/addresses/ETHEREUM_ADDRESS_HERE/transactions', config) | |
let getAddressLogs = axios.get('https://web3api.io/api/v1/addresses/ETHEREUM_ADDRESS_HERE/logs', config) | |
let getAddressFunctions = axios.get('https://web3api.io/api/v1/addresses/ETHEREUM_ADDRESS_HERE/functions', config) | |
let responses = await Promise.all([getAddressTransactions(), getAddressLogs(), getAddressFunctions()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
axios({ | |
method:'get', | |
url: 'https://web3api.io/api/v1/addresses/ETHEREUM_ADDRESS_HERE/logs', | |
headers: { 'x-api-key': 'YOUR_API_KEY_HERE' } | |
}).then(res => { | |
// response data example: | |
{ | |
"totalRecords": 6448870, | |
"records": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
axios({ | |
method:'get', | |
url: 'https://web3api.io/api/v1/addresses/ETHEREUM_ADDRESS_HERE/metadata', | |
headers: { 'x-api-key': 'YOUR_API_KEY_HERE' } | |
}).then(res => { | |
// response data example: | |
// { | |
// "firstSeen": "2017-11-23T05:41:19.000Z", | |
// "type": "contract", | |
// "contractTypes": ["ERC721"], |
NewerOlder