It’s worth elaborating on this a bit. While a blockchain could be described as a “computer file”, that’s not really a helpful way of looking at it.
A blockchain is a decentralized ledger. Just like a normal ledger, it contains entries like “transfer $X from account A to account B”. But it can also contain entries like “A is now the owner of this digital object”. That’s where the NFTs come from.
Every computer participating in the blockchain network has a copy of the ledger, so everyone can easily see who is the owner of what. The name “blockchain” gives some hints as to how it works:
- Ledger entries are bundled into blocks
- Each block references the previous block, forming it into a chain
The reference consists of what’s called a hash. The details are a little hairy, but consider what you get if you have a list of numbers and add them all together. You get a single output number that will change if any of the inputs change. You can carry this along with future transactions, and thus keep a kind of compressed history of all previous transactions.
Now, the example I gave would be a really bad hash to use in practice, because if someone wanted to alter the past, they could subtract a number from one transaction and add it to another, and the total sum would be the same. Cryptographically secure hashes don’t allow this. They’re designed so that it’s nearly impossible to construct a record that hashes to a specific value.
In this way, the blockchain prevents anyone from altering the past. If they tried it, everyone would notice that the hashes from all future blocks no longer match. As long as most computers on the network are honest, the system works.
The blockchain is also designed to require a certain amount of work to compute a new block. That way, someone trying to alter the past couldn’t just alter a record, and then recompute all new records up to the present day. It takes the combined efforts of the whole network to compute a new block, so a single party trying to create a fake transaction history would need much higher computing resources than the entire rest of the network combined. That’s impractical for any popular blockchain.