src/index.js
function recover(rawTx, v, r, s) {
  const rawTransaction = typeof(rawTx) === 'string' ? new Buffer(stripHexPrefix(rawTx), 'hex') : rawTx;
  const signedTransaction = rlp.decode(rawTransaction);
  const raw = [];

  transactionFields.forEach((fieldInfo, fieldIndex) => {
    raw[fieldIndex] = signedTransaction[fieldIndex];
  });

  const publicKey = secp256k1.recoverPubKey((new Buffer(keccak256(rlp.encode(raw)), 'hex')), { r, s }, v - 27);
  return (new Buffer(publicKey.encode('hex', false), 'hex')).slice(1);
}
function recover(rawTx, v, r, s) {
  const rawTransaction = typeof(rawTx) === 'string' ? new Buffer(stripHexPrefix(rawTx), 'hex') : rawTx;
  const signedTransaction = rlp.decode(rawTransaction);
  const raw = [];

  transactionFields.forEach((fieldInfo, fieldIndex) => {
    raw[fieldIndex] = signedTransaction[fieldIndex];
  });

  const publicKey = secp256k1.recoverPubKey((new Buffer(keccak256(rlp.encode(raw)), 'hex')), { r, s }, v - 27);
  return (new Buffer(publicKey.encode('hex', false), 'hex')).slice(1);
}
function recover ( rawTx , v , r , s ) { const rawTransaction = typeof ( rawTx ) === 'string' ? new Buffer ( stripHexPrefix ( rawTx ) , 'hex' ) : rawTx ; const signedTransaction = rlp . decode ( rawTransaction ) ; const raw = [ ] ; transactionFields . forEach ( ( fieldInfo , fieldIndex ) => { raw [ fieldIndex ] = signedTransaction [ fieldIndex ] ; } ) ; const publicKey = secp256k1 . recoverPubKey ( ( new Buffer ( keccak256 ( rlp . encode ( raw ) ) , 'hex' ) ) , { r , s } , v - 27 ) ; return ( new Buffer ( publicKey . encode ( 'hex' , false ) , 'hex' ) ) . slice ( 1 ) ; }
ECDSA public key recovery from a rawTransaction

@method recover
@param {String|Buffer} rawTransaction either a hex string or buffer instance
@param {Number} v
@param {Buffer} r
@param {Buffer} s
@return {Buffer} publicKey
ECDSA public key recovery from a rawTransaction