Deploy Unirep Contract

Deploy a Unirep smart contract with an Ethereum account

  • Config an ethereum provider before deploying a Unirep smart contract.

  • Default: run a local hardhat node by

npx hardhat node

By default it runs at http://localhost:8545 And it will list 20 accounts including their private keys


npx ts-node cli/index.ts deploy 
                  (-dp | -d DEPLOYER_PRIVKEY) 
                  [-e ETH_PROVIDER]
                  [-l EPOCH_LENGTH] 
                  [-f ATTESTING_FEE]
                  [-td TREE_DEPTHS_CONFIG]
  • The address of the Unirep contract should be printed after executing the command.

  • Then we have to use the address to perform the following actions.


  -dp, --prompt-for-deployer-privkey
                        Whether to prompt for the deployer's Ethereum private key and ignore -d / --deployer-privkey
                        The deployer's Ethereum private key
  -x CONTRACT, --contract CONTRACT
                        Unirep contract address. If it is not provided, a Unirep contract will be created in the process.
  -e ETH_PROVIDER, --eth-provider ETH_PROVIDER
                        A connection string to an Ethereum provider. Default: http://localhost:8545
  -l EPOCH_LENGTH, --epoch-length EPOCH_LENGTH
                        The length of an epoch in seconds. Default: 30
  -f ATTESTING_FEE, --attesting-fee ATTESTING_FEE
                        The fee to make an attestation. Default: 0.01 eth (i.e., 10 * 16)
  -td TREE_DEPTHS_CONFIG, --tree-depths-config TREE_DEPTHS_CONFIG
                        The configuration of tree depths: circuit or contract. Default: circuit

Options inherited from parent commands

  -h, --help            Show this help message and exit.

Last updated