diff --git a/docs/cookbook/openclaw-cloud-deployment.mdx b/docs/cookbook/openclaw-cloud-deployment.mdx new file mode 100644 index 000000000..8dafac8cd --- /dev/null +++ b/docs/cookbook/openclaw-cloud-deployment.mdx @@ -0,0 +1,317 @@ +--- +title: 'Deploy OpenClaw on AWS Lightsail' +description: 'Set up your own AI personal assistant in the cloud using AWS Lightsail with Telegram integration' +--- + +[OpenClaw](https://github.com/openclaw/openclaw) is an open-source AI personal assistant that helps you manage tasks, answer questions, and automate workflows through messaging platforms. This guide walks you through deploying OpenClaw on AWS Lightsail and connecting it to Telegram. + +## What you'll need + +Before starting, make sure you have: + +- An [AWS account](https://aws.amazon.com/) (free tier eligible for some services) +- A [Telegram account](https://telegram.org/) +- An API key from either: + - [Anthropic](https://console.anthropic.com/) (for Claude models) + - [OpenAI](https://platform.openai.com/) (for GPT models) + +## Cost overview + +The recommended AWS Lightsail instance costs approximately **$20/month** for a 4GB RAM instance, which provides sufficient resources for running OpenClaw reliably. + +## Create your Lightsail instance + +### Step 1: Access AWS Lightsail + +1. Sign in to the [AWS Console](https://console.aws.amazon.com/) +2. Search for "Lightsail" in the services search bar +3. Click **Create instance** + +### Step 2: Configure the instance + +1. **Select your instance location**: Choose the AWS Region closest to you for better latency +2. **Select a platform**: Choose **Linux/Unix** +3. **Select a blueprint**: Choose **OS Only** → **Ubuntu 24.04 LTS** +4. **Choose your instance plan**: Select the **$20 USD** plan (4 GB RAM, 2 vCPUs, 80 GB SSD) +5. **Name your instance**: Enter a descriptive name like `openclaw-server` +6. Click **Create instance** + +Wait for the instance status to show **Running** before proceeding. + +## Access your instance + +You have two options for connecting to your server. + +### Option 1: Browser-based SSH (easiest) + +1. In the Lightsail console, find your instance +2. Click the terminal icon or **Connect using SSH** +3. A browser-based terminal opens automatically + +### Option 2: SSH with keys (recommended for regular use) + +1. In Lightsail, go to **Account** → **SSH keys** +2. Download your default key or create a new one +3. Save the `.pem` file securely on your computer +4. Set proper permissions and connect: + +```bash Terminal +chmod 400 ~/Downloads/your-key.pem +ssh -i ~/Downloads/your-key.pem ubuntu@YOUR_INSTANCE_IP +``` + +Replace `YOUR_INSTANCE_IP` with your instance's public IP address (found in the Lightsail console). + +## Install dependencies + +Once connected to your instance, update the system and install Node.js. + +### Update system packages + +```bash Terminal +sudo apt update && sudo apt upgrade -y +``` + +### Install Node.js 22+ + +OpenClaw requires Node.js version 22 or higher. Install it using NodeSource: + +```bash Terminal +curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - +sudo apt install -y nodejs +``` + +### Verify installation + +```bash Terminal +node --version +npm --version +``` + +You should see Node.js version 22.x.x or higher. + +## Install and configure OpenClaw + +### Install OpenClaw globally + +```bash Terminal +sudo npm install -g openclaw@latest +``` + +### Run the onboarding wizard + +OpenClaw includes an interactive setup wizard: + +```bash Terminal +openclaw onboard +``` + +The wizard guides you through: +- Choosing your AI provider (Anthropic or OpenAI) +- Entering your API key +- Configuring basic settings + +### Configure your AI provider + +After onboarding, you can customize your configuration. Edit the config file: + +```bash Terminal +nano ~/.openclaw/openclaw.json +``` + +#### For Anthropic Claude + +```json Anthropic configuration +{ + "ai": { + "provider": "anthropic", + "model": "claude-sonnet-4-20250514", + "apiKey": "sk-ant-your-api-key-here" + } +} +``` + +#### For OpenAI + +```json OpenAI configuration +{ + "ai": { + "provider": "openai", + "model": "gpt-4o", + "apiKey": "sk-your-api-key-here" + } +} +``` + +Save the file with `Ctrl+O`, then exit with `Ctrl+X`. + +## Set up Telegram integration + +### Create a Telegram bot + +1. Open Telegram and search for [@BotFather](https://t.me/botfather) +2. Start a chat and send `/newbot` +3. Follow the prompts to: + - Choose a name for your bot (e.g., "My OpenClaw Assistant") + - Choose a username (must end in `bot`, e.g., `myopenclaw_bot`) +4. BotFather responds with your **bot token** - save this securely + +### Configure OpenClaw for Telegram + +Add the Telegram channel to your OpenClaw configuration: + +```bash Terminal +nano ~/.openclaw/openclaw.json +``` + +Update the configuration to include Telegram: + +```json Full configuration with Telegram +{ + "ai": { + "provider": "anthropic", + "model": "claude-sonnet-4-20250514", + "apiKey": "sk-ant-your-api-key-here" + }, + "channels": { + "telegram": { + "enabled": true, + "token": "YOUR_TELEGRAM_BOT_TOKEN" + } + } +} +``` + +Replace `YOUR_TELEGRAM_BOT_TOKEN` with the token from BotFather. + +## Security best practices + +### Configure the firewall + +Enable and configure Ubuntu's firewall (UFW): + +```bash Terminal +sudo ufw allow OpenSSH +sudo ufw enable +sudo ufw status +``` + +### Protect your API keys + +Your API keys are stored in `~/.openclaw/openclaw.json`. Ensure proper permissions: + +```bash Terminal +chmod 600 ~/.openclaw/openclaw.json +``` + +### Use SSH keys only + +For enhanced security, disable password authentication: + +1. Edit the SSH config: + +```bash Terminal +sudo nano /etc/ssh/sshd_config +``` + +2. Find and set: + +```text sshd_config +PasswordAuthentication no +``` + +3. Restart SSH: + +```bash Terminal +sudo systemctl restart sshd +``` + + +Make sure you can connect with your SSH key before disabling password authentication, or you may lock yourself out. + + +For more security recommendations, see the [AWS Lightsail security best practices](https://docs.aws.amazon.com/lightsail/latest/userguide/understanding-ssh-in-amazon-lightsail.html). + +## Running OpenClaw + +### Start the agent + +Run OpenClaw to start your assistant: + +```bash Terminal +openclaw start +``` + +OpenClaw connects to your configured channels (like Telegram) and starts listening for messages. + +### Test your setup + +1. Open Telegram and find your bot +2. Send a message like "Hello!" +3. Your OpenClaw assistant should respond + +### Usage pattern + + +OpenClaw is designed for interactive usage rather than running 24/7. Start it when you need assistance and stop it when you're done. This approach is more cost-effective and secure. + + +To stop OpenClaw, press `Ctrl+C` in the terminal. + +### Give instructions + +You can give your assistant instructions to customize its behavior: + +```bash Terminal +openclaw instruct "You are my personal productivity assistant. Help me manage tasks and remind me of important deadlines." +``` + +## Troubleshooting + +### OpenClaw won't start + +**Check Node.js version:** + +```bash Terminal +node --version +``` + +Ensure it's 22.x.x or higher. + +**Check your config file for syntax errors:** + +```bash Terminal +cat ~/.openclaw/openclaw.json | python3 -m json.tool +``` + +### Telegram bot not responding + +- Verify your bot token is correct +- Make sure you started the bot in Telegram (send `/start`) +- Check that OpenClaw is running and shows the Telegram channel as connected + +### API errors + +- Verify your API key is valid and has available credits +- Check you're using a supported model name +- Ensure your API key has the correct permissions + +### Connection issues + +- Check your instance's public IP hasn't changed +- Verify SSH is allowed through the firewall: `sudo ufw status` +- Ensure your SSH key permissions are correct: `chmod 400 your-key.pem` + +## Next steps + +Now that OpenClaw is running, explore these options: + +- **Add more channels**: Configure additional messaging platforms like Discord or Slack +- **Explore skills**: OpenClaw supports plugins for extended functionality +- **Customize behavior**: Use the `openclaw instruct` command to fine-tune your assistant + +### Resources + +- [OpenClaw GitHub repository](https://github.com/openclaw/openclaw) +- [OpenClaw documentation](https://openclaw.ai/) +- [AWS Lightsail documentation](https://docs.aws.amazon.com/lightsail/) diff --git a/docs/docs.json b/docs/docs.json index 2e2ab01c4..78e74df79 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -9,14 +9,20 @@ }, "favicon": "/logo/favicon.png", "contextual": { - "options": ["copy", "chatgpt", "claude"] + "options": [ + "copy", + "chatgpt", + "claude" + ] }, "api": { "playground": { "display": "simple" }, "examples": { - "languages": ["javascript"] + "languages": [ + "javascript" + ] } }, "navigation": { @@ -26,14 +32,17 @@ "groups": [ { "group": "Introduction", - "pages": ["get-started/base"] + "pages": [ + "get-started/base" + ] }, { "group": "Quickstart", "pages": [ "get-started/build-app", "get-started/launch-token", - "get-started/deploy-smart-contracts" + "get-started/deploy-smart-contracts", + "get-started/learning-resources" ] }, { @@ -47,7 +56,11 @@ }, { "group": "Build with AI", - "pages": ["get-started/docs-mcp", "get-started/docs-llms", "get-started/prompt-library"] + "pages": [ + "get-started/docs-mcp", + "get-started/docs-llms", + "get-started/prompt-library" + ] } ], "global": { @@ -185,7 +198,9 @@ "groups": [ { "group": "Introduction", - "pages": ["base-account/overview/what-is-base-account"] + "pages": [ + "base-account/overview/what-is-base-account" + ] }, { "group": "Quickstart", @@ -420,7 +435,9 @@ "groups": [ { "group": "Introduction", - "pages": ["base-app/introduction/beta-faq"] + "pages": [ + "base-app/introduction/beta-faq" + ] }, { "group": "Chat Agents", @@ -537,15 +554,21 @@ "pages": [ { "group": "Buy", - "pages": ["onchainkit/latest/components/buy/buy"] + "pages": [ + "onchainkit/latest/components/buy/buy" + ] }, { "group": "Checkout", - "pages": ["onchainkit/latest/components/checkout/checkout"] + "pages": [ + "onchainkit/latest/components/checkout/checkout" + ] }, { "group": "Earn", - "pages": ["onchainkit/latest/components/earn/earn"] + "pages": [ + "onchainkit/latest/components/earn/earn" + ] }, { "group": "Fund", @@ -678,7 +701,9 @@ }, { "group": "Token", - "pages": ["onchainkit/latest/utilities/token/format-amount"] + "pages": [ + "onchainkit/latest/utilities/token/format-amount" + ] }, { "group": "Wallet", @@ -780,15 +805,21 @@ "pages": [ { "group": "Buy", - "pages": ["onchainkit/buy/buy"] + "pages": [ + "onchainkit/buy/buy" + ] }, { "group": "Checkout", - "pages": ["onchainkit/checkout/checkout"] + "pages": [ + "onchainkit/checkout/checkout" + ] }, { "group": "Earn", - "pages": ["onchainkit/earn/earn"] + "pages": [ + "onchainkit/earn/earn" + ] }, { "group": "Fund", @@ -869,11 +900,15 @@ }, { "group": "Token", - "pages": ["onchainkit/api/get-tokens"] + "pages": [ + "onchainkit/api/get-tokens" + ] }, { "group": "Wallet", - "pages": ["onchainkit/api/get-portfolios"] + "pages": [ + "onchainkit/api/get-portfolios" + ] } ] }, @@ -933,7 +968,9 @@ }, { "group": "Token", - "pages": ["onchainkit/token/format-amount"] + "pages": [ + "onchainkit/token/format-amount" + ] }, { "group": "Wallet", @@ -1006,12 +1043,16 @@ "cookbook/defi-your-app", "cookbook/go-gasless", "cookbook/base-app-coins", - "cookbook/testing-onchain-apps" + "cookbook/testing-onchain-apps", + "cookbook/openclaw-cloud-deployment" ] }, { "group": "Build with AI", - "pages": ["cookbook/ai-prompting", "cookbook/base-builder-mcp"] + "pages": [ + "cookbook/ai-prompting", + "cookbook/base-builder-mcp" + ] }, { "group": "Vibe Code a Mini App", @@ -1058,394 +1099,8 @@ }, { "tab": "Showcase", - "pages": ["showcase"] - }, - { - "tab": "Learn", - "groups": [ - { - "group": "Building Onchain", - "pages": ["learn/welcome"] - }, - { - "group": "Onchain Concepts", - "pages": [ - "learn/onchain-concepts/core-concepts", - "learn/onchain-concepts/understanding-the-onchain-tech-stack", - { - "group": "Web2 vs Building Onchain", - "pages": [ - "learn/onchain-concepts/building-onchain-wallets", - "learn/onchain-concepts/building-onchain-identity", - "learn/onchain-concepts/building-onchain-gas", - "learn/onchain-concepts/building-onchain-nodes", - "learn/onchain-concepts/building-onchain-frontend-development", - "learn/onchain-concepts/building-onchain-onramps", - "learn/onchain-concepts/building-onchain-social-networks", - "learn/onchain-concepts/building-onchain-ai" - ] - }, - "learn/onchain-concepts/development-flow" - ] - }, - { - "group": "Introduction to Ethereum", - "pages": [ - "learn/introduction-to-ethereum/introduction-to-ethereum-vid", - "learn/introduction-to-ethereum/ethereum-dev-overview-vid", - "learn/introduction-to-ethereum/ethereum-applications", - "learn/introduction-to-ethereum/gas-use-in-eth-transactions", - "learn/introduction-to-ethereum/evm-diagram", - "learn/introduction-to-ethereum/guide-to-base" - ] - }, - { - "group": "Onchain App Development", - "pages": [ - { - "group": "Frontend Setup", - "pages": [ - "learn/onchain-app-development/frontend-setup/overview", - "learn/onchain-app-development/frontend-setup/building-an-onchain-app", - "learn/onchain-app-development/frontend-setup/wallet-connectors", - "learn/onchain-app-development/frontend-setup/introduction-to-providers", - "learn/onchain-app-development/frontend-setup/viem", - "learn/onchain-app-development/frontend-setup/web3" - ] - }, - { - "group": "Writing to Contracts", - "pages": [ - "learn/onchain-app-development/writing-to-contracts/useWriteContract", - "learn/onchain-app-development/writing-to-contracts/useSimulateContract" - ] - }, - { - "group": "Reading and Displaying Data", - "pages": [ - "learn/onchain-app-development/reading-and-displaying-data/useReadContract", - "learn/onchain-app-development/reading-and-displaying-data/useAccount", - "learn/onchain-app-development/reading-and-displaying-data/configuring-useReadContract" - ] - }, - { - "group": "Account Abstraction", - "pages": [ - "learn/onchain-app-development/account-abstraction/gasless-transactions-with-paymaster", - "learn/onchain-app-development/account-abstraction/account-abstraction-on-base-using-biconomy", - "learn/onchain-app-development/account-abstraction/account-abstraction-on-base-using-privy-and-the-base-paymaster", - "learn/onchain-app-development/account-abstraction/account-abstraction-on-base-using-particle-network" - ] - }, - { - "group": "Cross-Chain Development", - "pages": [ - "learn/onchain-app-development/cross-chain/bridge-tokens-with-layerzero", - "learn/onchain-app-development/cross-chain/send-messages-and-tokens-from-base-chainlink" - ] - }, - { - "group": "Finance", - "pages": [ - "learn/onchain-app-development/finance/access-real-time-asset-data-pyth-price-feeds", - "learn/onchain-app-development/finance/access-real-world-data-chainlink", - "learn/onchain-app-development/finance/build-a-smart-wallet-funding-app" - ] - }, - { - "group": "Deploy with Fleek", - "pages": ["learn/onchain-app-development/deploy-with-fleek"] - } - ] - }, - { - "group": "Smart Contract Development", - "pages": [ - { - "group": "Introduction to Solidity", - "pages": [ - "learn/introduction-to-solidity/introduction-to-solidity-overview", - "learn/introduction-to-solidity/anatomy-of-a-smart-contract-vid", - { - "group": "Introduction to Solidity", - "pages": [ - "learn/introduction-to-solidity/introduction-to-solidity-vid", - "learn/introduction-to-solidity/solidity-overview", - "learn/introduction-to-solidity/introduction-to-remix-vid", - "learn/introduction-to-solidity/introduction-to-remix", - "learn/introduction-to-solidity/deployment-in-remix-vid", - "learn/introduction-to-solidity/deployment-in-remix" - ] - } - ] - }, - { - "group": "Contracts and Basic Functions", - "pages": [ - "learn/contracts-and-basic-functions/intro-to-contracts-vid", - "learn/contracts-and-basic-functions/hello-world-step-by-step", - "learn/contracts-and-basic-functions/basic-types", - "learn/contracts-and-basic-functions/basic-functions-exercise" - ] - }, - { - "group": "Deploying to a Testnet", - "pages": [ - "learn/deployment-to-testnet/overview-of-test-networks-vid", - "learn/deployment-to-testnet/test-networks", - "learn/deployment-to-testnet/deployment-to-base-sepolia-sbs", - "learn/deployment-to-testnet/contract-verification-sbs", - "learn/deployment-to-testnet/deployment-to-testnet-exercise" - ] - }, - { - "group": "Control Structures", - "pages": [ - "learn/control-structures/standard-control-structures-vid", - "learn/control-structures/loops-vid", - "learn/control-structures/require-revert-error-vid", - "learn/control-structures/control-structures", - "learn/control-structures/control-structures-exercise" - ] - }, - { - "group": "Storage in Solidity", - "pages": [ - "learn/storage/simple-storage-video", - "learn/storage/simple-storage-sbs", - "learn/storage/how-storage-works-video", - "learn/storage/how-storage-works", - "learn/storage/storage-exercise" - ] - }, - { - "group": "Arrays in Solidity", - "pages": [ - "learn/arrays/arrays-in-solidity-vid", - "learn/arrays/writing-arrays-in-solidity-vid", - "learn/arrays/arrays-in-solidity", - "learn/arrays/filtering-an-array-sbs", - "learn/arrays/fixed-size-arrays-vid", - "learn/arrays/array-storage-layout-vid", - "learn/arrays/arrays-exercise" - ] - }, - { - "group": "The Mapping Type", - "pages": [ - "learn/mappings/mappings-vid", - "learn/mappings/using-msg-sender-vid", - "learn/mappings/mappings-sbs", - "learn/mappings/how-mappings-are-stored-vid", - "learn/mappings/mappings-exercise" - ] - }, - { - "group": "Advanced Functions", - "pages": [ - "learn/advanced-functions/function-visibility-vid", - "learn/advanced-functions/function-visibility", - "learn/advanced-functions/function-modifiers-vid", - "learn/advanced-functions/function-modifiers" - ] - }, - { - "group": "Structs", - "pages": [ - "learn/structs/structs-vid", - "learn/structs/structs-sbs", - "learn/structs/structs-exercise" - ] - }, - { - "group": "Inheritance", - "pages": [ - "learn/inheritance/inheritance-vid", - "learn/inheritance/inheritance-sbs", - "learn/inheritance/multiple-inheritance-vid", - "learn/inheritance/multiple-inheritance", - "learn/inheritance/abstract-contracts-vid", - "learn/inheritance/abstract-contracts-sbs", - "learn/inheritance/inheritance-exercise" - ] - }, - { - "group": "Imports", - "pages": [ - "learn/imports/imports-vid", - "learn/imports/imports-sbs", - "learn/imports/imports-exercise" - ] - }, - { - "group": "Errors", - "pages": [ - "learn/error-triage/error-triage-vid", - "learn/error-triage/error-triage", - "learn/error-triage/error-triage-exercise" - ] - }, - { - "group": "The new Keyword", - "pages": [ - "learn/new-keyword/creating-a-new-contract-vid", - "learn/new-keyword/new-keyword-sbs", - "learn/new-keyword/new-keyword-exercise" - ] - }, - { - "group": "Contract to Contract Interactions", - "pages": [ - "learn/interfaces/intro-to-interfaces-vid", - "learn/interfaces/calling-another-contract-vid", - "learn/interfaces/testing-the-interface-vid", - "learn/interfaces/contract-to-contract-interaction" - ] - }, - { - "group": "Events", - "pages": ["learn/events/hardhat-events-sbs"] - }, - { - "group": "Address and Payable", - "pages": ["learn/address-and-payable/address-and-payable"] - } - ] - }, - { - "group": "Development with Foundry", - "pages": [ - "learn/foundry/deploy-with-foundry", - "learn/foundry/setup-with-base", - "learn/foundry/testing-smart-contracts", - "learn/foundry/verify-contract-with-basescan", - "learn/foundry/generate-random-numbers-contracts" - ] - }, - { - "group": "Development with Hardhat", - "pages": [ - { - "group": "Hardhat Setup and Overview", - "pages": [ - "learn/hardhat/hardhat-setup-overview/hardhat-overview-vid", - "learn/hardhat/hardhat-setup-overview/creating-a-project-vid", - "learn/hardhat/hardhat-setup-overview/hardhat-setup-overview-sbs" - ] - }, - { - "group": "Testing with Typescript", - "pages": [ - "learn/hardhat/hardhat-testing/testing-overview-vid", - "learn/hardhat/hardhat-testing/writing-tests-vid", - "learn/hardhat/hardhat-testing/contract-abi-and-testing-vid", - "learn/hardhat/hardhat-testing/hardhat-testing-sbs" - ] - }, - { - "group": "Etherscan", - "pages": [ - "learn/hardhat/etherscan/etherscan-sbs", - "learn/hardhat/etherscan/etherscan-vid" - ] - }, - { - "group": "Deploying Smart Contracts", - "pages": [ - "learn/hardhat/hardhat-deploy/installing-hardhat-deploy-vid", - "learn/hardhat/hardhat-deploy/setup-deploy-script-vid", - "learn/hardhat/hardhat-deploy/testing-our-deployment-vid", - "learn/hardhat/hardhat-deploy/test-network-configuration-vid", - "learn/hardhat/hardhat-deploy/deployment-vid", - "learn/hardhat/hardhat-deploy/hardhat-deploy-sbs" - ] - }, - { - "group": "Verifying Smart Contracts", - "pages": [ - "learn/hardhat/hardhat-verify/hardhat-verify-vid", - "learn/hardhat/hardhat-verify/hardhat-verify-sbs" - ] - }, - { - "group": "Mainnet Forking", - "pages": [ - "learn/hardhat/hardhat-forking/mainnet-forking-vid", - "learn/hardhat/hardhat-forking/hardhat-forking" - ] - }, - { - "group": "Hardhat Tools and Testing", - "pages": [ - "learn/hardhat/hardhat-tools-and-testing/overview", - "learn/hardhat/hardhat-tools-and-testing/debugging-smart-contracts", - "learn/hardhat/hardhat-tools-and-testing/analyzing-test-coverage", - "learn/hardhat/hardhat-tools-and-testing/optimizing-gas-usage", - "learn/hardhat/hardhat-tools-and-testing/reducing-contract-size", - "learn/hardhat/hardhat-tools-and-testing/deploy-with-hardhat" - ] - } - ] - }, - { - "group": "Token Development", - "pages": [ - { - "group": "Introduction to Tokens", - "pages": [ - "learn/token-development/intro-to-tokens/intro-to-tokens-vid", - "learn/token-development/intro-to-tokens/misconceptions-about-tokens-vid", - "learn/token-development/intro-to-tokens/tokens-overview" - ] - }, - { - "group": "Minimal Tokens", - "pages": [ - "learn/token-development/minimal-tokens/creating-a-minimal-token-vid", - "learn/token-development/minimal-tokens/transferring-a-minimal-token-vid", - "learn/token-development/minimal-tokens/minimal-token-sbs", - "learn/token-development/minimal-tokens/minimal-tokens-exercise" - ] - }, - { - "group": "ERC-20 Tokens", - "pages": [ - "learn/token-development/erc-20-token/analyzing-erc-20-vid", - "learn/token-development/erc-20-token/erc-20-standard", - "learn/token-development/erc-20-token/openzeppelin-erc-20-vid", - "learn/token-development/erc-20-token/erc-20-testing-vid", - "learn/token-development/erc-20-token/erc-20-token-sbs", - "learn/token-development/erc-20-token/erc-20-exercise" - ] - }, - { - "group": "ERC-721 Tokens", - "pages": [ - "learn/token-development/erc-721-token/erc-721-standard-video", - "learn/token-development/erc-721-token/erc-721-standard", - "learn/token-development/erc-721-token/erc-721-on-opensea-vid", - "learn/token-development/erc-721-token/openzeppelin-erc-721-vid", - "learn/token-development/erc-721-token/implementing-an-erc-721-vid", - "learn/token-development/erc-721-token/erc-721-sbs", - "learn/token-development/erc-721-token/erc-721-exercise" - ] - }, - { - "group": "NFT Guides", - "pages": [ - "learn/token-development/nft-guides/signature-mint", - "learn/token-development/nft-guides/dynamic-nfts", - "learn/token-development/nft-guides/complex-onchain-nfts", - "learn/token-development/nft-guides/simple-onchain-nfts", - "learn/token-development/nft-guides/thirdweb-unreal-nft-items" - ] - } - ] - }, - { - "group": "Exercise Contracts", - "pages": ["learn/exercise-contracts"] - } + "pages": [ + "showcase" ] } ] @@ -1885,54 +1540,6 @@ "source": "/chain/why-base", "destination": "/base-chain/quickstart/why-base" }, - { - "source": "/cookbook/account-abstraction/account-abstraction-on-base-using-biconomy", - "destination": "/learn/onchain-app-development/account-abstraction/account-abstraction-on-base-using-biconomy" - }, - { - "source": "/cookbook/account-abstraction/account-abstraction-on-base-using-particle-network", - "destination": "/learn/onchain-app-development/account-abstraction/account-abstraction-on-base-using-particle-network" - }, - { - "source": "/cookbook/account-abstraction/account-abstraction-on-base-using-privy-and-the-base-paymaster", - "destination": "/learn/onchain-app-development/account-abstraction/account-abstraction-on-base-using-privy-and-the-base-paymaster" - }, - { - "source": "/cookbook/account-abstraction/gasless-transactions-with-paymaster", - "destination": "/learn/onchain-app-development/account-abstraction/gasless-transactions-with-paymaster" - }, - { - "source": "/cookbook/client-side-development/introduction-to-providers", - "destination": "/learn/onchain-app-development/frontend-setup/introduction-to-providers" - }, - { - "source": "/cookbook/client-side-development/viem", - "destination": "/learn/onchain-app-development/frontend-setup/viem" - }, - { - "source": "/cookbook/client-side-development/web3", - "destination": "/learn/onchain-app-development/frontend-setup/web3" - }, - { - "source": "/cookbook/cross-chain/bridge-tokens-with-layerzero", - "destination": "/learn/onchain-app-development/cross-chain/bridge-tokens-with-layerzero" - }, - { - "source": "/cookbook/cross-chain/send-messages-and-tokens-from-base-chainlink", - "destination": "/learn/onchain-app-development/cross-chain/send-messages-and-tokens-from-base-chainlink" - }, - { - "source": "/cookbook/defi/access-real-time-asset-data", - "destination": "/learn/onchain-app-development/finance/access-real-time-asset-data-pyth-price-feeds" - }, - { - "source": "/cookbook/defi/access-real-world-data", - "destination": "/learn/onchain-app-development/finance/access-real-world-data-chainlink" - }, - { - "source": "/cookbook/defi/add-in-app-funding", - "destination": "/learn/onchain-app-development/finance/build-a-smart-wallet-funding-app" - }, { "source": "/cookbook/growth/cast-actions", "destination": "/cookbook/onchain-social" @@ -1957,58 +1564,14 @@ "source": "/cookbook/growth/retaining-users", "destination": "/cookbook/onchain-social" }, - { - "source": "/cookbook/ipfs/deploy-with-fleek", - "destination": "/learn/onchain-app-development/deploy-with-fleek" - }, - { - "source": "/cookbook/nfts/complex-onchain-nfts", - "destination": "/learn/token-development/nft-guides/complex-onchain-nfts" - }, - { - "source": "/cookbook/nfts/dynamic-nfts", - "destination": "/learn/token-development/nft-guides/dynamic-nfts" - }, - { - "source": "/cookbook/nfts/nft-minting-zora", - "destination": "/learn/token-development/intro-to-tokens/intro-to-tokens-vid" - }, - { - "source": "/cookbook/nfts/signature-mint", - "destination": "/learn/token-development/nft-guides/signature-mint" - }, - { - "source": "/cookbook/nfts/simple-onchain-nfts", - "destination": "/learn/token-development/nft-guides/simple-onchain-nfts" - }, - { - "source": "/cookbook/nfts/thirdweb-unreal-nft-items", - "destination": "/learn/token-development/nft-guides/thirdweb-unreal-nft-items" - }, { "source": "/cookbook/payments/build-ecommerce-app", "destination": "/onchainkit/checkout/checkout" }, - { - "source": "/cookbook/payments/deploy-shopify-storefront", - "destination": "/learn/welcome" - }, { "source": "/cookbook/payments/transaction-guide", "destination": "/cookbook/defi-your-app" }, - { - "source": "/cookbook/smart-contract-development/foundry/:slug*", - "destination": "/learn/foundry/:slug*" - }, - { - "source": "/cookbook/smart-contract-development/hardhat/:slug*", - "destination": "/learn/hardhat/hardhat-tools-and-testing/:slug*" - }, - { - "source": "/cookbook/smart-contract-development/remix/:slug*", - "destination": "/learn/introduction-to-solidity/deployment-in-remix" - }, { "source": "/cookbook/social/convert-farcaster-frame", "destination": "/cookbook/onchain-social" @@ -2021,10 +1584,6 @@ "source": "/cookbook/social/farcaster-no-code-nft-minting", "destination": "/cookbook/onchain-social" }, - { - "source": "/cookbook/token-gating/gate-irl-events-with-nouns", - "destination": "/learn/welcome" - }, { "source": "/cookbook/use-case-guides/cast-actions", "destination": "/cookbook/onchain-social" @@ -2033,10 +1592,6 @@ "source": "/cookbook/use-case-guides/commerce/build-an-ecommerce-app", "destination": "/onchainkit/checkout/checkout" }, - { - "source": "/cookbook/use-case-guides/commerce/deploy-a-shopify-storefront", - "destination": "/learn/welcome" - }, { "source": "/cookbook/use-case-guides/create-email-campaigns", "destination": "/cookbook/onchain-social" @@ -2045,26 +1600,10 @@ "source": "/cookbook/use-case-guides/creator/convert-farcaster-frame-to-open-frame", "destination": "/cookbook/onchain-social" }, - { - "source": "/cookbook/use-case-guides/creator/nft-minting-with-zora", - "destination": "/learn/token-development/intro-to-tokens/intro-to-tokens-vid" - }, { "source": "/cookbook/use-case-guides/deploy-to-vercel", "destination": "/base-app/build-with-minikit/quickstart#deploying-to-vercel" }, - { - "source": "/cookbook/use-case-guides/finance/access-real-time-asset-data-pyth-price-feeds", - "destination": "/learn/onchain-app-development/finance/access-real-time-asset-data-pyth-price-feeds" - }, - { - "source": "/cookbook/use-case-guides/finance/access-real-world-data-chainlink", - "destination": "/learn/onchain-app-development/finance/access-real-world-data-chainlink" - }, - { - "source": "/cookbook/use-case-guides/finance/build-a-smart-wallet-funding-app", - "destination": "/learn/onchain-app-development/finance/build-a-smart-wallet-funding-app" - }, { "source": "/cookbook/use-case-guides/gating-and-redirects", "destination": "/cookbook/onchain-social" @@ -2445,142 +1984,6 @@ "source": "/smart-wallet/:slug*", "destination": "/base-account/:slug*" }, - { - "source": "/learn/account-abstraction", - "destination": "/learn/onchain-app-development/account-abstraction/gasless-transactions-with-paymaster" - }, - { - "source": "/learn/client-side-development", - "destination": "/learn/onchain-app-development/frontend-setup/introduction-to-providers" - }, - { - "source": "/learn/cross-chain-development", - "destination": "/learn/onchain-app-development/cross-chain/bridge-tokens-with-layerzero" - }, - { - "source": "/learn/deploy-with-fleek", - "destination": "/learn/onchain-app-development/deploy-with-fleek" - }, - { - "source": "/learn/development-tools/overview", - "destination": "/learn/welcome" - }, - { - "source": "/learn/erc-20-token/:slug*", - "destination": "/learn/token-development/erc-20-token/:slug*" - }, - { - "source": "/learn/erc-721-token/:slug*", - "destination": "/learn/token-development/erc-721-token/:slug*" - }, - { - "source": "/learn/ethereum-applications", - "destination": "/learn/introduction-to-ethereum/ethereum-applications" - }, - { - "source": "/learn/ethereum-dev-overview", - "destination": "/learn/introduction-to-ethereum/ethereum-dev-overview-vid" - }, - { - "source": "/learn/etherscan/:slug*", - "destination": "/learn/hardhat/etherscan/:slug*" - }, - { - "source": "/learn/evm-diagram", - "destination": "/learn/introduction-to-ethereum/evm-diagram" - }, - { - "source": "/learn/frontend-setup/:slug*", - "destination": "/learn/onchain-app-development/frontend-setup/:slug*" - }, - { - "source": "/learn/gas-use-in-eth-transactions", - "destination": "/learn/introduction-to-ethereum/gas-use-in-eth-transactions" - }, - { - "source": "/learn/guide-to-base", - "destination": "/learn/introduction-to-ethereum/guide-to-base" - }, - { - "source": "/learn/hardhat-deploy/:slug*", - "destination": "/learn/hardhat/hardhat-deploy/:slug*" - }, - { - "source": "/learn/hardhat-forking/:slug*", - "destination": "/learn/hardhat/hardhat-forking/:slug*" - }, - { - "source": "/learn/hardhat-setup-overview/:slug*", - "destination": "/learn/hardhat/hardhat-setup-overview/:slug*" - }, - { - "source": "/learn/hardhat-testing/:slug*", - "destination": "/learn/hardhat/hardhat-testing/:slug*" - }, - { - "source": "/learn/hardhat-tools-and-testing/overview", - "destination": "/learn/hardhat/hardhat-tools-and-testing/overview" - }, - { - "source": "/learn/hardhat-verify/:slug*", - "destination": "/learn/hardhat/hardhat-verify/:slug*" - }, - { - "source": "/learn/help-on-discord", - "destination": "/learn/welcome" - }, - { - "source": "/learn/intro-to-tokens/:slug*", - "destination": "/learn/token-development/intro-to-tokens/:slug*" - }, - { - "source": "/learn/introduction-to-ethereum", - "destination": "/learn/introduction-to-ethereum/introduction-to-ethereum-vid" - }, - { - "source": "/learn/learning-objectives", - "destination": "/learn/welcome" - }, - { - "source": "/learn/minimal-tokens/:slug*", - "destination": "/learn/token-development/minimal-tokens/:slug*" - }, - { - "source": "/learn/reading-and-displaying-data/:slug*", - "destination": "/learn/onchain-app-development/reading-and-displaying-data/:slug*" - }, - { - "source": "/learn/writing-to-contracts/:slug*", - "destination": "/learn/onchain-app-development/writing-to-contracts/:slug*" - }, - { - "source": "/base-learn/progress", - "destination": "/learn/welcome" - }, - { - "source": "/tutorials/intro-to-foundry-setup", - "destination": "/learn/foundry/deploy-with-foundry" - }, - { - "source": "/tutorials/hardhat-profiling-gas", - "destination": "/learn/hardhat/hardhat-tools-and-testing/optimizing-gas-usage" - }, - { - "source": "/tutorials/hardhat-profiling-size", - "destination": "/learn/hardhat/hardhat-tools-and-testing/reducing-contract-size" - }, - { - "source": "/tutorials/hardhat-debugging", - "destination": "/learn/hardhat/hardhat-tools-and-testing/debugging-smart-contracts" - }, - { - "source": "/tutorials/hardhat-test-coverage", - "destination": "/learn/hardhat/hardhat-tools-and-testing/analyzing-test-coverage" - }, - { - "source": "/tutorials/intro-to-providers", - "destination": "/learn/onchain-app-development/frontend-setup/introduction-to-providers" - }, { "source": "/network-information", "destination": "/base-chain/quickstart/connecting-to-base" @@ -2593,10 +1996,6 @@ "source": "/tools/network-faucets", "destination": "/base-chain/tools/network-faucets" }, - { - "source": "/tutorials", - "destination": "/learn" - }, { "source": "/tutorials/deploy-with-foundry", "destination": "/cookbook/smart-contract-development/foundry/deploy-with-foundry" @@ -2844,6 +2243,10 @@ { "source": "/mini-apps/technical-reference/minikit/hooks/useNotification", "destination": "/onchainkit/latest/components/minikit/hooks/useNotification" + }, + { + "source": "/learn/:slug*", + "destination": "/get-started/learning-resources" } ], "integrations": { diff --git a/docs/get-started/learning-resources.mdx b/docs/get-started/learning-resources.mdx new file mode 100644 index 000000000..da873366e --- /dev/null +++ b/docs/get-started/learning-resources.mdx @@ -0,0 +1,20 @@ +--- +title: "Learning Resources" +description: "Find educational content for learning Solidity, Ethereum, and blockchain development" +--- + +## Archived Content + +All previous learning content, including Solidity tutorials, Ethereum basics, and blockchain development guides, is now available at: + +**[github.com/base/learn-docs](https://github.com/base/learn-docs)** + +## Coming Soon + +We will be adding more learning resources to help you build on Base. Stay tuned for: + +- Updated tutorials and guides +- Community-contributed resources +- New educational content + +In the meantime, check out the [Cookbook](/cookbook/onchain-social) for practical tutorials and implementation guides. diff --git a/docs/learn/address-and-payable/address-and-payable.mdx b/docs/learn/address-and-payable/address-and-payable.mdx deleted file mode 100644 index 1878e6acf..000000000 --- a/docs/learn/address-and-payable/address-and-payable.mdx +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: Address and Payable in Solidity -sidebarTitle: Guide -description: A comprehensive guide to understanding and using address and payable address types in Solidity. -hide_table_of_contents: false ---- - -Understanding address and payable address types is crucial for managing Ether transfers and interactions within your Solidity contracts. This article will delve into their key distinctions and practical applications. - ---- - -## Objectives - -By the end of this lesson, you should be able to: - -- Differentiate between address and address payable types in Solidity -- Determine when to use each type appropriately in contract development -- Employ address payable to send Ether and interact with payable functions - ---- - -## Ethereum Addresses - -In Solidity, Ethereum addresses play a crucial role in interacting with the Ethereum blockchain. An Ethereum address is a 20-byte hexadecimal string that represents the destination of transactions or the owner of a smart contract. These addresses are used to send and receive Ether and interact with smart contracts. - -### Addresses - -Regular addresses in Solidity are used for various purposes, including: - -- Identifying the owner of a smart contract -- Sending Ether from one address to another -- Checking the balance of an address - Here's an example of declaring a regular address variable in Solidity: - -
- -```solidity -address public owner; -``` - -### Payable Addresses - -`payable` keyword is a language-level feature provided by Solidity to enable the handling of Ether within smart contracts, and it is not a feature of the Ethereum Virtual Machine itself, but rather a part of the Solidity language's syntax. They are used when you want a contract to be able to receive Ether from external sources, such as other contracts or user accounts. - -Payable addresses are often used when creating crowdfunding or token sale contracts, where users send Ether to the contract's address in exchange for tokens or to fund a project. - -Here's an example of declaring a payable address variable in Solidity: - -```solidity -address payable public projectWallet; -``` - -Payable [Address] are marked as payable, which means they can accept incoming Ether transactions. It's important to note that regular addresses cannot receive Ether directly. - -## Receiving Ether with Payable Addresses - -To receive Ether in a contract using a payable address, you need to define a payable function that can accept incoming transactions. This function is typically named receive or fallback. Here's an example: - -```solidity -fallback() external payable { - // Handle the incoming Ether here -} -``` - -In this example, the fallback function is marked as external and payable, which means it can receive Ether when someone sends it to the contract's address. You can then add custom logic to handle the received Ether, such as updating contract balances or triggering specific actions. - -## Usage - -```solidity -contract PaymentReceiver { - address payable owner; - - constructor() payable { - owner = payable(msg.sender); // Convert msg.sender to payable - } - - function receiveEther() public payable { - // This function can receive Ether - } - - function withdrawEther() public { - owner.transfer(address(this).balance); // Send Ether to owner - } -} -``` - -## Conclusion - -Appropriately using address and address payable types is essential for secure and efficient Solidity contract development. By understanding their distinctions and applying them correctly, you can effectively manage Ether transfers and interactions within your contracts. - -[Address]: https://docs.soliditylang.org/en/latest/types.html#address diff --git a/docs/learn/advanced-functions/function-modifiers-vid.mdx b/docs/learn/advanced-functions/function-modifiers-vid.mdx deleted file mode 100644 index 21a9fa35f..000000000 --- a/docs/learn/advanced-functions/function-modifiers-vid.mdx +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Function Modifiers -description: Use modifiers to control how functions work. -hide_table_of_contents: false ---- - -import { Video } from '/snippets/VideoPlayer.mdx'; - -