Skip to content

Instantly share code, notes, and snippets.

View 0xV4L3NT1N3's full-sized avatar

nic | nic.ethkl.eth 0xV4L3NT1N3

View GitHub Profile
@0xV4L3NT1N3
0xV4L3NT1N3 / history.js
Last active April 9, 2025 02:57
Get Address Full Transaction History
async function getAddressFullTransactionHistory() {
var address = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
var fullTransactions = []
var nextBlock = 0
while (true) {
const requestTransactions = await fetch(`https://api.etherscan.io/v2/api?chainid=1&module=account&action=txlist&address=${address}&startblock=${nextBlock}&endblock=latest&page=1&offset=1000&sort=asc&apikey=YourApiKeyToken`)
const transactions = await requestTransactions.json()
@0xV4L3NT1N3
0xV4L3NT1N3 / uni.js
Created March 17, 2025 17:50
Get Uniswap V4 Swaps
const ethers = require("ethers")
async function getUniswapV4Swaps() {
// get abi
const requestAbi = await fetch("https://api.etherscan.io/v2/api?chainid=1&module=contract&action=getabi&address=0xc7bbec68d12a0d1830360f8ec58fa599ba1b0e9b&apikey=YourApiKeyToken")
const abi = await requestAbi.json()
// get logs from ETH/USDC pair
@0xV4L3NT1N3
0xV4L3NT1N3 / ofac.js
Last active February 10, 2025 13:13
AML Check if Address Has Interacted with OFAC Santions
async function checkAML(address) {
// sanctioned addresses dataset
const sanctionedAddresses = [
'0x308ed4b7b49797e1a98d3818bff6fe5385410370',
'0x01e2919679362dfbc9ee1644ba9c6da6d6245bb1'
]
// get list of transactions on Ethereum, use chainId for other chains like Base
@0xV4L3NT1N3
0xV4L3NT1N3 / flaunch.js
Created February 6, 2025 10:56
Newly Flaunched Tokens
async function flaunch() {
// fetch transactions from etherscan
const query = await fetch(`https://api.etherscan.io/v2/api?chainid=8453&module=account&action=txlistinternal&address=0x6A53F8b799bE11a2A3264eF0bfF183dCB12d9571&startblock=0&endblock=99999999&page=1&offset=10&sort=desc&apikey=YourApiKeyToken`)
const data = await query.json()
// filter for second CREATE2 transaction, which is the token address
const flaunchedTokens = data.result
@0xV4L3NT1N3
0xV4L3NT1N3 / vyper.json
Created November 7, 2024 17:05
Sample Vyper JSON Input
{
"language":"Vyper",
"sources":{
"multijson.vy":{
"content":"# @pragma version ^0.4.0\n\"\"\"\n@title Another smart contract\n@author Some person on the internet\n@license none\n\"\"\"\n\nimport math\n# Other ways to import\n# import math as m\n# from . import math\n# from . import math as m\n\nstored_number: public(uint256)\n\n@deploy\ndef __init__():\n self.stored_number = 1\n\n@external\ndef call_math_mul(x: uint256, y: uint256):\n self.stored_number = math.mul(x, y)\n\n@view\n@external\ndef get_number() -> uint256:\n return self.stored_number"
},
"math.vy":{
"content":"# @pragma version ^0.4.0\r\n\r\n@pure\r\ndef mul(x: uint256, y: uint256) -> uint256:\r\n return x * y\r\n"
}
},
@0xV4L3NT1N3
0xV4L3NT1N3 / main.js
Created November 6, 2024 10:06
Get Total USDC Transfers Last Hour Sample
async function sumUSDCTransfers(chain, address) {
// get the latest block
const lastBlockQuery = await fetch(`https://api.etherscan.io/v2/api?chainid=${chain}&module=proxy&action=eth_blockNumber&apikey=YourApiKeyToken`)
const lastBlockData = await lastBlockQuery.json()
const lastBlock = Number(lastBlockData.result)
// get the past hour block
@0xV4L3NT1N3
0xV4L3NT1N3 / main.js
Created October 28, 2024 07:06
Get L2 Balances
async function main() {
// query ETH balances on Arbitrum, Base and Optimism
const chains = [42161, 8453, 10]
for (const chain of chains) {
// add your key here
@0xV4L3NT1N3
0xV4L3NT1N3 / result.json
Created May 2, 2024 03:04
Bitcoin Info CoinGecko
{
"id": "bitcoin",
"symbol": "btc",
"name": "Bitcoin",
"web_slug": "bitcoin",
"asset_platform_id": null,
"platforms": {
"": ""
},
"detail_platforms": {
{
"name": "Sloth Jazz",
"website": "https://www.example.com",
"description": "The smoothest restaking experience",
"logo": "https://gist.github.com/assets/33112835/3b6a5513-0e79-4ee5-be75-d75517017708",
"twitter": "https://x.com/example"
}
@0xV4L3NT1N3
0xV4L3NT1N3 / solidity-standard-json-input.json
Created March 16, 2024 07:47
Sample Solidity Json Input for Etherscan Verification
{
"language": "Solidity",
"sources": {
"contracts/Verified.sol": {
"content": "//SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.18;\r\n\r\ncontract Verified {\r\n string public greet =\r\n \"Increase this counter if you completed this tutorial\";\r\n string public tutorial =\r\n \"https://docs.etherscan.io/contract-verification/multichain-verification\";\r\n\r\n uint256 public verified = 0;\r\n\r\n function completedTutorial() public {\r\n verified += 1;\r\n }\r\n}\r\n"
}
},
"settings": {
"metadata": {
"bytecodeHash": "none"