
It can be hard to know where to start with a bassline in an electronic track - since production and composition are so inextricably bound together, the sound you use might dictate what sort of line you can write. But there are a few basics that we can consider first.
For example, take the key that your track is in. The root note of the scale (if you're in a scale of C, then the root note is the C) will always sound "right", and a solid place for the bassline to be. Other strong notes would be the fifth (G), or the minor third (E flat). A straightforward but effective option is to simply follow the movement of the chords in your track with the bassline. It's worked for trance, punk, and house for years, and there's no reason why it wouldn't work for you too.
A similar option is to move the bassline around under a static chord or leadline. This gives your track the impression of movement, even when most of it doesn't move at all. The classic examples (and possibly overused, but try them anyway because they always sound great) are the minor chord (i.e. go from C to E flat to G) and the even more popular alternative where you go to F instead of the G. Try either of these against a simple lead line and you'll realise why everyone from the Chemical Brothers to Calvin Harris use these progressions time after time.
You can also eschew all this "key" nonsense and go for the good old fashioned one-noter. It's been a staple of dubstep and techno since way back when and there's a good reason for that - when you need sheer guttural heaviness, there's not much else that can cut it. But be careful; a one-note bassline can be difficult to pull off successfully. You need to make sure that it's tuned to complement the pitch of your kick drum. It needs to be rhythmically interesting too; a sustained single note can get very boring, so you'll need to get some funk in there to compensate for the lack of musical interest.

The other maxim to remember is the old catchphrase about how it's not the notes you play, but the notes you don't play that bring the funk. Dance music is so maximal these days that it's easy to forget that you don't need to fill every beat with noise to make it stand out. A lot of classic house and funk might just have one or two short bass notes per bar, but the fact that you have to wait for it only heightens the anticipation. It also gives each note more impact - instead of getting lost in a flurry of bass hits.
No discussion of basslines in 2011 would be complete without mentioning "filth"; that staple of dubstep and electro music the world over. The screeching distortion that we all know so well actually has very little to do with real bass, however, since it occupies the frequency spectrum from about 200Hz and upwards. It is, thus, essentially a lead. However if you want to write a "filth" track then the same rules apply - you need a huge, twisting, turning sound (or several alternating sounds) in the lead area, and so your sub line can be relatively simple so as not to confuse the listener.
