Each block contains a timestamp as well as a link to the previous blocks and a hashcode. When a transaction occurs, it gets added to the next block. This process continues till the last block is created. At this point, the blockchain becomes immutable.