Lightning arrows in minecraft using execute command

Solution 1:

Named arrows don't keep their name data after being shot, so you would have to use data from a tipped arrow in specifying where to summon lightning.

I am using a custom potion color so the item can't be crafted, and this color would be kept in the arrow entity data.

/give @p tipped_arrow{CustomPotionColor:16776960,CustomPotionEffects:[{Id:15,Duration:1,Amplifier:0}],display:{Name:'[{"text":"vajra"}]'}} 1

Then you can use a selector to summon lightning at arrows with this custom color.

/execute at @e[nbt={Color:16776960,inGround:1b}] run summon minecraft:lightning_bolt