For E-Bikes at least communication between the engine and the battery pack is encrypted and you can't replace either without the manufacturer's consent.