Move communication stuff out of main

Split tasks into separate methods and run each one of them in a separate
goroutine.
pool txns according to input tx curve