- Docs
- Developers
- Archway multisig hub
Introduction
Welcome to our step-by-step guide on deploying a MultiSig solution on the Archway blockchain. If you prefer a visual tutorial, there's a video walkthrough of this guide below. A basic installation guide is also available within the Archway MultiSig Hub repo.
Prerequisites
- Mac or Linux
- Node version
16
or above installed. Avoid using Node version20.6
due to known issues. - NPM version
8
or above
Step 1: Installing dependencies
Before diving in, ensure that you have all necessary dependencies installed. You will need to install both the jq and Archway CLI packages.
jq
The jq package is required by the script used to Instantiate the multisig contracts.
On Linux:
sudo apt install jq
On MacOS (with Homebrew):
brew install jq
Archway cli
The Archway CLI package is required for executing transactions on the Archway blockchain.
npm install -g @archwayhq/cli
Step 2: Configure archway cli
Let's configure a default chain-id for the Archway CLI environment.
Confirm which network to deploy to: Mainnet (archway-1) or Testnet (constantine-3).
Adjust the chain-id config:
For Testnet:
archway config chain-id constantine-3 --global
For Mainnet:
archway config chain-id archway-1 --global
Verify the configured chain-id:
archway config show
Step 3: Preparing accounts
With our environment configured, it's time to add at least one account to the Archway CLI keystore which is required for executing transactions on chain. You could also set up additional accounts at this stage if desired as you will need at least two accounts in order to instantiate the multisig contracts.
Execute the following command to create a new account:
archway accounts new
Write down the mnemonic phrase displayed and store it in a safe place. You will need to import this mnemonic phrase into Keplr for example, to interact with the Multisig UI later on.
To use an existing account:
archway accounts new [account-name] --recover
Check your accounts:
archway accounts list
After creating the account you will need to fund the account with ARCH tokens to execute transactions on Mainnet and if you're using the Testnet you will need to get CONST testnet tokens. You can get CONST testnet tokens from the Archway Discord’s #testnet-faucet channel.
Step 4: Clone multiSig repository
With the dependencies set, and at least one account set up within Archway CLI, let’s clone the multisig repository.
git clone [email protected]:archway-network/archway-msig.gitcd archway-msignpm install
Change into the newly created directory and execute the following command to install the packages required by the multisig:
npm install
Step 5: Configuring multiSig script
Now we need to configure the multisig script that will be used to create the contracts on-chain. Edit the following file: scripts/instantiate/multisig_params.json.
This file holds the initial parameters for the new multisig.
Some parameters like max_voting_period_in_seconds and members can always be amended by the multisig owners but the other fields are immutable after deployment.
- The sender_account is the account that will sign the transaction. It must be an existing funded account in the Archway CLI keystore. This would be one of the accounts created previously.
- The name is the name of this multisig. It can help to give the multisig application an appropriate label if you plan to deploy multiple multisigs within this project.
- The description is a short text description of the multi-sig for reference.
- Image-url is a URL to an image to be displayed in the UI.
- The max_voting_period_in_seconds is the voting period for multi-sig proposals, expressed in seconds.
- Members is the members of the multisig which includes their addresses and voting power. Any number of addresses can be added here, but there must be at least 2 to begin with.
Step 6: Deploy the multiSig contracts
In the console, enter the following command from the root of your project to deploy the multisig contracts:
bash scripts/instantiate/instantiate_contracts.sh
If successful, the transaction hash, and the resulting contract addresses will be displayed. Also a new file named multisig_contracts_result.json will be created in the scripts/instantiate directory, containing the resulting contract addresses. These contract addresses will need to be copied into the project's .env file which we will create next.
Step 7: Set up multiSig environment
Now let’s set up your MultiSig environment. You will need to create a .env file from the .env.example file and then add the DAODAO_CONTRACTS values from the results file created previously.
Copy the contract addresses from multisig_contracts_result.json into the DAODAO_CONTRACTS section of the .env file and edit the other fields as needed:
- RUNTIME_ENVIRONMENT: Set as
mainnet
ortestnet
. - APP_NAME: Your project's name.
- APP_LOGO: Logo image path.
- APP_BRAND: Optional textual logo image path.
- DAODAO_CONTRACTS: A JSON array of multisig contracts (to be updated after deployment).
Step 8: Launching the development server
To view and interact with the frontend UI, start the development server:
npm run dev
This will set up a local testing server and you will be able to browse the multisig UI by visiting one of the addresses shown. Head over to http://localhost:3000 to see your MultiSig in action!
Step 9: Preparing for production
Build the application:
npm run build
Preview the build locally:
npm run preview
Step 7: Deploying to hosting platforms
Firebase
If you have not done it already, install the firebase functions globally, and login to your account
npm install -g firebase-tools@latestfirebase loginfirebase init hosting
Modify the .firebaserc
file to have your firebase project id as the default
{ "projects": { "default": "<your-firebase-project-id>" }}
Then modify the firebase.json
file to contain the following:
{ "functions": { "source": ".output/server" }, "hosting": { "site": "<your-firebase-project-id>", "public": ".output/public", "cleanUrls": true, "rewrites": [{ "source": "**", "function": "server" }] }}
Also install the firebase packages as local dependencies to be used during the build process:
npm install -D firebase-admin firebase-functions
And then you can build and deploy with the following commands:
NITRO_PRESET=firebase npm run buildnpx firebase-tools deploy
Vercel
Import your Github project into Vercel, and it will automatically enable the correct settings for your deployment.
Other Platforms
Check out the deployment documentation for more information.