def key_type
      v = version
      case v
      when Bitcoin.chain_params.bip49_privkey_p2wpkh_p2sh_version
        Bitcoin::Key::TYPES[:pw2pkh_p2sh]
      when Bitcoin.chain_params.bip84_privkey_p2wpkh_version
        Bitcoin::Key::TYPES[:p2wpkh]
      when Bitcoin.chain_params.extended_privkey_version
        Bitcoin::Key::TYPES[:compressed]
      end
    end
def key_type
      v = version
      case v
      when Bitcoin.chain_params.bip49_privkey_p2wpkh_p2sh_version
        Bitcoin::Key::TYPES[:pw2pkh_p2sh]
      when Bitcoin.chain_params.bip84_privkey_p2wpkh_version
        Bitcoin::Key::TYPES[:p2wpkh]
      when Bitcoin.chain_params.extended_privkey_version
        Bitcoin::Key::TYPES[:compressed]
      end
    end
get key type defined by BIP-178 using version.