grafted rpc code