developers.cloudflare.com Open in urlscan Pro
2606:4700::6810:6bd  Public Scan

Submitted URL: https://gatewaytoheaven.fortellix.com/
Effective URL: https://developers.cloudflare.com/web3/how-to/use-ethereum-gateway/
Submission: On February 04 via automatic, source certstream-suspicious — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

Skip to content
Cloudflare Docs logomark
Cloudflare Docs

Web3
Navigation menu iconOpen external link

Cloudflare Docs logomark
Cloudflare Docs


Web3
Dropdown iconWeb3 menu
 * Web3 homepage

 * Overview
 * About
 * Get started
 * Expand: How to How to
    * Manage gateways
    * Subscribe to gateways
    * Use Ethereum gateway
    * Use IPFS gateway
    * Customize Cloudflare settings
    * Restrict gateway access

 * Expand: IPFS Gateway IPFS Gateway
    * Expand: Concepts Concepts
       * Interplanetary File System (IPFS)
       * DNSLink gateways
       * Universal Path gateway
   
    * Expand: Reference Reference
       * Peering
       * Using IPFS with your website
       * Automated deployments
   
    * Troubleshooting

 * Expand: Ethereum Gateway Ethereum Gateway
    * Expand: Concepts Concepts
       * Ethereum network
       * Node types
   
    * Expand: Reference Reference
       * Supported API methods
       * Supported networks
       * Rinkeby deprecation
       * Kill Switches

 * Expand: Reference Reference
    * Gateway DNS records
    * Gateway status
    * Legacy gateway migration
    * Limits

 * API referenceAPI link label Open API docs link





SearchK
Give Feedback

GitHub icon
Edit this page on GitHub

Search icon (depiction of a magnifying glass)
Light theme icon (depiction of a sun)
Dark theme icon (depiction of a moon)
Set theme to dark (⇧+D)
 * ↑ Top
 * Read from the network
 * Write to the network


 1. Products
 2. Web3
 3. How to
 4. Use Ethereum gateway


USE THE ETHEREUM GATEWAY

Once you have an Ethereum gateway — meaning that you create a new gateway with a
target of Ethereum — you can interact with different Ethereum networks by
specifying the correct JSON blob for your query.


READ FROM THE NETWORK

The Cloudflare Ethereum Gateway allows HTTP requests where the body of the
request is set to be the JSON body of the request you would like to make. For
example, if you would like to read the block that is at number 0x2244, then your
JSON blob takes the form:

{ "jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": ["0x2244", true], "id": 1 }


Copy Button

Each blob use a valid method parameter. The params array here contains the block
number that we would like to locate and a boolean expressing whether each
individual transaction in the block should be shown in their entirety (true) or
as stubs (false).

To send this query to your custom Ethereum Gateway, you could use a cURL
command:

$ curl https://web3-trial.cloudflare-eth.com/v1/mainnet -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x2244", true],"id":1}'


Copy Button

You can also write the same query using the JS Fetch API:

await fetch(
  new Request('https://web3-trial.cloudflare-eth.com/v1/mainnet', {
    method: 'POST',
    body: JSON.stringify({
      jsonrpc: '2.0',
      method: 'eth_getBlockByNumber',
      params: ['0x2244', true],
      id: 1,
    }),
    headers: {
      'Content-Type': 'application/json',
    },
  })

).then(resp => {
  return resp.json();

});


Copy Button

The response in both cases will be a JSON blob of the form:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "difficulty": "0x746ef15b66",
    "extraData": "0x476574682f76312e302e302f6c696e75782f676f312e342e32",
    "gasLimit": "0x1388",
    "gasUsed": "0x0",
    "hash": "0xd6bb42034740c5d728e774e43a01f26222e0fcc279c504ca5963dc34fe70f392",
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "miner": "0xf927a40c8b7f6e07c5af7fa2155b4864a4112b13",
    "mixHash": "0x975da446e302e6da6cedb3fbaa763c3c203ae88d6fab4924e2a3d34a568c4361",
    "nonce": "0x88a7f12f49151c83",
    "number": "0x2244",
    "parentHash": "0x067fd84ecdbc7491bf5ec7d5d4ead361b1f590eec74797a7f90b4a7d7004a48d",
    "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "size": "0x21b",
    "stateRoot": "0x828dade2067283e370993ec6a1bda0e65c1310e404a6d5bbb030b596eb80017c",
    "timestamp": "0x55bb040f",
    "totalDifficulty": "0x5c328da43525d",
    "transactions": [],
    "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "uncles": []
  }

}


Copy Button


WRITE TO THE NETWORK

Currently, the Ethereum Gateway allows you to write to the network using the
eth_sendRawTransaction RPC method. This creates a new message call transaction
or a contract creation for signed transactions. The transactions are signed
using a secret key corresponding to your own Ethereum walletExternal link icon
Open external link .

Once you have a wallet set up and a method of signing your own transactions, you
can write that transaction to the Ethereum network via the Cloudflare Ethereum
Gateway. Signed transactions use hexadecimal strings of the form:

"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"


Copy Button

Then you can use your custom Gateway to send the transaction to the network with
a cURL command:

$ curl https://web3-trial.cloudflare-eth.com/v1/mainnet -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"],"id":1}'


Copy Button

You could also use a JS Fetch API request:

await fetch(
  new Request('https://web3-trial.cloudflare-eth.com/v1/mainnet', {
    method: 'POST',
    body: JSON.stringify({
      jsonrpc: '2.0',
      method: 'eth_sendRawTransaction',
      params: [
        '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675'
      ],
      id: 1,
    }),
    headers: {
      'Content-Type': 'application/json',
    },
  })

).then(resp => {
  return resp.json();

});


Copy Button

(The actual command above will not work — you need to provide your own signed
transaction.)

Cloudflare DashboardExternal link icon Open external link   ·   DiscordExternal
link icon Open external link   ·   CommunityExternal link icon Open external
link   ·   Learning CenterExternal link icon Open external link   ·   Support
PortalExternal link icon Open external link   ·   Cookie Preferences
Edit on GitHubExternal link icon Open external link   ·   Updated 1 year ago


OUR SITE USES COOKIES

Like most websites, we use cookies to make our site work the way you expect it
to, improve your experience on our site, analyze site usage, and assist in our
marketing efforts. By choosing "Accept All Cookies", you agree to the storing of
all categories of cookies on your device. If you wish to accept or reject some
categories of cookies, please click “Cookie Preferences.”
Cookie Preferences Reject All Accept All Cookies



YOUR COOKIE OPTIONS

Cloudflare uses four types of cookies as described below. You can decide which
categories of cookies you wish to accept to improve your experience on our
website. To learn more about the cookies we use on our site, please read our
Cookie Policy.
Cloudflare's Cookie Policy
Allow All


MANAGE CONSENT PREFERENCES

STRICTLY NECESSARY COOKIES

Always Active

Strictly Necessary cookies are essential to our website functioning as expected.
You cannot turn off Strictly Necessary cookies because they are required to
deliver security, enable core site functionality, and help you use our site's
features and services as you would expect (including remembering your cookie
consent preferences). Cloudflare does not use these cookies to track individuals
across websites.

Cookies Details‎

FUNCTIONAL COOKIES

Functional Cookies

Functional cookies allow us to remember choices you make about the kind of
experience you want on our site and to provide you with a more personalized
experience. For example, a functional cookie is required to remember which
language you prefer.

Cookies Details‎

PERFORMANCE COOKIES

Performance Cookies

Performance cookies help us learn how you use our website to help improve its
performance and design. These cookies provide us with aggregated statistical
information such as number of page visits, page load speeds, how long a user
spends on a particular page, and the types of browsers or devices used to access
our site.

Cookies Details‎

TARGETING COOKIES

Targeting Cookies

We use Targeting cookies to deliver advertisements relevant to you and your
interests when you visit other websites that host advertisements.

Cookies Details‎
Back Button


COOKIE LIST



Search Icon
Filter Icon

Clear
checkbox label label
Apply Cancel
Consent Leg.Interest
checkbox label label
checkbox label label
checkbox label label

Reject All Confirm My Choices