# Verify Proxy Contract

## How to Verify Proxy Contract <a href="#how-to-verify-proxy-contract" id="how-to-verify-proxy-contract"></a>

*Please learn how to deploy an upgradable BRC20 contract*

### Flatten your contract <a href="#flatten-your-contract" id="flatten-your-contract"></a>

#### Install flattener <a href="#install-flattener" id="install-flattener"></a>

&#x20;

```
npm install truffle-flattener -g
```

Run the following command:

```
$ truffle-flattener BRC20TokenImplementation.sol > BRC20TokenImplementationFlattened.sol
$ truffle-flattener BRC20UpgradeableProxy.sol > BRC20UpgradeableProxyFlattened.sol"
```

&#x20;

### Compile and deploy your contract with Remix <a href="#compile-and-deploy-your-contract-with-remix" id="compile-and-deploy-your-contract-with-remix"></a>

#### Compile Implementation contract <a href="#compile-implementation-contract" id="compile-implementation-contract"></a>

* Open Remix IDE: [https://remix.ethereum.org](https://remix.ethereum.org/)
* Select solidity language
* Create new contract `BRC20Token.sol` and copy contract code from flattened `BRC20TokenImplementationFlattened.sol`
* Compile the implementation contract
* Click on this button to switch to the compile page
* Select “BRC20TokenImplementation” contract
* Enable “Auto compile” and “optimization”
* Click “ABI” to copy the contract abi and save it.

#### Deploy the implementation contract <a href="#deploy-the-implementation-contract" id="deploy-the-implementation-contract"></a>

* Select “Injected Web3”
* Select “BRC20TokenImplementation” contract
* Click the “Deploy” button and Metamask will pop up
* Click the “confirm” button to sign and broadcast the transaction to TC.
* Then, you need to initialize the token: fill in all the parameters and click on “transact”

> Note: `Owner` should be the address who send the deploy transaction before.

* Click on the “Copy” icon to save the initializatioin data: Like the following: \`\`\`

```
0xef3ebcb800000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000fc41d5571120442d1bb82cea0884966e543cb78b000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000548454c4c4f000000000000000000000000000000000000000000000000000000
```

* Confirm your transaction in MetaMask

### Compile Proxy Contract <a href="#compile-proxy-contract" id="compile-proxy-contract"></a>

* Create new contract proxy.sol and copy contract code from flattened `BRC20UpgradeableProxyFlattened.sol`. &#x20;
* Compile the proxy contractClick on this button to switch to the compile page
* Select “BRC20UpgradeableProxy” contract
* Enable “Auto compile” and “optimization”Click “ABI” to copy the contract abi and save it.

#### Deploy the proxy contract <a href="#deploy-the-proxy-contract" id="deploy-the-proxy-contract"></a>

* Select “Injected Web3”Select “BRC20UpgradeableProxy.sol” contract
* Fill in the parameters

**Logic**: The address of `BRC20Implementation` contract **Admin**: admin cannot be BRC20 token owner **Data**: use the initialization data you saved before

* Click the “Deploy” button and Metamask will pop up
* Click the “confirm” button to sign and broadcast transaction to TC.

### Verify Proxy Contract on BscScan <a href="#verify-proxy-contract-on-bscscan" id="verify-proxy-contract-on-bscscan"></a>

Note: The way to verify the BRC20TokenImplementation contract is the same as before.

* Go to your contact page and click on “Verify and Publish”
* Select Single file
* Copy your contract code below and check “Optimization” if it’s enabled
* Contractor Data: Please use this site for getting the correct constructor data: <https://abi.hashex.org/#>

First, you need to copy ABI json of “BRC20UpgradeableProxy.sol” contractThen, click on “Parse”

Add all those 3 parameters as indicated. Then copy/paste the result.

That’s it! You have verified your proxy contract.

### Link these two contracts <a href="#link-these-two-contracts" id="link-these-two-contracts"></a>

* Click on “More Options” and choose “is this a proxy”.
* Verify your proxy address
* Confirm the implementation address.

If you go back to the contract page and you can see two more buttons “Read as Proxy” and “Write as Proxy”


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bitgert.com/for-developers/verify-proxy-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
