Initial RPC.js adapted from 6.824 project