some changes from coloredcoinjs-lib