3

Now that the hard fork is complete, there are two blockchains - the forked one for ETH (at 1920000) and the original is for the ETC.

The etherscan.io provide an api to get list of transactions for ETH but I do not think that they will support the non forked blockchain (ETC).

devsubhro
  • 87
  • 8

2 Answers2

2

You can modify (remove tx if in for loop) the following function to get all transactions between a starting and an end block:

function getTransactionsByAccounts(myaccount, startBlockNumber, endBlockNumber) {
  if (endBlockNumber == null) {
    endBlockNumber = eth.blockNumber;
    console.log("Using endBlockNumber: " + endBlockNumber);
  }
  if (startBlockNumber == null) {
    startBlockNumber = endBlockNumber - 1000;
    console.log("Using startBlockNumber: " + startBlockNumber);
  }
  console.log("Searching for transactions to/from account \"" + myaccount + "\" within blocks "  + startBlockNumber + " and " + endBlockNumber + "\"");

  for (var i = startBlockNumber; i <= endBlockNumber; i++) {
    if (i % 1000 == 0) {
      console.log("Searching block " + i);
    }
    var block = eth.getBlock(i, true);
    if (block != null && block.transactions != null) {
      block.transactions.forEach( function(e) {
        if (myaccount == "*" || myaccount == e.from || myaccount == e.to) {
          console.log("  tx hash          : " + e.hash + "\n"
            + "   nonce           : " + e.nonce + "\n"
            + "   blockHash       : " + e.blockHash + "\n"
            + "   blockNumber     : " + e.blockNumber + "\n"
            + "   transactionIndex: " + e.transactionIndex + "\n"
            + "   from            : " + e.from + "\n" 
            + "   to              : " + e.to + "\n"
            + "   value           : " + e.value + "\n"
            + "   gasPrice        : " + e.gasPrice + "\n"
            + "   gas             : " + e.gas + "\n"
            + "   input           : " + e.input);
        }
      })
    }
  }
}

and use a recent version of geth (i.e. 1.4.1) with the following flag set:

--oppose-dao-fork   # Updates the chain rules to oppose the DAO hard-fork
Sebi
  • 5,294
  • 6
  • 27
  • 52
  • You mentioned "remove tx if in for loop". Do you mean "skip the transaction if the transaction hash was found in previous iteration of the for loop"? – devsubhro Jul 29 '16 at 06:54
  • Yes, remove the "if" statement and it will output all transactions. – Sebi Jul 29 '16 at 08:47
1

try https://etcchain.com/api

include ethereum classic block, transaction, price,miner index,Hope you like it.

etcchain
  • 11
  • 2
  • This should have been the accepted answer but I already accepted another answer. However I upvoted it. – devsubhro Aug 22 '16 at 10:44
  • Two years later... thanks. Does it have testnet/morden version? also ssl access certificate is complaining. –  May 11 '18 at 06:34