4

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).

2 Answers 2

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
2
  • 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, 2016 at 6:54
  • Yes, remove the "if" statement and it will output all transactions.
    – Sebi
    Jul 29, 2016 at 8:47
2

try https://etcchain.com/api

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.