{"id":13650701,"url":"https://github.com/Trust-Machines/multisafe","last_synced_at":"2025-04-22T18:32:21.016Z","repository":{"id":37057121,"uuid":"468537838","full_name":"Trust-Machines/multisafe","owner":"Trust-Machines","description":"MultiSafe is a shared crypto wallet for managing Stacks (STX) and Bitcoin (BTC).","archived":false,"fork":false,"pushed_at":"2022-12-23T10:24:46.000Z","size":1065,"stargazers_count":23,"open_issues_count":3,"forks_count":13,"subscribers_count":6,"default_branch":"main","last_synced_at":"2023-03-12T03:53:00.402Z","etag":null,"topics":["bitcoin","blockchain","btc","stacks","stx"],"latest_commit_sha":null,"homepage":"","language":"Clarity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Trust-Machines.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":"audit/CoinFabrik.pdf","citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-10T23:04:10.000Z","updated_at":"2023-03-12T03:53:00.402Z","dependencies_parsed_at":"2023-01-30T18:16:38.674Z","dependency_job_id":null,"html_url":"https://github.com/Trust-Machines/multisafe","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trust-Machines%2Fmultisafe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trust-Machines%2Fmultisafe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trust-Machines%2Fmultisafe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trust-Machines%2Fmultisafe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Trust-Machines","download_url":"https://codeload.github.com/Trust-Machines/multisafe/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223903152,"owners_count":17222494,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","blockchain","btc","stacks","stx"],"created_at":"2024-08-02T02:00:39.616Z","updated_at":"2024-11-10T01:31:01.425Z","avatar_url":"https://github.com/Trust-Machines.png","language":"Clarity","funding_links":[],"categories":["Clarity Resources"],"sub_categories":["Contracts"],"readme":"# MultiSafe\n\nMultiSafe is a shared crypto wallet for managing Stacks (STX) and Bitcoin (BTC). \n\n## Deploy a MultiSafe \n\nhttps://app.multisafe.xyz/\n\n## Features\n\nCurrent supported features: \n- Send, transfer and hold STX\n- SIP-009 Non-fungible token and SIP-010 Fungible token support \n- Supports up to 20 owners\n\nFuture updates (coming soon): \n- User-friendly app \n- Native Bitcoin (BTC) support\n\n## Security\n\n[CoinFabrik audit report](https://github.com/Trust-Machines/multisafe/blob/main/audit/CoinFabrik.pdf)\n\n[Least Authority audit report](https://github.com/Trust-Machines/multisafe/blob/main/audit/LeastAuthority.pdf)\n\n\nPlease report any security issues you find via our bug bounty program on [Immunefi](https://immunefi.com/bounty/multisafe/).\n\n## Clarity Usage  \n\n### Requires Clarinet \n\nInstall Clarinet: https://github.com/hirosystems/clarinet\n\nMultiSafe is written in Clarity and therefore requires you to install Clarinet locally on the command line. Type the following command to check that you have Clarinet installed: \n\n```bash\n$ clarinet --version\n```\n\nPlease make sure you have Clarinet version 0.31.1 or higher installed.\n\n### Download MultiSafe  \n\n1. Clone the repo: \n\n```bash\n$ git clone https://github.com/Trust-Machines/multisafe.git \u0026\u0026 cd multisafe\n```\n\n2. Run the unit test to confirm all the tests passed and everything is working: \n\n```bash\n$ clarinet test\n```\n\n3. Open the Clarinet console in order to interact with the contract \n\n```bash\n$ clarinet console\n```\n\n## Setup the first MultiSafe owners\n\nGo to `/contracts/safe.clar`. At the bottom of that contract you'll see a list with three sample owners. These are the default Clarinet wallets that you can use for testing locally in Clarinet.\n\n```clarity\n(init (list \n    'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5 \n    'ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG \n    'ST2JHG361ZXG51QTKY2NQCVBPPRRE2KZB1HR05NNC\n) u2)\n```\n\nIf you'd like to deploy to mainnet/testnet update those wallet addresses with your own wallet addresses. \n\n## Get Safe Owners \n\n\n```clarity\n(contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.safe get-owners)\n```\n\nIn the example above `ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.safe` is your safe's contract name. \n\n`get-owners` will return `[ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5, ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG, ST2JHG361ZXG51QTKY2NQCVBPPRRE2KZB1HR05NNC]`\n\n## Get confirmation threshold\n\n```clarity\n(contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.safe get-threshold)\n```\n\nThe Clarinet console demo will return `u2`\n\nIn this example “u2” tells us that we need a minimum of 2 confirmations in order to approve a transaction \n\n## Add new owners \n\n1. Change the transaction sender to “wallet_1”\n\n```clarity\n::set_tx_sender ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5\n```\n\n2. Add a new user to the wallet. In this example, we add “wallet_9” to MultiSafe. \n\n```clarity\n(contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.safe submit 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.add-owner 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.safe 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.ft-none 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.nft-none (some 'STNHKEPYEPJ8ET55ZZ0M5A34J0R3N5FM2CMMMAZ6) none none)\n```\nST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM = deployer \n'STNHKEPYEPJ8ET55ZZ0M5A34J0R3N5FM2CMMMAZ6 = wallet_9\n\n3. If you “get-owners” you’ll see that there are still only 3 owners. In order to confirm the 4th owner you will need to switch to “wallet_2” or “wallet_3” (the other owner”) and approve the transaction.  \n\n```clarity\n(contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.safe get-owners)\n```\n\nReturns: `[ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5, ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG, ST2JHG361ZXG51QTKY2NQCVBPPRRE2KZB1HR05NNC]`\n\n4. Change owner to wallet_2\n\n```clarity\n::set_tx_sender ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG\n```\n\n5. As wallet_2 owner, now you can approve the 4th new owner \n\n```clarity\n(contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.safe confirm u0 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.add-owner 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.safe 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.ft-none 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.nft-none)\n```\n\n6. Call “get-owners” again and you will see the 4th owner has been added \n\n```clarity\n(contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.safe get-owners)\n```\n\nReturns: `[ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5, ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG, ST2JHG361ZXG51QTKY2NQCVBPPRRE2KZB1HR05NNC, STNHKEPYEPJ8ET55ZZ0M5A34J0R3N5FM2CMMMAZ6]`\n\n## Send STX to the MultiSafe \n\nIf you are the wallet_3 owner (ST2JHG361ZXG51QTKY2NQCVBPPRRE2KZB1HR05NNC) then the following command will allow you to send STX from your wallet to the MultiSafe \n\n```clarity\n(stx-transfer? u5000 'ST2JHG361ZXG51QTKY2NQCVBPPRRE2KZB1HR05NNC 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.safe)\n```\n\n`::get_assets_maps` will show you that the STX has been transfered into the .safe contract\n\n## Send STX from MultiSafe to a new wallet \n\nIn this example, using Clarinet console, we will send STX from MultiSafe to \"wallet_7\"\n\n1. Send STX to wallet_7 \n\nAssuming you are an owner — in this example, you will send 1000 uSTX from the MultisSafe to wallet_7 (ST3PF13W7Z0RRM42A8VZRVFQ75SV1K26RXEP8YGKJ). \n\n```clarity\n(contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.safe submit 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.transfer-stx 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.safe \n'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.ft-none 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.nft-none (some 'ST3PF13W7Z0RRM42A8VZRVFQ75SV1K26RXEP8YGKJ) (some u1000) none)\n```\n\n2. Change owner to wallet_2\n\n```clarity\n::set_tx_sender ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG\n```\n\n3. Wallet_2 can now confirm the transaction \n\n```clarity\n(contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.safe confirm u1 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.transfer-stx 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.safe 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.ft-none 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.nft-none)\n```\n\nMultiSafe now has -1000 uSTX, and wallet_7 +1000 uSTX \n\n## API Reference\n\n### Owner only functions\n\nThe following function can be run by only safe owners:\n\n`submit (executor \u003cexecutor-trait\u003e, safe \u003csafe-trait\u003e, param-ft \u003cft-trait\u003e, param-nft \u003cnft-trait\u003e, param-p (optional principal), param-u (optional uint), param-b (optional (buff 20))) =\u003e (response uint)`\n\n`confirm (tx-id uint, executor \u003cexecutor-trait\u003e, safe \u003csafe-trait\u003e, param-ft \u003cft-trait\u003e, param-nft \u003cnft-trait\u003e) =\u003e (response bool)`\n\n`revoke (tx-id uint) =\u003e (response bool)`\n\n### Safe only functions\n\nThe following functions can be run by only safe contract itself and requires the minimum number of confirmations:\n\n`add-owner (owner principal) =\u003e (response bool)` \n\n`remove-owner (owner principal) =\u003e (response bool)`\n\n`set-threshold (value uint) =\u003e (response bool)`\n\n### Views (Read only functions)\n\n`get-version() =\u003e string-ascii`\n\n`get-owners() =\u003e list`\n\n`get-threshold() =\u003e uint`\n\n`get-nonce() =\u003e uint`\n\n`get-info() =\u003e tuple`\n\n`get-transaction (tx-id uint) =\u003e tuple`\n\n`get-transactions (tx-ids (list 20 uint)) =\u003e list`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTrust-Machines%2Fmultisafe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTrust-Machines%2Fmultisafe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTrust-Machines%2Fmultisafe/lists"}