13

I created a multisig wallet using Mist, but don't know how to deploy a contract from the wallet address. Is it even possible? If so, how to do this?

1
  • 1
    What is the goal here? It's likely possible to deploy a contract using a multisig wallet, but the gas costs are going to be huge, as you have to store the contract data in the multisig transaction, approve it, then deploy the contract. The account that deploys a contract doesn't get special permissions unless the contract gives it to them, and you could pretty easily modify the contract to let you specify who gets special permissions instead of assuming they go to the deployer. I would just deploy the contract with standard keys and assign any special permissions to the multisig contract.
    – AusIV
    Commented Aug 25, 2018 at 16:24

4 Answers 4

2

It would be possible to use a multisig wallet with a little slight of hand, provided only that the multisig contract can invoke arbitrary functions in other contracts.

Since most multisigs cannot, themselves, create a contract, it will need a helping hand. A "Factory" contract could be manually deployed (by anyone/anything) first. It would include the template of the contract to create and a function, e.g. function deployInstance() .... A multisig would be able to call that function. That would typically result in the multisig acquiring owner privileges.

This would double the cost of a one-time deployment but it would get it done.

It's worth mentioning that if the end-state objective is for the multisig to have ownership, it might be practical to deploy from a normal EOA and then transfer ownership to the multisig. Transferability is a property of the contract to deploy, but not unusual or unreasonable.

Hope it helps.

0

It depends on the multisig wallet you are using, but most likely no.

There are 2 cases:

  • Case 1: You know the smart contract B to deploy from smart contract A, BEFORE deploying A
  • Case 2: You only know the smart contract B to deploy A, AFTER deploying A

Case 1

This is the most common case, and the only case where you can use Solidity only. When you write your smart contract A, you need to import B or define B in the same file. In a function, you can create an instance of B like this:

B b = new B()

Case 2

In this case, Solidity alone is not enough. You need to use assembly, which is a sort of escape hatch provided by Solidity to allow you to specify which EVM opcode you want to execute. This is the most flexible way to use the EVM from Solidity, but it is also risky because you can hang yourself.

This would be the procedure:

  1. Compile the smart contract into bytecode
  2. Pass this bytecode to the smart contract as argument of a function
  3. In this function, use assembly to invoke the CREATE opcode, and pass it the bytecode
0

This is possible in theory, though not all implementations of multisig wallet allow doing this. Contract creation is performed by opcodes, that are different from opcodes used to execute normal transactions, that's why contract creation cannot be structured as an ordinary transaction. ABDK Multisig Wallet is an example of multisig wallet with contract creation ability.

-1

It is possible by calling this function with the correct parameters:

    // Outside-visible transact entry point. Executes transaction immediately if below daily spend limit.
    // If not, goes into multisig process. We provide a hash on return to allow the sender to provide
    // shortcuts for the other confirmations (allowing them to avoid replicating the _to, _value
    // and _data arguments). They still get the option of using them if they want, anyways.
    function execute(address _to, uint _value, bytes _data) external onlyowner returns (bytes32 _r)

In the _to parameter you input a new address (normally its computed deterministically from a set of parameter, but I don't know if its mandatory) for the contract and in the _data field you need to encode the ABI of your contract.

3
  • 1
    The execute() always executed EVM CALL instruction. It is not possible to create a contract with it. Commented Oct 26, 2016 at 17:06
  • @PawełBylica thanks! Could we modify the contract to call a different opcode and then it works? Commented Oct 26, 2016 at 17:11
  • No. You will at least need another function similar to execute() that will invoke CREATE on the provided bytes. You might also need to use inline assembly. Commented Oct 27, 2016 at 14:20

Your Answer

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

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