Are ordinals just serial numbers attached to specific satoshis?
As I understand it yes. The serial numbers are assigned to transaction outputs.
As I understand it, when an output is spent in a later transaction, the serial number assignment algorithm effectively transfers the serial number from each input to the next sequential output. See draft BIP
When satoshis are spent in a transaction, the input satoshi
ordinal numbers are assigned to output satoshis using a simple
Note that normally there is no guaranteed correspondence of this sort in Bitcoin transactions. I believe many (most? all?) wallets deliberately scramble the order of outputs for better privacy.
Does this not affect the fungibility of sats?
No, because, as I understand it, the transfer of this serial number from one UTXO to another is arbitrary for any transaction created by normal wallets
By normal wallets I mean wallets other than the specific wallet used for the purpose of assigning these particular serial numbers to satoshis and transferring them.
If, for example, one Bitcoin transaction combines a payment from A to B with an unrelated payment from P to Q, the serial number of A might transfer to P not to B. So the fungibility for normal electronic cash purposes should be unaffected. Normal bitcoin use produces many such transactions from mixers, coinjoins, exchange batching, etc.
Even in the simplest normal transaction with one input, a payment output and a change output, the serial number might be assigned to the recipient amount or to the sender's returned change.
The transfer of the serial number does not necessarily correspond to any underlying real-world transaction and often won't.
The exception is of course transactions created by the special wallet whose purpose is to carefully order transaction outputs to specifically correspond with the project's algorithm's rules for transfers of this serial number. For this particular wallet, the aim is non-fungibility of any associated token - though they claim the fungibility of the associated money is unaffected - which I suspect would only be true when that money is spent in a normal wallet.
are the various files (e.g. images) that are now linked to certain satoshis (through this ordinal system?) actually present in the witness data that I store when running my node?
Yes, the images (and other objects) listed in ordinals.com/inscriptions are stored in every full Bitcoin node. See comments and addendum to Follow-up to Segwit: Arbitrary data storage in witness?
Footnote: I am not very familiar with this project so the above might be wrong in some important aspect. What I wrote seems to make sense to me.