Hello and welcome.
With the conditions you are describing, this sounds like a bad PCM..
A flashing check engine light is the tell-tale sign of this.
If it were a ground problem, the engine would not crank good as you have described.
Relays clicking under the hood and in the dash normally are because of a low voltage condition, but this is not case here, because it cranks good.
Fuel pump constantly running with the key ON is another sign. The PCM controlls the fuel pump relay.