• Homepage •
Supported protocols •
Chainstack blog •
Chainstack docs •
Blockchain API reference •
• Start for free •
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
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.
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 aclean install
of the dependencies, this will install the same version as in thepackage.json
file.
Run the script to interact:
node index
- Node.js: ^16.17.0— install Node
- A node RPC endpoint.
Deploy a node with Chainstack: