new script API

fixes https://github.com/bitpay/bitcore/issues/602
Guys, let's try to review what is changed in the PR. If you have ideas on changes you'd like to see open new issues! Ideally we're doing lots of small PRs, not adding changes to already big PRs. Do you agree?