I am trying to make an invisible pig that I can put a lead on. How?

Solution 1:

/give @s pig_spawn_egg{EntityTag:{Silent:1b,Invulnerable:1b,PersistenceRequired:1b,NoAI:1b,ActiveEffects:[{Id:14b,Amplifier:1b,Duration:20000000,ShowParticles:0b}]}} 1

You can rely on mcstacker.net for lots of things using commands. This will give you a pig spawn egg that is silent, unkillable, doesn't despawn, and doesn't move. It also has the invisibility effect, and doesn't show the invisibility particles.