始める
このチュートリアルを使用して、CloudflareのWeb3ゲートウェイをIPFSおよびEthereumネットワークで使用し始めましょう。
始める前に、アカウントを設定し、ウェブサイトを追加してCloudflareに登録していることを確認してください。
アカウントのWeb3ゲートウェイにアクセスするには、まずゲートウェイに登録する必要があります。
ゲートウェイのサブスクリプションを購入した後、ゲートウェイを作成します。
ダッシュボードから作成
To create a gateway using the dashboard:
- Log in to the Cloudflare dashboard ↗.
- Select your account and website.
- Go to Web3.
- Click Create Web3 Gateway.
- Enter the following information:
- Hostname: Enter a hostname to use as your gateway, which has to be a subdomain of the current Cloudflare zone.
- Gateway Description: Enter a description to help distinguish between different gateways.
- Gateway Type: Select a gateway target of IPFS DNSLink, IPFS Universal Path, or Ethereum.
- DNSLink: Only applicable to IPFS gateways, more details at DNSLink.
- Click Deploy.
APIから作成
To create a gateway using the API, send a POST request that includes the following parameters:
name: The hostname that will point to the target gateway via aCNAMErecord.target: The gateway target for the hostname (ethereum,ipfs,ipfs_universal_path).
If you need help with API authentication, refer to Cloudflare API documentation.
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/web3/hostnames" \--header "X-Auth-Email: <EMAIL>" \--header "X-Auth-Key: <API_KEY>" \--header "Content-Type: application/json" \--data '{ "name": "gateway.example.com", "description": "This is my IPFS gateway.", "target": "ipfs", "dnslink": "/ipns/onboarding.ipfs.cloudflare.com"}'The response contains the complete definition of the new gateway.
{ "success": true, "errors": [], "messages": [], "result": { "id": "<WEB3_GATEWAY_ID>", "name": "gateway.example.com", "description": "This is my IPFS gateway.", "status": "active", "target": "ipfs", "dnslink": "/ipns/onboarding.ipfs.cloudflare.com", "created_on": "<CREATED_ON_DATE>", "modified_on": "<MODIFIED_ON_DATE>" }}When you create a gateway, Cloudflare automatically:
- Creates and adds records to your Cloudflare DNS so your gateway can receive and route traffic appropriately.
- Proxies traffic to that hostname.
- Issues an SSL/TLS certificate to cover the specified hostname.
Once your gateway becomes active, you can customize the Cloudflare settings associated with your hostname.
Since your traffic is automatically proxied through Cloudflare, you customize your website settings to take advantage of various security, performance, and reliability benefits.
バックエンドサービスにゲートウェイを使用している場合は、Cloudflare Zero Trustを使用してゲートウェイアクセスを制限することを検討してください。
Since this is a service with usage-based billing, Cloudflare recommends that you set up usage-based billing notifications to avoid unexpected bills.
To set up those notifications:
-
Log in to the Cloudflare dashboard ↗.
-
Select your account.
-
Go to Notifications.
-
On Alert Type of Usage Based Billing, click Select.
-
Fill out the following information:
- Name
- Product
- Notification limit (exact metric will vary based on product)
- Notification email
-
Select Save.
ゲートウェイを作成し、Cloudflareの設定を更新したら、IPFSまたはEthereumを使用し始めることができます。