lib/address.js
function mkMultiSigRedeemScript(pubKeys, M, N) {
  // https://github.com/ZencashOfficial/zen/blob/b7a7c4c4199f5e9f49868631fe5f2f6de6ba4f9a/src/script/standard.cpp#L411
  if (M > N && M <= 1) throw new Error('Invalid Multi Sig Type');
  var OP_1 = Buffer.from(zopcodes.OP_1, 'hex');
  var OP_START = (OP_1.readInt8(0) + (M - 1)).toString(16);
  var OP_END = (OP_1.readInt8(0) + (N - 1)).toString(16);

  return OP_START + pubKeys.map(function (x) {
    return zbufferutils.getPushDataLength(x) + x;
  }).join('') + OP_END + zopcodes.OP_CHECKMULTISIG;
}
function mkMultiSigRedeemScript(pubKeys, M, N) {
  // https://github.com/ZencashOfficial/zen/blob/b7a7c4c4199f5e9f49868631fe5f2f6de6ba4f9a/src/script/standard.cpp#L411
  if (M > N && M <= 1) throw new Error('Invalid Multi Sig Type');
  var OP_1 = Buffer.from(zopcodes.OP_1, 'hex');
  var OP_START = (OP_1.readInt8(0) + (M - 1)).toString(16);
  var OP_END = (OP_1.readInt8(0) + (N - 1)).toString(16);

  return OP_START + pubKeys.map(function (x) {
    return zbufferutils.getPushDataLength(x) + x;
  }).join('') + OP_END + zopcodes.OP_CHECKMULTISIG;
}
/*
Given a list of public keys, create a M-of-N redeemscript
@param {[String]} pubKey (array of public keys, NOT ADDRESS)
@param {Int} M [2 or 3] in M-of-N multisig
@param {Int} N [3 or 4] in M-of-N multisig
@return {String} RedeemScript