Skip to content

Commit

Permalink
Merge pull request blockchain-etl#21 from medvedev1088/develop
Browse files Browse the repository at this point in the history
Lower case all addresses addresses
  • Loading branch information
medvedev1088 authored Jun 5, 2018
2 parents da12012 + 9a15e0b commit 20dac90
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ block_sha3_uncles | hex_string |
block_logs_bloom | hex_string |
block_transactions_root | hex_string |
block_state_root | hex_string |
block_miner | hex_string |
block_miner | address |
block_difficulty | bigint |
block_total_difficulty | bigint |
block_size | bigint |
Expand All @@ -59,8 +59,8 @@ tx_nonce | bigint |
tx_block_hash | hex_string |
tx_block_number | bigint |
tx_index | bigint |
tx_from | hex_string |
tx_to | hex_string |
tx_from | address |
tx_to | address |
tx_value | bigint |
tx_gas | bigint |
tx_gas_price | bigint |
Expand All @@ -70,13 +70,15 @@ tx_input | hex_string |

Column | Type |
--------------------|--------------
erc20_token | hex_string |
erc20_from | hex_string |
erc20_to | hex_string |
erc20_token | address |
erc20_from | address |
erc20_to | address |
erc20_value | bigint |
erc20_tx_hash | hex_string |
erc20_block_number | bigint |

Note: for the `address` type all hex characters are lower-cased.

### Usage

If you want to export just a few thousand blocks and don't want to sync your own node
Expand Down
4 changes: 2 additions & 2 deletions ethereumetl/mappers/block_mapper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from ethereumetl.domain.block import EthBlock
from ethereumetl.mappers.transaction_mapper import EthTransactionMapper
from ethereumetl.utils import hex_to_dec
from ethereumetl.utils import hex_to_dec, to_normalized_address


class EthBlockMapper(object):
Expand All @@ -20,7 +20,7 @@ def json_dict_to_block(self, json_dict):
block.logs_bloom = json_dict.get('logsBloom', None)
block.transactions_root = json_dict.get('transactionsRoot', None)
block.state_root = json_dict.get('stateRoot', None)
block.miner = json_dict.get('miner', None)
block.miner = to_normalized_address(json_dict.get('miner', None))
block.difficulty = hex_to_dec(json_dict.get('difficulty', None))
block.total_difficulty = hex_to_dec(json_dict.get('totalDifficulty', None))
block.size = hex_to_dec(json_dict.get('size', None))
Expand Down
6 changes: 3 additions & 3 deletions ethereumetl/mappers/transaction_mapper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ethereumetl.domain.transaction import EthTransaction
from ethereumetl.utils import hex_to_dec
from ethereumetl.utils import hex_to_dec, to_normalized_address


class EthTransactionMapper(object):
Expand All @@ -10,8 +10,8 @@ def json_dict_to_transaction(self, json_dict):
transaction.block_hash = json_dict.get('blockHash', None)
transaction.block_number = hex_to_dec(json_dict.get('blockNumber', None))
transaction.index = hex_to_dec(json_dict.get('transactionIndex', None))
transaction.from_address = json_dict.get('from', None)
transaction.to_address = json_dict.get('to', None)
transaction.from_address = to_normalized_address(json_dict.get('from', None))
transaction.to_address = to_normalized_address(json_dict.get('to', None))
transaction.value = hex_to_dec(json_dict.get('value', None))
transaction.gas = hex_to_dec(json_dict.get('gas', None))
transaction.gas_price = hex_to_dec(json_dict.get('gasPrice', None))
Expand Down
4 changes: 2 additions & 2 deletions ethereumetl/service/erc20_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ def word_to_address(param):
if param is None:
return None
elif len(param) >= 40:
return '0x' + param[-40:]
return to_normalized_address('0x' + param[-40:])
else:
return param
return to_normalized_address(param)

0 comments on commit 20dac90

Please sign in to comment.