Private Policy

Introduction

Private policy is a special kind of policy, which is only supposed to be used by its owner. For example, when a CEX frequently sends transactions with its hot wallet, it will want to create a designated policy to use, other than trying to match a policy with rules every time.

Purpose

Using private policy has several benefits:

  1. The private policy will have a specific purpose, and the fund will not be used by anyone other than the owner, to ensure the safety and precise usage of the fund.
  2. The private policy rules can be set up as simple as possible, even allowing no whitelist to be set at all, making it much easier to create and maintain.
  3. The rule-matching step is simplified only to verify one policy, making the API return faster.

Setup

  1. When creating the policy through the google form , choose the policy type section as Private Policy. This sets the create policy type input parameter to 1, which is private policy.
  2. No whitelist is required, not like a public policy that needs either from or to whitelist. Owners can have the flexibility to set any whitelist or none as needed for private policy.

Usage

  1. The private policy can be used when calling eth_isSponsorable or eth_sendRawTransaction APIs, which need to be called through the open platform for identity verification
  2. An additional header X-MegaFuel-Policy-Uuid is also required, to specify which private policy the caller wants to use.
curl --location 'https://open-platform-ap.nodereal.io/{$apikey}/megafuel/{$chainId}' \
--header 'Content-Type: application/json' \
--header 'X-MegaFuel-Policy-Uuid: <the-private-megafule-policy-uuid-you-requested>' \
--data '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_sendRawTransaction",
    "params": [
        "<raw-tx-data>"
    ]
}'

FAQ

  1. What if I write the wrong uuid in the header?
    If the uuid does not exist or you write another owner's policy uuid, the transaction will not be sponsored.

  2. What if my policy is out of gas?
    If the policy associated with the uuid in the header is out of gas or is limited by other restrictions, the transaction will not be sponsored.

  3. I want to access public policy but added X-MegaFuel-Policy-Uuid header, what will happen?
    If you added X-MegaFuel-Policy-Uuid header in the request, it will be regarded as a request for private policy, and the public policy will not sponsor the transaction.

Useful information

Endpoints for Private Policy

Private Policy APIs

https://docs.nodereal.io/reference/private-policy-api

Private Policy Usage in SDK

Private Policy Example