A railgun is an entirely electrical gun
A gun is a muzzle or breech-loaded projectile-firing weapon. There are various definitions depending on the nation and branch of service. A "gun" may be distinguished from other firearms in being a crew-served weapon such as a howitzer or mortar, as opposed to a small arm like a rifle or pistol,...

 that accelerates a conductive projectile along a pair of metal rails using the same principles as the homopolar motor
Homopolar motor
A homopolar motor is an electric motor that works without the need for a commutator, by rotating along a fixed axis that is parallel to the external magnetic field produced by a permanent magnet. The name homopolar indicates that the electrical polarity of the motor does not change...

. Railguns use two sliding or rolling contacts that permit a large electric current
Electric current
Electric current is a flow of electric charge through a medium.This charge is typically carried by moving electrons in a conductor such as wire...

 to pass through the projectile. This current interacts with the strong magnetic fields generated by the rails and this accelerates the projectile. Particular characteristics are the lack of propellant (only the projectile and the electrical energy to launch it are required to be expended) and the ability to launch projectiles much faster than firearms-based technology allows.

Railguns have long existed as experimental and demonstrator technology.