I have a smart contract for pallet exchange. There I have a function for exchange pallets between two partners. The point is, I want that you can only run the function when both partners confirm the transaction.

Is there a possibility to write a function with multisig functionality?

  • Yes, it is. The contract would simply hold the asset until both partners have confirmed. Commented Oct 5, 2018 at 17:57

3 Answers 3


User Aquila directs you to a good resource, but if you only have two partners, you can have an even simpler implementation. Check out the code below, hope it gives you an overview of how to implement that functionality in its most basic way.

pragma solidity^0.4.25;

contract SimpleMultisig {

  address one;
  address two;

  mapping(address => bool) signed;

  constructor() public {
    one = 0x14723a09acff6d2a60dcdf7aa4aff308fddc160c;
    two = 0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db;

  function Sign() public {
    require (msg.sender == one || msg.sender == two);
    require (!signed[msg.sender]);
    signed[msg.sender] = true;

  function Action() public returns (string) {
    require (signed[one] && signed[two]);
    return "Your action here";

(Ignore the indentation)

Also, you don't need to pre-set the addresses in the constructor, you can have another function do that, and allow them to be changed.

  • this seems pretty legit, is there any reason to use something other than this? Commented May 27, 2021 at 15:31

Is there a possibility to write a function with multisig functionality?

Yes. There are different options, you can take a look this one https://github.com/christianlundkvist/simple-multisig/blob/master/contracts/SimpleMultiSig.sol


You can also "outsource" the multisig wallet.

Any Ethereum address (msg.sender) can act as a multisig wallet.

  1. Use any multisig wallet like Gnosis wallet where you have 2-out-2 set up

  2. Create a function modified that checks if the pallet exchange approval function comes from this wallet e.g. by using Whitelist contract mix-in.

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.