> ## Documentation Index
> Fetch the complete documentation index at: https://docs.magic.link/llms.txt
> Use this file to discover all available pages before exploring further.

# Celo

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="rounded-[10px] flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 group-hover:opacity-[0.9] font-medium">
        <span>
          {children}
        </span>
      </button>
    </a>
  </div>;
};

<Card title="Celo implementation guide">
  How to use Magic with the Celo blockchain

  <br />

  <Button href="/posts/magic-celo">View guide</Button>
</Card>

## Overview

[Celo](https://celo.org/) is a Layer 2 solution enhancing Ethereum by providing developers with faster and more cost-efficient transactions. For developers, its seamless compatibility with Ethereum's ecosystem and tools simplifies dApp development. Celo is especially beneficial for those looking to boost performance while maintaining the decentralized principles of Ethereum.

**As Celo is EVM compatible**, you can follow the [Ethereum](/embedded-wallets/blockchains/ethereum/javascript)documentation to send your first transaction and utilize all other wallet features.

## Installation

To install Magic and Celo, follow the instructions below.

<CodeGroup>
  ```bash NPM icon="npm" theme={null}
  npm install --save magic-sdk @celo/contractkit ethers
  ```

  ```bash Yarn icon="yarn" theme={null}
  yarn add magic-sdk @celo/contractkit ethers
  ```
</CodeGroup>

## Send Transaction

### Getting Test CELO token

Before you can send transaction on the Celo blockchain, you'll need to acquire some test CELO token (Celo's native cryptocurrency for test network).

1. Go to our [**Celo Example**](https://go.magic.link/example-celo) application
2. Login with your email address
3. Copy your Celo public address
4. Go to the [**Celo Faucet**](https://celo.org/developers/faucet)
5. Paste your copied Celo public address in the text input
6. Now you can use your test CELO token in our [**Celo Example**](https://go.magic.link/example-celo)

### Use Magic Rpc Provider

```js JavaScript icon="square-js" theme={null}
import { Magic } from 'magic-sdk';
import { newKit } from '@celo/contractkit';
import { parseEther } from 'ethers';

const rpcUrl = 'https://alfajores-forno.celo-testnet.org';
const magic = new Magic('YOUR_API_KEY', {
  network: {
    rpcUrl,
  },
});

const kit = newKit(rpcUrl);
kit.connection.web3.setProvider(magic.rpcProvider);

const { publicAddress } = await magic.user.getMetadata();

kit.defaultAccount = publicAddress;

const oneGold = parseEther('1').toString();

const tx = await kit.sendTransaction({
  from: publicAddress,
  to: 'Destination Address',
  value: oneGold,
  gasPrice: 1000000000,
});

const hash = await tx.getHash();
const receipt = await tx.waitReceipt();

console.log('transaction result: ', hash, receipt);
```

## Smart Contract

### Getting Test CELO token

Before you can send transaction on the Celo blockchain, you'll need to acquire some test CELO token (Celo's native cryptocurrency for test network).

1. Go to our [**Celo Example**](https://go.magic.link/example-celo) application
2. Login with your email address
3. Copy your Celo public address
4. Go to the [**Celo Faucet**](https://celo.org/developers/faucet)
5. Paste your copied Celo public address in the text input
6. Now you can use your test CELO token in our [**Celo Example**](https://go.magic.link/example-celo)

### Contract Send

#### ES Modules/TypeScript

```js JavaScript icon="square-js" theme={null}
import { Magic } from 'magic-sdk';
import { BrowserProvider, Contract } from 'ethers';

const magic = new Magic('YOUR_API_KEY', {
  network: {
    rpcUrl: 'https://alfajores-forno.celo-testnet.org',
  },
});

const contractAddress = '0xcf71aB733148F70647129F3006E92439d11946A9';

const abi = [
  {
    constant: true,
    inputs: [],
    name: 'getName',
    outputs: [
      {
        internalType: 'string',
        name: '',
        type: 'string',
      },
    ],
    payable: false,
    stateMutability: 'view',
    type: 'function',
  },
  {
    constant: false,
    inputs: [
      {
        internalType: 'string',
        name: 'newName',
        type: 'string',
      },
    ],
    name: 'setName',
    outputs: [],
    payable: false,
    stateMutability: 'nonpayable',
    type: 'function',
  },
];
const { publicAddress } = await magic.user.getMetadata();

const provider = new BrowserProvider(magic.rpcProvider);
const signer = await provider.getSigner();
const instance = new Contract(contractAddress, abi, signer);

const tx = await instance.setName('new name');
const receipt = await tx.wait();

console.log('contract send result: ', tx.hash, receipt);
```

## Compatibility

* All `Auth`, `User` and most `Wallet` module methods\*
* All EVM Provider functionality to respond to supported [RPC methods](/embedded-wallets/sdk/client-side/javascript#evm-rpc-methods)

*\*Some features are not yet compatible such as NFT Viewer and Fiat On-ramps.*

*Need a feature or see a problem?* File an issue on our [github repo](https://github.com/magiclabs/magic-js).

## Resources & Tools

* Documentation: [https://docs.celo.org/](https://docs.celo.org/)

* Block Explorer:
  * [https://explorer.celo.org/mainnet/](https://explorer.celo.org/mainnet/) (Mainnet)

* Faucet: [https://faucet.quicknode.com/celo](https://faucet.quicknode.com/celo)

* [Demo](https://magic-celo.vercel.app/login)

* [Example](https://go.magic.link/example-celo)
