BC548 as switch 12v

i have a relay that needs 12v to turn on the coil. Im using esp8266 and only can supply 3.3v to the coil directly. I am think about building a npn transistor switch with BC548 and i have drawn a schematic that i think will work. i only have 1 more BC548 so i would like to ask, will this work? i bench tested the relay and it consumes 0.038 amps to operate the coil

I found a datasheet for the relay if that helps

Don't forget to add the freewheel diode over the relay coil!

Something like circuit A1

The motor would be replaced by your relay.

what is the point of double transistors on b1?

That is what they call a Darlington pair configuration.

The transistor arrangement gives high gain, however, the Vbe drop will be ~1.2V and Vce(sat) is ~2V @2A.

If driver to the transistor is easily loaded, a darlington transistor might be the solution for your application..

An example of the all in one package is the TIP122, has a gain of ~1000.
(1ma base current gives 1 amp collector current)
Has a continuous Ic of 5 amps.

For more current handling. A single BJT used as a switch can only drive an output current thats 10 to 20 times the control current, which for a microcontroller with pins that only handle a few mA can be very restrictive. A Darlington pair has a switching gain of 1000 or more.

The downside is the much higher power dissipation in the switch as the saturation on-voltage is over 1V, rather than perhaps 0.1V for a single BJT.

In general a MOSFET is more performant than either though, able to switch higher currents with lower losses and without taking current from the microcontroller pin.
However you do need a logic-level MOSFET for direct drive from a microcontroller.