How do you add 40 bytes of data into the blockchain?
You can use the OP_RETURN opcode.
An output that has a spending script of "OP_RETURN <up to 40 bytes>" will be accepted by miners.
It is not spendable though, since OP_RETURN just means mark output as invalid.
There are other ways to do it, but using OP_RETURN means you aren't "polluting" the chain. Since the output is known not to be spendable, it doesn't have to be remembered in RAM. It is still remembered on disk though.