Roth IRA Contribution and earned income

So this is a complicated question as I can not find what I'm exactly looking for on google so I'll try to write this the best I can. 

 

I maxed out my roth IRA with 6K. When doing taxes I noticed that after all my deductions and expenses for business I was just under 6k. That is for my net income. So does the earned income have to be net or is it based on gross?