What exactly are you looking for, a walkthrough or an example?
The simplest way would to take a transaction spending a P2PKH output and injecting an arbitrary message at the beginning of its signature script.
The simplest way would to take a transaction spending a P2PKH output and injecting an arbitrary message at the beginning of its signature script.
Just a technical explanation. I don't get how you would "take a transaction". In my understanding, an unconfirmed transaction exists on a multitude of miners working to find a new block. So that only works for me if we are the miner ourselves and also successful in finding the block that ultimately prevails in the blockchain.