Skip to content

chainstacklabs/deterministic-contract-deployment-remix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Labs

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

         

HomepageSupported protocolsChainstack blogChainstack docsBlockchain 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

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:

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

Deploy an instance of the SimpleWallet contract with Remix.

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

const PRIVATE_KEY = "<YOUR_PRIVATE_KEY>";

const simpleWalletAddress = "<YOUR_INSTANCE_ADDRESS>";

const provider = ethers.getDefaultProvider("<YOUR_GOERLI_PROVIDER>");

Install dependencies:

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:

node index

Prerequisites

Deploy a node with Chainstack:

  1. Sign up with Chainstack.
  2. Deploy a node.
  3. View node access and credentials.