I am trying to deploy contracts determinsitically using 'salt' via brownie. I would like to be able to do something like this:

>>> helloContract = Hello.deploy({'from':accounts[0],'salt':123456})

More details:

For example, I am able to deploy my "Hello" Contract deterministically using a factory contract and a salt as below.

pragma solidity ^0.8.0;

contract Hello {
    string public hello = "Hello";

contract HelloFactory {
    function createHelloWithSalt ( uint _salt ) public returns (address) {    
            Hello helloContract = new Hello {salt: bytes32(_salt)} ();
            return address(helloContract);

Using the above Factory, I can create Hello contracts determinsitically through the below code in brownie console.

>>> HF = HelloFactory.deploy({'from':accounts[0]})
>>> hello = HF.createHelloWithSalt(123456,{'from':accounts[0]})
>>> # this works

Is there any way for me to replicate directly in brownie CLI the same using something like

>>> Hello.deploy({'from':accounts[0],'salt':123456)
>>> # doesn't work
  • It doesn't seem possible. To use the salt parameter you need to deploy the contract with CREATE2 opcode.
    – Ismael
    Mar 5 at 2:56

1 Answer 1


This is impossible to do. CREATE2 is the opcode which needs to be used in order to use the {salt} feature. When you deploy a contract from an EOA (i.e. without a factory), you aren't using this opcode, so you can't do the deployment with a salt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.