It has been found that Ni forms ohmic contacts and Ti forms Schottky-barrier contacts to boron nanowires. Using two-step electron beam lithography, Ni and Ti electrodes are subsequently attached onto the ends of a single boron nanowire. As a result, a nanoscale rectifier is created using a boron nanowire.