For this problem, I used double linked list instead of linked list because with double linked list, it is easier to access the previous hash.
The complexity of the algorithm is basically constant since the operations are appending to the tail of the double linked list, and accessing previous hash of a node.
The space complexity of the algorithm is linear i.e. O(n), where n is size of the blockchain.