Ethereum event logs (need to store values which are 2^256 -1 as integers - not text)

How does Elasticsearch store blockchain token amounts (which like Ethereum have 18 decimal places)?
For example the uint256 variable in an Ethereum smart contract is 2^256 -1.
So 1 ETH is physically stored in the blockchain as 1000000000000000000, 1 hundred ETH is stored as 100000000000000000000 and going back the other way, one tenth of an ETH is stored as 100000000000000000
As I understand it, the biggest numerical value Elasticsearch can store is 2^63 - 1.
I am in the process of harvesting all of the event logs from the Ethereum mainnet and need to store results such as the following.
{
"_index": "uniswap_exchange_events",
"_type": "event",
"_id": "0xf4b7722ead4cb986932ef5d874fc3c421fd2573c5d9cb30741699bb1c2e47818",
"_score": 1,
"_source": {
"name": "EthPurchase",
"jsonEventObject": {
"address": "0xA2881A90Bf33F03E7a3f803765Cd2ED5c8928dFb",
"blockHash": "0x65e34db0404c6c4d55fdb7accef2213d57cedc8d4f4f0881a5b7e6bd5f7686ce",
"blockNumber": 7003492,
"logIndex": 34,
"removed": false,
"transactionHash": "0x3fbfec5761f343a55ddc30373fdd8eaac245aacf3ae62a8350397fabc81fe4c2",
"transactionIndex": 44,
"id": "log_e8c1158d",
"returnValues": {
"0": "0xc0BC051EB97fb2BcB70759582B171b2A9b858c14",
"1": "20000000000000000",
"2": "19889592583232868",
"buyer": "0xc0BC051EB97fb2BcB70759582B171b2A9b858c14",
"tokens_sold": "20000000000000000",
"eth_bought": "19889592583232868"
},
"event": "EthPurchase",
"signature": "0x7f4091b46c33e918a0f3aa42307641d17bb67029427a5369e54b353984238705",
"raw": {
"data": "0x",
"topics": [
"0x7f4091b46c33e918a0f3aa42307641d17bb67029427a5369e54b353984238705",
"0x000000000000000000000000c0bc051eb97fb2bcb70759582b171b2a9b858c14",
"0x00000000000000000000000000000000000000000000000000470de4df820000",
"0x0000000000000000000000000000000000000000000000000046a97aa4a69d64"
]
}
}
}
}
I have learned that the values such as tokens_sold and eth_bought are being indexed as text (by default). If I create a mapping to long or decimal the harvest fails because the numbers are too big.
The reason why this is important is that we want to create filters like "if the token is less than 112345678912345678 then ..." etc. However at present this is not possible (because Elastic and Kibana can only process these length amounts as text).
Any advice would be brilliant, thank you!

I created this issue over on the Elasticsearch GitHub https://github.com/elastic/elasticsearch/issues/38242

I have also been following < https://thegraph.com/ > and < https://infura.io/ > for a while. The Graph and Infura seem like the most polished products which are in the business of harvesting Ethereum's event log data and also providing Ethereum DApps with this information.

Also just FYI the EOS equivalent of the above would be something like demux < https://github.com/EOSIO/demux-js#data-flow >

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.