Does the fan needs the blue and yellow wires to work properly? Can I unplug these two wires and put a potentiometer in the red and black wires?
Yes and no.
Yellow is the tachometer feedback into the miner and tells the controller how fast the fan runs. Blue is the speed control signal. Red & black are DC power in.
4 wire fans use a speed controller inside of the fan itself to chop the 12v power as needed to set speed so just using a (high power, remember the fans take several amps of current) pot in series with the power MIGHT not work.
That brings up the fact that there are 2 types of 4-wire fans: The most common will run at full speed in the absence of a signal on the blue wire - signal on the blue
slows it down.To test, cut the blue wire. If it goes full speed only then can you fiddle with an external speed control to reduce the red wire +12v.
If the fan runs at a very low speed it is the 2nd type that uses a signal on the blue wire to speed it up and that is what you have to modulate.