Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/chainstacklabs/deterministic-contract-deployment-remix

Tutorial on deterministically deploying EVM smart contracts
https://github.com/chainstacklabs/deterministic-contract-deployment-remix

create2 create2-contract-deployment deterministic ethereum evm

Last synced: 12 days ago
JSON representation

Tutorial on deterministically deploying EVM smart contracts

Awesome Lists containing this project

README

        

Labs


Chainstack is the leading suite of services connecting developers with Web3 infrastructure


 
 
 
 
 


Homepage
Supported protocols
Chainstack blog
Chainstack docs
Blockchain API reference

Start for free

# Deploying a deterministic smart contract on Ethereum

This project shows how you how to use a method called deterministic deployment that allows for precomputing contract addresses before deployment.

Read the full guide on the Chainstack Blog
* [Deploying a deterministic smart contract on Ethereum](https://chainstack.com/deploying-a-deterministic-contract-on-ethereum/)

## Project details

For this example, we built a simple contract factory for a `SimpleWallet` contract. The factory allows you to deploy the `SimpleWallet` at a predefined address. The `index.js` file holds a script in interact with the smart contract.

## Quickstart

Clone the repository:

```sh
git clone https://github.com/chainstacklabs/deterministic-contract-deployment-remix.git
```

Deploy an instance of the `SimpleWallet` contract with [Remix](https://remix.ethereum.org/).

Edit the `index.js` file to include the contract address, private key, and RPC endpoint.

```js
const PRIVATE_KEY = "";

const simpleWalletAddress = "";

const provider = ethers.getDefaultProvider("");
```

Install dependencies:

```sh
npm ci
```

> Use `npm ci` to launch a `clean install` of the dependencies, this will install the same version as in the `package.json` file.

Run the script to interact:

```sh
node index
```

## Prerequisites

* Node.js: ^16.17.0— [install Node](https://nodejs.org/en/download/)
* A node RPC endpoint.

Deploy a node with Chainstack:

1. [Sign up with Chainstack](https://console.chainstack.com/user/account/create).
1. [Deploy a node](https://docs.chainstack.com/platform/join-a-public-network).
1. [View node access and credentials](https://docs.chainstack.com/platform/view-node-access-and-credentials).