OpenZeppelin Starter Kits come with everything you need to start using upgradeable Smart contracts inside your applications. It also includes all the configuration required to deploy to different networks.
Ensure you are in a new and empty directory, and run the
unpack command with the name of the
starter kit you want to use, e.g.,
openzeppelin unpack <kit_name>
|You can use other starter kits as well. You can find them all here.|
In a new terminal window, run your local blockchain:
In your original terminal window, at the top level of your folder, initialize the project and follow the prompts:
In a new terminal window, in the
client directory, run the React app:
npm run start
Open a web browser and navigate to:
You can now start building your dapp!
When developing, Solidity contracts should be placed in the top level of the Starter Kit in the
To compile your contracts, use:
This will compile your contracts and create build artifacts which are then stored in a newly created
To create an instance of your contract on the blockchain:
cli will guide you through the process of creation, including offering you the ability to call a function at the time of deployment.
For ease of use, it is not necessary to compile your contracts prior to using
create to deploy them. All contracts will be automatically compiled as a part of the
These instances are upgradeable but will always keep the same address. You can create as many instances of the same contract as you would like.
To learn more about upgradeable smart contracts: OpenZeppelin SDK
To simplify interacting with your contracts and blockchain, as well as handling small tasks such as sending ETH between addresses,
OpenZeppelin-cli offers a number of convenient interactive commands that can be used directly from the command line.
To call a public method, use the following from the top level of your project command line:
Follow the command line prompt where you will be asked to choose your network, the address of the created contract instance, and the public method you would like to call.
To send a transaction to a contract instance:
Follow the command line prompt where you will be asked to choose your network, the address of the created contract instance, and a list of the public functions available to call. If you have any arguments to pass, the
cli will prompt you to enter those before sending the transaction.
This is very useful for quickly testing a contract to see if a function does what you expect.
To quickly transfer funds on the network of your choice, the
transfer command is available. Using
transfer requires that your
networks.js file is configured and that your node (such as
ganache) has an unlocked address and you are able to send ETH (and have ETH to send).
This will guide you through several prompts and allow you to effortlessly transfer ETH directly from the command line.
To query the ETH balance of the specified account:
openzeppelin balance [address]
openzeppelin to see a complete list of available commands directly from the command line or visit OpenZeppelin CLI for a complete
From inside the development console:
From outside the development console:
Jest is included for testing React components. Compile your contracts before running Jest, or you may receive some file not found errors.
From inside the client directory when running this:
npm run test