I have a contract. I store data in ethereum using contract. Is it possible, to work with contract in git-like way. For example, i have a list of previous transaction hashes. Can i fetch data from any specific transaction using web3j for example?
-
1yes, but what is the specific question ? obtain data from transaction or specific value from one contract?– GaweyJul 28, 2017 at 9:47
-
1Gawey, obtain data from specific transaction. I can not add a comment unfortunately. It was me, who asked the question– Ilya KhudyakovJul 28, 2017 at 9:56
-
1Moderator deleted comment conversation. Hey! I can not comment to the first post! But anyways, Gawey, Thank you so much for your answers and links :)– Ilya KhudyakovJul 28, 2017 at 10:59
2 Answers
BTW, how i did it using web3j:
Dto dto = new Dto();
Observable<EthTransaction> observable = getWeb3().ethGetTransactionByHash(transactionHash).observable();
observable.subscribe(ethTransaction -> ethTransaction.getTransaction().ifPresent(dto::setTransaction));
return dto.getTransaction();
So, here is transaction with specific tx hash. Then simply getInput() to get data from transaction
QuickBlocks (http://quickblocks.io) provides a number of command line tools that you might find interesting. You can do this from the command line for example:
getBlock 4100010
and it will print that block to the console. Or,
getTransaciton 0xhashhash
and it will print that transaction to the screen. Other tools include getTrace
, getReciept
, getBloom
, isContract
, whenBlock
, among others. It's also a C++ programming library, so you can write code against it.
Public service announcement: I work for QuickBlocks.