Coinmonks
Published in

Coinmonks

Commanding the Line

Many of us live and work on the Linux command line.

Using Linux Pipes

chifra export --cache --articulate \
--first_block 12550000 --last_block 13520000 \
--fmt csv 0x6b175474e89094c44da98b954eedeac495271d0f | \
grep 'approve' | \
tr -d '"' | \
cut -d ',' -f1,2,5,6,13-20 \
> dai_uniswapv2_approvals.csv

Can We Improve on This?

How?

chifra export --fmt csv \
--articulate 0x6b175474e89094c44da98b954eedeac495271d0f

Filtering Records for Approvals

chifra export [flags] \
<address> [address...] [topics...] [fourbytes...]
chifra abis 0x6b175474e89094c44da98b954eedeac495271d0f | grep approve
fourbyte       type         name        signature
-----------------------------------------------------------------
0x095ea7b3 function approve approve(address,uint256)
chifra export --fmt csv --articulate \
0x6b175474e89094c44da98b954eedeac495271d0f \
0x095ea7b3

Field Selection

DISPLAY_FORMAT="[{BLOCKNUMBER}]" \
chifra export --fmt txt --articulate \
0x6b175474e89094c44da98b954eedeac495271d0f \
0x095ea7b3 2>/dev/null
DISPLAY_FORMAT="[{BLOCKNUMBER}][{TRANSACTIONINDEX}]" \
chifra export --fmt csv --articulate \
0x6b175474e89094c44da98b954eedeac495271d0f \
0x095ea7b3 2>/dev/null
DISPLAY_FORMAT="[{BLOCKNUMBER}]\t[{TRANSACTIONINDEX}]\t[{FROM}]\t[{TO}]\t[{COMPRESSEDTX}]" \
chifra export --articulate \
0x6b175474e89094c44da98b954eedeac495271d0f \
0x095ea7b3 2>/dev/null
blocknumber    transactionindex   from   to   compressedtx

Storing the Results in a File

DISPLAY_FORMAT="[{BLOCKNUMBER}]\t[{TRANSACTIONINDEX}]\t[{FROM}]\t[{TO}]\t[{COMPRESSEDTX}]" \
chifra export --articulate \
0x6b175474e89094c44da98b954eedeac495271d0f \
0x095ea7b3 --output dai_uniswapv2_approvals.csv

Performance

chifra list --count 0x6b175474e89094c44da98b954eedeac495271d0f`

Support Our Work

Join Coinmonks Telegram Channel and Youtube Channel learn about crypto trading and investing

Also, Read

--

--

Coinmonks (http://coinmonks.io/) is a non-profit Crypto Educational Publication. Follow us on Twitter @coinmonks and Our other project —  https://coincodecap.com, Email  — gaurav@coincodecap.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Thomas Jay Rush

Blockchain Enthusiast, Founder TrueBlocks, LLC and Philadelphia Ethereum Meetup, MS Computer Science UPenn