# \[Request\] Guide to deploy ERC1820

**URL:** <https://forum.openzeppelin.com/t/request-guide-to-deploy-erc1820/1007>\
**Category:** Contracts\
**Created:** [July 9, 2019, 8:02pm UTC](https://forum.openzeppelin.com/t/request-guide-to-deploy-erc1820/1007 "2019-07-09T20:02:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrwillis](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/mrwillis/32/3628_2.png) [@mrwillis](https://forum.openzeppelin.com/u/mrwillis)\
**Post date:** [July 9, 2019, 8:02pm UTC](https://forum.openzeppelin.com/t/request-guide-to-deploy-erc1820/1007/1 "2019-07-09T20:02:40Z")

</div>

Hi,

I am trying to deploy ERC777 on a private chain and i’m trying to use the `tokensReceived` feature. I notice that in order to do this with `_send` I need to register with the ERC1820 contract, which doesn’t exist on my private chain yet. Is there any example I can use to deploy the ERC1820 contract to the exact address that is required?

> <https://github.com/OpenZeppelin/openzeppelin-solidity/blob/cdccf5ed21844ce89ff589767bf5ccf77c336da1/contracts/token/ERC777/ERC777.sol#L30>

I notice in the docs this is coming soon but I would like to use this now.

Thanks

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [July 9, 2019, 11:46pm UTC](https://forum.openzeppelin.com/t/request-guide-to-deploy-erc1820/1007/2 "2019-07-09T23:46:01Z")

</div>

Hi @mrwillis welcome to the community.

I wrote a simple ERC777 token example which includes deploying the ERC1820 registry to a local test network:

> [@Simple ERC777 token example](https://forum.openzeppelin.com/t/simple-erc777-token-example/746):
>
> [OpenZeppelin 2.3.0 release candidate](https://forum.openzeppelin.com/t/openzeppelin-2-3-0-release-candidate/572) includes an implementation of ERC777. I created a simple ERC777 token inheriting from the OpenZeppelin implementation, based on the [SimpleToken](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/examples/SimpleToken.sol) example. A key point to note is that in a [testing environment an ERC777 token requires deploying an ERC1820 registry](https://forum.openzeppelin.com/t/erc777-constructor-arguments/664/4) using [@openzeppelin/test-helpers](https://github.com/OpenZeppelin/openzeppelin-test-helpers). (Thanks @frangio) The same applies when deploying to a private network. (We can use the OpenZeppelin Test Helpers to deploy the ERC1820 registry to a private network…

Let me know if you need more information.

---

<div class="post-metadata">

**Author:** ![mrwillis](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/mrwillis/32/3628_2.png) [@mrwillis](https://forum.openzeppelin.com/u/mrwillis)\
**Post date:** [July 10, 2019, 7:52pm UTC](https://forum.openzeppelin.com/t/request-guide-to-deploy-erc1820/1007/3 "2019-07-10T19:52:56Z")

</div>

Thank you. I am interested in the tokensReceived feature as well. If I understand correctly I need to register my contracts that implement `tokensReceived` in the ERC1820 registry on my test chain. Is there any example for this?

Thanks

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [July 10, 2019, 11:36pm UTC](https://forum.openzeppelin.com/t/request-guide-to-deploy-erc1820/1007/4 "2019-07-10T23:36:18Z")

</div>

Hi @mrwillis

You are correct, contracts that implement `tokensReceived` need to `setInterfaceImplementer`

The tests for the OpenZeppelin ERC777 implementation show this process.

> **[OpenZeppelin/openzeppelin-contracts](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/test/token/ERC777)**
>
> OpenZeppelin Contracts is a library for secure smart contract development. - OpenZeppelin/openzeppelin-contracts

I am working on an update to my Simple ERC777 token example to include a contract recipient.

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [July 11, 2019, 4:04am UTC](https://forum.openzeppelin.com/t/request-guide-to-deploy-erc1820/1007/5 "2019-07-11T04:04:05Z")

</div>

Hi @mrwillis

I have updated my Simple ERC777 token example to include a recipient contract.

> [@Simple ERC777 token example](https://forum.openzeppelin.com/t/simple-erc777-token-example/746):
>
> [OpenZeppelin 2.3.0 release candidate](https://forum.openzeppelin.com/t/openzeppelin-2-3-0-release-candidate/572) includes an implementation of ERC777. I created a simple ERC777 token inheriting from the OpenZeppelin implementation, based on the [SimpleToken](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/examples/SimpleToken.sol) example. A key point to note is that in a [testing environment an ERC777 token requires deploying an ERC1820 registry](https://forum.openzeppelin.com/t/erc777-constructor-arguments/664/4) using [@openzeppelin/test-helpers](https://github.com/OpenZeppelin/openzeppelin-test-helpers). (Thanks @frangio) The same applies when deploying to a private network. (We can use the OpenZeppelin Test Helpers to deploy the ERC1820 registry to a private network…

The recipient contract needs to implement the `tokensReceived` function from [IERC777Recipient.sol](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC777/IERC777Recipient.sol).

The recipient contract also needs to register with the ERC1820 registry that it is an interface implementer of `ERC777TokensRecipient`  
`_erc1820.setInterfaceImplementer(address(this), TOKENS_RECIPIENT_INTERFACE_HASH, address(this));`

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [July 15, 2019, 12:16am UTC](https://forum.openzeppelin.com/t/request-guide-to-deploy-erc1820/1007/6 "2019-07-15T00:16:46Z")

</div>

Hi @mrwillis

Have you been able to deploy as you wanted? Please ask further questions if you need to.

I have marked my reply as the solution.

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [August 31, 2019, 10:08am UTC](https://forum.openzeppelin.com/t/request-guide-to-deploy-erc1820/1007/7 "2019-08-31T10:08:23Z")

</div>

2 posts were split to a new topic: [How and why does ERC777 need ERC1820](https://forum.openzeppelin.com/t/how-and-why-does-erc777-need-erc1820/1271)
