bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 74쪽
oClipboard>
</td>
</tr>
<tr>
<td>Newsletter</td>
<td>
<CopyToClipboard>[https://news.monad.xyz](https://news.monad.xyz)</CopyToClipboard>
</td>
</tr>
<tr>
<td>Community Discord</td>
<td>
<CopyToClipboard>[https://discord.gg/monad](https://discord.gg/monad)</CopyToClipboard>
</td>
</tr>
<tr>
<td>r/Monad Subreddit</td>
<td>
<CopyToClipboard>[https://reddit.com/r/Monad](https://reddit.com/r/Monad)</CopyToClipboard>
</td>
</tr>
</tbody>
</table>
</div>
### Developer Community
<div>
<table>
<thead>
<tr>
<th>What</th>
<th>Where</th>
</tr>
</thead>
<tbody>
<tr>
<td>`monad-developers` Github</td>
<td>
<CopyToClipboard>[https://github.com/monad-developers](https://github.com/monad-developers)</CopyToClipboard>
</td>
</tr>
<tr>
<td>DevNads on X</td>
<td>
<CopyToClipboard>[https://x.com/monad\_dev](https://x.com/monad_dev)</CopyToClipboard>
</td>
</tr>
<tr>
<td>Developer Discord</td>
<td>
<CopyToClipboard>[https://discord.gg/monaddev](https://discord.gg/monaddev)</CopyToClipboard>
</td>
</tr>
<tr>
<td>Research Forum</td>
<td>
<CopyToClipboard>[https://forum.monad.xyz](https://forum.monad.xyz)</CopyToClipboard>
</td>
</tr>
<tr>
<td>Developer Portal</td>
<td>
<CopyToClipboard>[https://developers.monad.xyz/](https://developers.monad.xyz/)</CopyToClipboard>
</td>
</tr>
<tr>
<td>Dev Announcements Telegram</td>
<td>
<CopyToClipboard>[https://t.me/monad\_devs](https://t.me/monad_devs)</CopyToClipboard>
</td>
</tr>
<tr>
<td>DeltaV Founder Community</td>
<td>
<CopyToClipboard>[https://deltav.monad.xyz/](https://deltav.monad.xyz/)</CopyToClipboard>
</td>
</tr>
</tbody>
</table>
</div>
### Validator Community
<div>
<table>
<thead>
<tr>
<th>What</th>
<th>Where</th>
</tr>
</thead>
<tbody>
<tr>
<td>Monad Node Announcements</td>
<td>
<CopyToClipboard>[https://t.me/MonadNodeAnnouncements](https://t.me/MonadNodeAnnouncements)</CopyToClipboard>
</td>
</tr>
</tbody>
</table>
</div>
### Tech
<div>
<table>
<thead>
<tr>
<th>What</th>
<th>Where</th>
</tr>
</thead>
<tbody>
<tr>
<td>Consensus Client Github</td>
<td>
<CopyToClipboard>[https://github.com/category-labs/monad-bft](https://github.com/category-labs/monad-bft)</CopyToClipboard>
</td>
</tr>
<tr>
<td>Execution Client Github</td>
<td>
<CopyToClipboard>[https://github.com/category-labs/monad](https://github.com/category-labs/monad)</CopyToClipboard>
</td>
</tr>
<tr>
<td>Monad Improvement Proposals (MIPs)</td>
<td>
<CopyToClipboard>[https://mips.monad.xyz](https://mips.monad.xyz)</CopyToClipboard>
</td>
</tr>
</tbody>
</table>
</div>
### Opportunities
<div>
<table>
<thead>
<tr>
<th>What</th>
<th>Where</th>
</tr>
</thead>
<tbody>
<tr>
<td>Monad Foundation Jobs</td>
<td>
<CopyToClipboard>[https://jobs.ashbyhq.com/monad.foundation](https://jobs.ashbyhq.com/monad.foundation)</CopyToClipboard>
</td>
</tr>
<tr>
<td>Monad Ecosystem Jobs</td>
<td>
<CopyToClipboard>[https://eco-jobs.monad.xyz/jobs](https://eco-jobs.monad.xyz/jobs)</CopyToClipboard>
</td>
</tr>
</tbody>
</table>
</div>
### Testnet
<div>
<table>
<thead>
<tr>
<th>What</th>
<th>Where</th>
</tr>
</thead>
<tbody>
<tr>
<td>Block Explorer (MonadVision)</td>
<td>
<CopyToClipboard>[https://testnet.monadvision.com](https://testnet.monadvision.com)</CopyToClipboard>
</td>
</tr>
<tr>
<td>Testnet Faucet</td>
<td>
<CopyToClipboard>[https://faucet.monad.xyz](https://faucet.monad.xyz)</CopyToClipboard>
</td>
</tr>
</tbody>
</table>
</div>
# Security
Source: https://docs.monad.xyz/security
Report security vulnerabilities in Monad through the Cantina bug bounty program.
Monad runs a bug bounty program on [Cantina](https://cantina.xyz/bounties/31f19cea-dda2-4568-8f99-27dafd120c97). If you discover a security vulnerability, please report it responsibly through the program below.
<Card title="Monad Bug Bounty" href="https://cantina.xyz/bounties/31f19cea-dda2-4568-8f99-27dafd120c97">
Review the program scope and rewards, and submit vulnerability reports on Cantina.
</Card>
# How to generate user specific images in the Farcaster Mini App
Source: https://docs.monad.xyz/templates/farcaster-miniapp/generating-custom-og-images
Creating shareable moments in the Farcaster Mini App is a great way to engage with your users.
You can generate custom shareable user specific images in the Farcaster Mini App and make it easy for the user to share them!
<img alt="Example" />
In this guide we setup a dedicated endpoint `/api/og` for generating images and we use `@vercel/og` package to generate the images.
## Generating images
If you are using the [Monad Mini App template](https://github.com/monad-developers/monad-miniapp-template), you can simply
edit [`app/api/og/route.tsx`](https://github.com/monad-developers/monad-miniapp-template/blob/main/app/api/og/route.tsx)
to generate images of your choice.
```ts lines title="app/api/og/route.tsx" theme={null}
...
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url);
// The below is dependent on whether the username and image are passed as query params or not.
const username = searchParams.get('username') || 'User'; // Username of the user
const imageUrl = searchParams.get('image') || ''; // Image url of the user
const backgroundGradient = '#2D1B69'; // Background color of the image
// Load Inter font from the public folder
const interFontData = await fetch(
`${request.nextUrl.origin}/Inter.ttf`
).then((res) => res.arrayBuffer());
return new ImageResponse(
(
// Generate the image here
);
} catch (e) {
console.error('Error generating OG image:', e);
return new Response('Failed to generate image', { status: 500 });
}
}
...
```
If you are not using the template, you need to install `@vercel/og` package.
```bash theme={null}
npm install @vercel/og
```
Create a new file `app/api/og/route.tsx`, if you are using Next.js 14 or higher.
```ts lines title="app/api/og/route.tsx" theme={null}
import { ImageResponse } from '@vercel/og';
import { NextRequest } from 'next/server';
// Generate the image for every request
export const dynamic = "force-dynamic";
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url);
// The below is dependent on whether the username and image are passed as query params or not.
const username = searchParams.get('username') || 'User'; // Username of the user
const imageUrl = searchParams.get('image') || ''; // Image url of the user
return new ImageResponse(
(
// Generate the image here
);
} catch (e) {
console.error('Error generating OG image:', e);
return new Response('Failed to generate image', { status: 500 });
}
}
```
If you are not using Next.js, you can setup an endpoint or dedicated microservice to generate the images.
## Sharing images via the Mini App
<img alt="Example from EGGS Mini App, prompting the user to cast a custom generated image" />
Add shareable elements to your Mini App, so the user can share the generated images via the Mini App.
Below is an example of a button that can be used to generate and share a custom image:
```tsx lines theme={null}
export default function GenerateAndShareCustomImage() {
...
const handleGenerateCustomOGImage = () => {
// Generate the image using the endpoint
const ogImageUrl = `${APP_URL}/api/og?username=${username}&image=${pfpUrl}`;
// Programmatically compose a cast with the generated image
actions?.composeCast({
// Text to be displayed in the cast
text: "I generated a custom OG image using Monad Mini App template",
// Image to be displayed in the cast
embeds: [ogImageUrl],
});
};
...
return (
<button
type="button"
className="bg-white text-black rounded-md p-2 text-sm"
/**
* When the button is clicked, the shareable image is generated
* and the cast is composed.
*/
onClick={() => handleGenerateCustomOGImage()}
disabled={!fid}
>
Generate Custom Image
</button>
);
}
```
# How to build a Farcaster Mini App
Source: https://docs.monad.xyz/templates/farcaster-miniapp/getting-started
In this guide, you will learn how to use the [Monad Farcaster Mini App Template](https://github.com/monad-developers/monad-miniapp-template) to build apps.
The template demonstrates all Mini App capabilities and lets you easily modify it, so you can build Mini Apps.
## Cloning the Template
You can the following command to clone the Mini App template to your local machine:
```bash theme={null}
git clone https://github.com/monad-developers/monad-miniapp-template.git
```
### Install the dependencies
```bash theme={null}
yarn
```
### Copy `.env.example` over to `.env.local`
```bash theme={null}
cp .env.example .env.local
```
### Run the template
```bash theme={null}
yarn run dev
```
### View the App in Farcaster Embed tool
Farcaster has a neat [Embed tool](https://farcaster.xyz/~/developers/mini-apps/embed) that you can use to inspect the Mini App before you publish it.
Unfortunately, the embed tool can only work with remote URL. Inputting a localhost URL does not work.
As a workaround, you may make the local app accessible remotely using a tool like `cloudflared` or `ngrok`. In this guide we will use `cloudflared`.
#### Install Cloudflared
```bash theme={null}
brew install cloudflared
```
For more installation options see the [official docs](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/).
#### Expose localhost
Run the following command in your terminal:
```bash theme={null}
cloudflared tunnel --url http://localhost:3000
```
Be sure to specify the correct port for your local server.
#### Set `NEXT_PUBLIC_URL` environment variable in `.env.local` file
```bash theme={null}
NEXT_PUBLIC_URL=<url-from-cloudflared-or-ngrok>
```
#### Use the provided url
`cloudflared` will generate a random subdomain and print it in the terminal for you to use. Any traffic to this URL will get sent to your local server.
Enter the provided URL in the [Farcaster Embed tool](https://farcaster.xyz/~/developers/mini-apps/embed).
<img alt="embed-tool" />
Let's investigate the various components of the template.
## Customizing the Mini App Embed
Mini App Embed is how the Mini App shows up in the feed or in a chat conversation when the URL of the app is shared.
The Mini App Embed looks like this:
<img alt="embed-preview" />
You can customize this by editing the file `app/page.tsx`:
```js lines title="app/page.tsx" theme={null}
...
const appUrl = env.NEXT_PUBLIC_URL;
const frame = {
version: "next",
imageUrl: `${appUrl}/images/feed.png`, // Embed image URL (3:2 image ratio)
button: {
title: "Template", // Text on the embed button
action: {
type: "launch_frame",
name: "Monad Farcaster Mini App Template",
url: appUrl, // URL that is opened when the embed button is tapped or clicked.
splashImageUrl: `${appUrl}/images/splash.png`,
splashBackgroundColor: "#f7f7f7",
},
},
};
...
```
You can either edit the URLs for the images or replace the images in `public/images` folder in the template.
Once you are happy with the changes, click `Refetch` in the Embed tool to get the latest configuration.
<Note>
If you are developing locally, ensure that your Next.js app is running locally and the cloudflare tunnel is open.
</Note>
## Customizing the Splash Screen
Upon opening the Mini App, the first thing the user will see is the Splash screen:
<img alt="splash-screen" />
You can edit the `app/page.tsx` file to customize the Splash screen.
```js lines title="app/page.tsx" theme={null}
...
const appUrl = env.NEXT_PUBLIC_URL;
const frame = {
version: "next",
imageUrl: `${appUrl}/images/feed.png`,
button: {
title: "Launch Template",
action: {
type: "launch_frame",
name: "Monad Farcaster Mini App Template",
url: appUrl,
splashImageUrl: `${appUrl}/images/splash.png`, // App icon in the splash screen (200px * 200px)
splashBackgroundColor: "#f7f7f7", // Splash screen background color
},
},
};
...
```
For `splashImageUrl`, you can either change the URL or replace the image in `public/images` folder in the template.
## Modifying the Mini App
Upon opening the template Mini App, you should see a screen like this:
<img alt="miniapp" />
The code for this screen is in the `components/pages/app.tsx` file:
```tsx lines title="components/pages/app.tsx" theme={null}
export default function Home() {
const { context } = useMiniAppContext();
return (
// SafeAreaContainer component makes sure that the app margins are rendered properly depending on which client is being used.
<SafeAreaContainer insets={context?.client.safeAreaInsets}>
{/* You replace the Demo component with your home component */}
<Demo />
</SafeAreaContainer>
)
}
```
You can remove or edit the code in this file to build your Mini App.
### Accessing User Context
<img alt="user-context" />
Your Mini App receives various information about the user, including `username`, `fid`, `displayName`, `pfpUrl` and other fields.
The template provides a helpful hook `useMiniAppContext` that you can use to access these fields:
```js lines title="components/Home/User.tsx" theme={null}
export function User() {
const { context } = useMiniAppContext();
return <p>{context.user.username}</p>
}
```
The template also provide an example of the same in `components/Home/User.tsx` file.
You can learn more about Context [here](https://miniapps.farcaster.xyz/docs/sdk/context).
### Performing App Actions
<img />
Mini Apps have the capability to perform native actions that enhance the user experience!
Actions like:
* `addFrame`: Allows the user to save (bookmark) the app in a dedicated section
* `composeCast`: Allows the Mini App to prompt the user to cast with prefilled text and media
* `viewProfile`: Presents a profile of a Farcaster user in a client native UI
Learn more about Mini App actions [here](https://miniapps.farcaster.xyz/docs/sdk/actions/add-miniapp)
The template provides an easy way to access the actions via the `useMiniAppContext` hook!
```js title="components/Home/FarcasterActions.tsx" theme={null}
const { actions } = useMiniAppContext();
```
An example for the same can be found in `components/Home/FarcasterActions.tsx` file.
### Prompting Wallet Actions
<img alt="wallet-actions" />
Every user of Farcaster has a Farcaster wallet with Monad Testnet support.
**Mini Apps can prompt the user to perform onchain actions**!
The template provides an example for the same in `components/Home/WalletActions.tsx` file.
```js lines title="components/Home/WalletActions.tsx" theme={null}
export function WalletActions() {
...
async function sendTransactionHandler() {
sendTransaction({
to: "0x7f748f154B6D180D35fA12460C7E4C631e28A9d7",
value: parseEther("1"),
});
}
...
}
```
<Warning>
The Farcaster wallet supports multiple networks. It is recommended that you ensure that the right network is connected before prompting wallet actions.
You can use viem's `switchChain` or equivalent to prompt a chain switch.
```js title="components/Home/WalletActions.tsx" theme={null}
// Switching to Monad Testnet
switchChain({ chainId: 10143 });
```
The template has an example for the same in the `components/Home/WalletActions.tsx` file.
</Warning>
## Conclusion
In this guide, you explored Farcaster Mini Apps — the simplest way to create engaging, high-retention, and easily monetizable applications!
You also discovered the key capabilities of Mini Apps and how you can use the [Monad Farcaster Mini App Template](https://github.com/monad-developers/monad-miniapp-template) to build your own.
For more details, check out the official Mini App documentation [here](https://miniapps.farcaster.xyz/).
### Explore more Farcaster Mini App guides
<CardGroup>
<Card title="Sending Notifications" href="/templates/farcaster-miniapp/sending-notifications" />
<Card title="Generating custom shareable images" href="/templates/farcaster-miniapp/generating-custom-og-images" />
<Card title="Publishing Mini App" href="/templates/farcaster-miniapp/publishing-miniapp" />
</CardGroup>
# How to add haptics to a Farcaster Mini App
Source: https://docs.monad.xyz/templates/farcaster-miniapp/haptics
Haptics are a way to add tactile feedback to your app to enhance user interaction and responsiveness.
This guide walks you through implementing haptics in a Farcaster Mini App for a more intuitive and engaging user experience.
## Implementing haptics in a Farcaster Mini App
If you are using the [Monad Mini App template](https://github.com/monad-developers/monad-miniapp-template/tree/main), you can use `haptics` from the [useFrame](https://github.com/monad-developers/monad-miniapp-template/blob/main/components/farcaster-provider.tsx) hook.
If you are not using the Monad Mini App template, you can inspect the [useFrame](https://github.com/monad-developers/monad-miniapp-template/blob/main/components/farcaster-provider.tsx) hook to check out the implementation details.
Below is an example of how to implement haptics in a Farcaster Mini App:
```tsx theme={null}
...
export default function MyComponent() {
const { haptics } = useFrame();
return (
<div>
<button onClick={() => haptics.impactOccurred('light')}>Light Impact</button>
</div>
);
}
```
## Supported haptics
The following haptics are supported:
| Haptic Type | Code |
| - | - |
| Light Impact | `haptics.impactOccurred('light')` |
| Medium Impact | `haptics.impactOccurred('medium')` |
| Heavy Impact | `haptics.impactOccurred('heavy')` |
| Soft Impact | `haptics.impactOccurred('soft')` |
| Rigid Impact | `haptics.impactOccurred('rigid')` |
| Success Notification | `haptics.notificationOccurred('success')` |
| Warning Notification | `haptics.notificationOccurred('warning')` |
| Error Notification | `haptics.notificationOccurred('error')` |
| Selection Change | `haptics.selectionChanged()` |
# Farcaster Mini Apps
Source: https://docs.monad.xyz/templates/farcaster-miniapp/index
Mini Apps enable developers to distribute native-like apps to [Farcaster](https://www.farcaster.xyz/) users. Mini Apps are the easiest way to deliver engaging, high-retention, and easy-to-monetize applications!
Mini Apps are web apps built with HTML, CSS, and Javascript that can be discovered and used within [Farcaster](https://farcaster.xyz/).
## Guides
<CardGroup>
<Card title="Getting Started" href="/templates/farcaster-miniapp/getting-started" />
<Card title="Sending Notifications" href="/templates/farcaster-miniapp/sending-notifications" />
<Card title="Publishing Mini App" href="/templates/farcaster-miniapp/publishing-miniapp" />
<Card title="Generating custom shareable images" href="/templates/farcaster-miniapp/generating-custom-og-images" />
<Card title="Haptics" href="/templates/farcaster-miniapp/haptics" />
</CardGroup>
# How to publish a Farcaster Mini App
Source: https://docs.monad.xyz/templates/farcaster-miniapp/publishing-miniapp
Publishing the Mini App makes it discoverable in the Farcaster app. However, the Mini App has to be hosted on a domain before it can be published.
Since Farcaster is a decentralized network with multiple clients, a standard has been adopted wherein the Farcaster clients look for the `farcaster.json` file on the Mini App hosted domain for information about the Mini App.
## Hosting the `farcaster.json` file
The `farcaster.json` has to be placed in `/.well-known/farcaster.json` endpoint.
If you are using the [Monad Mini App template](https://github.com/monad-developers/monad-miniapp-template/tree/main) you can edit the [farcaster.json](https://github.com/monad-developers/monad-miniapp-template/blob/main/app/.well-known/farcaster.json/route.ts) file with your app details before publishing the app!
If you are not using the template then you have to make sure you have a `farcaster.json` file hosted on your domain at `[domain]/.wel프로젝트로 돌아가기