One of the biggest problems with hiring a contractor is ensuring he or she is actually paying for supplies and labor with the money you pay. Even if you have the contractor sign a lien waiver or release, there is no guarantee or way to check if people he hired or purchased from were paid. Suppliers provide credit, and generally ask which job the supplies are for. That way, if the supplier is not paid, they know which property to lien. The only way you, as the homeowner, can verify the materials were for your job is to ask to see the invoices. However, to solve your problem, you have three options....don't pay, and sue the electrician. The risk there is that a lien generally gives the supplier the right to foreclose. Option two is to pay the supplier, and sue the electrician. Or option three, do nothing, and hope the amount of the lien is not something the supplier would pay to have a foreclosure action started. Problem there is that if the supplier is owed a lot of money by the electrician, on other jobs, it may be worth it to foreclose.
Since lien laws differ in every state, you will want to talk to an attorney to discuss your options. But I respectfully disagree with the suggestions above. Even if you ask for a holdback AND have the contractor sign a lien release or waiver, it still is as worthless as the piece of paper signed....nothing prevents the contractor from lying and telling you he's paid everyone, and the lien release signed by the contractor does not prevent third parties whom he hasn't paid from filing a lien. The best way to protect yourself is to ensure the contractor you hire is reputable by asking for references from both clients and major suppliers.