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

**URL:** <https://discuss.elastic.co/t/ethereum-event-logs-need-to-store-values-which-are-2-256-1-as-integers-not-text/166799>\
**Category:** Elasticsearch\
**Created:** [February 2, 2019, 12:24am UTC](https://discuss.elastic.co/t/ethereum-event-logs-need-to-store-values-which-are-2-256-1-as-integers-not-text/166799 "2019-02-02T00:24:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpmccallum](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tpmccallum/32/40499_2.png) [@tpmccallum](https://discuss.elastic.co/u/tpmccallum)\
**Post date:** [February 2, 2019, 12:24am UTC](https://discuss.elastic.co/t/ethereum-event-logs-need-to-store-values-which-are-2-256-1-as-integers-not-text/166799/1 "2019-02-02T00:24:17Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![tpmccallum](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tpmccallum/32/40499_2.png) [@tpmccallum](https://discuss.elastic.co/u/tpmccallum)\
**Post date:** [February 2, 2019, 2:29am UTC](https://discuss.elastic.co/t/ethereum-event-logs-need-to-store-values-which-are-2-256-1-as-integers-not-text/166799/2 "2019-02-02T02:29:42Z")

</div>

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

I have also been following \< [https://thegraph.com/](https://thegraph.com/) \> and \< [https://infura.io/](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](https://github.com/EOSIO/demux-js#data-flow) \>

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 2, 2019, 2:29am UTC](https://discuss.elastic.co/t/ethereum-event-logs-need-to-store-values-which-are-2-256-1-as-integers-not-text/166799/3 "2019-03-02T02:29:51Z")

</div>

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