I'd guess the optimal soil would be the soil from which the strain you are growing came from.

But generally, you will want porous, sandy soil with good drainage. Right now I'm using regular house flower soil mixed with the remaining sand and gravel left in the bottom of my drainage pellet bag. Getting get good results so far.

I'm gonna try with a soil adapted for cactus-like plants next time. A friend did that and it turns out beautiful.

Of course, you could get more expensive, hemp-specialized stuff from grow shops. I'm just a guerilla hobby grower with a piece of homemade stealth-furniture to grow in so I tend to MacGyver most stuff!

Most cannabis plants will prefer lightly dry to semi-moist soil, but not wet.
(Also, wet soil seems to get mold problems faster)

They also prefer a soil pH of around 5 to 6. Personally I have problems keeping it under 6.7, but I've done well so far, never killed any plants!

Don't forget use drainage pellets at the bottom inch or so in the pot!