ESP8266 as Master, Arduino MEGA as slave

The misconception with using an ESP to make an Arduino connected to WiFi is that the ESP is also programmable. Not really (possible, but a bit beyond the scope of this forum… see below).

It is actually just acting as a WiFi adapter, via the installed AT firmware, and your Blynk sketch, operation and I/O control is on the Arduino.

http://help.blynk.cc/hardware-and-libraries/arduino/esp8266-with-at-firmware

Now, of course of you are using a decent ESP you would probably be better off using it as a standalone Blynk device… perhaps acting as “master” to a connected Arduino “slave” that is running normal Arduino code for controlling the I/O and feeding the data back to the Blynk controlled ESP “Master”, via serial, I2C, etc. But again, the “how to” for that is not really Blynk specific.