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://bsc-megafuel.nodereal.io/{your_apikey}/megafuel/97' \
--header 'Content-Type: application/json' \
--header 'X-MegaFuel-Policy-Uuid: e3d5858d-2f93-461a-be86-1dfe0812ea50' \
--data '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_sendRawTransaction",
    "params": [
        "0x02f869618246aa80808094cd9c02358c223a3e788c0b9d94b98d434c7aa0f1872386f26fc1000080c080a09c846568687dcebe2a759a9b26a424435d3c1435df1c418178f1dc1f2ced2382a051e1248e72ca180e4fbd78cd0525ca7055eb8abcba4ed96e943197af9fdaa6a5"
    ]
}'

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

Open Platform hosts

BNB Smart Chain (BSC)

Mainnet: https://bsc-megafuel.nodereal.io/
Testnet: https://bsc-megafuel-testnet.nodereal.io/

opBNB

Mainnet: https://opbnb-megafuel.nodereal.io/
Testnet: https://opbnb-megafuel-testnet.nodereal.io/