Skip to content

Instantly share code, notes, and snippets.

View taylorjdawson's full-sized avatar
🤘

Taylor Dawson taylorjdawson

🤘
  • Portland
  • 08:20 (UTC -07:00)
  • X @tjd_im
View GitHub Profile
// 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.
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');
@taylorjdawson
taylorjdawson / supported_methods.md
Last active August 29, 2019 21:50
simple supported methods
Feature Web3.js Ethers.js Web3data.js
getHashrate ×
getGasPrice
getAccounts ×
getBlockNumber
getBalance
getStorageAt
getCode
getBlock
@taylorjdawson
taylorjdawson / AmberdataChainlink.sol
Created May 20, 2019 22:27
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
@taylorjdawson
taylorjdawson / AmberdataChainlink.sol
Created May 20, 2019 19:48
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
@taylorjdawson
taylorjdawson / AmberdataChainlink.sol
Created May 20, 2019 19:48
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
@taylorjdawson
taylorjdawson / address-activity.js
Created April 23, 2019 21:59
Amberdata API Example - Transactions, Logs, Functions
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()]
@taylorjdawson
taylorjdawson / address-logs.js
Created April 23, 2019 21:27
Amberdata API Example - Address Logs
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": [
{
@taylorjdawson
taylorjdawson / address-metadata.js
Last active April 23, 2019 21:27
Amberdata API Example - Address Metadata
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"],