In order to calculate pipe diameter you should know pipe length to check pressure drop through it. Also if some resistances (valves, elbows, tee, valves etc.) are present it should be known also as well as entrance and exit height differences.
But for the reference you can assume some velocity that should not be higher. For gas flowing I would suggest maximum of 10 m/s (or maybe less). With that assumption you can use pipe diameter calculator to calculate pipe diameter at:
http://www.pipeflowcalculations.com/flowrate/
In calculator you should enter flow rate at real conditions. You said that the flow is 8000 normal m3/h, and that pressure is 5 kPa with temperature 500 C. To calculate flow ate real conditions I have used same calculator first to calculate relation between density at normal and on your conditions by entering pressures and temperatures. Here are results from report for normal conditions:
6. pressure of gas (p): p : 101.325 kPa
7. density (ρ): ρ : 0.71513265 kg/m3
8. temperature (T): T : 0 C
9. gas constant (R): R : 519 J/kgK
and for your conditions is:
6. pressure of gas (p): p : 106.325 kPa
7. density (ρ): ρ : 0.26502603 kg/m3
8. temperature (T): T : 500 C
9. gas constant (R): R : 519 J/kgK
so at your conditions density is 0.265/0.715 = 0.37 times lower so actual volume flow rate is that much higher than on normal conditions
Q = 8000 / 0.37 = 21621 m3/h.
Now with this flow rate in calculator you have following results:
1. volumetric flow rate (q):
q : 21621 m3/h
2. mass flow rate (w):
w : 5730.128 kg/h
3. diameter (D):
D : 874.4638 mm
4. velocity (v):
v : 10 m/s
5. cross section area (A):
A : 600583.8 mm2
6. pressure of gas (p):
p : 106.325 kPa
7. density (ρ):
ρ : 0.26502603 kg/m3
8. temperature (T):
T : 500 C
9. gas constant (R):
R : 519 J/kgK