{"id":22608933,"url":"https://github.com/bitfinexcom/smidgen","last_synced_at":"2025-04-11T06:14:24.246Z","repository":{"id":25282258,"uuid":"95868889","full_name":"bitfinexcom/smidgen","owner":"bitfinexcom","description":null,"archived":false,"fork":false,"pushed_at":"2022-04-27T19:14:43.000Z","size":124,"stargazers_count":43,"open_issues_count":8,"forks_count":16,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-11T06:14:18.270Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/bitfinexcom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-30T08:47:12.000Z","updated_at":"2023-04-10T13:36:23.000Z","dependencies_parsed_at":"2022-07-27T05:02:30.108Z","dependency_job_id":null,"html_url":"https://github.com/bitfinexcom/smidgen","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fsmidgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fsmidgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fsmidgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fsmidgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitfinexcom","download_url":"https://codeload.github.com/bitfinexcom/smidgen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351393,"owners_count":21089270,"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":[],"created_at":"2024-12-08T15:10:09.242Z","updated_at":"2025-04-11T06:14:24.225Z","avatar_url":"https://github.com/bitfinexcom.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# smidgen - Tiny IOTA multisignature wallet\n\nStatus: *smidgen is in late BETA right now*\n\n  - [Installation](#installation)\n  - [Config](#config)\n  - [Multisignature Wallets](#multisignature-wallets)\n  - [Commands](#commands)\n    - generate-seed\n    - get-balance\n    - generate-address\n    - transfer\n    - reattach\n    - regenerate-addresses\n    - multisig create\n    - multisig add\n    - multisig finalize\n    - multisig transfer\n    - multisig reattach\n  - [API](#api)\n    - 'generate-seed'\n    - 'get-balance'\n    - 'generate-address'\n    - transfer\n\n## Installation\n\n```\nnpm install -g smidgen\n```\n\n## Config\n\nsmidgen will put a config file named `.smidgenrc` into your home. This way you can set arguments like `provider` on a permanent basis. Use commandline arguments to overwrite them temporaily.\n\n## Commands\n\nThe CLI supports different commands for managing your wallet.\n\nThe default provider is `http://iota.bitfinex.com:80`. You can\nchange it by passing `--provider http://example.com` as argument.\n\n**Important:** Right now smidgen is not doing the POW itself and depends on a full node as a provider for transfers. You can specify a full node with `--provider`.\n\n### generate-seed [--json]\n\nReturns a seed for the IOTA wallet. If `json` is true, it prints JSON.\n\n**Example:**\n\n```\n$ smidgen generate-seed\nUZQRLQNQAAXNSJAZTTMWGCAMQCCZBKTQMC9GKRBMVGXWCBIZAOA9LEPBKZKFSPMUEAKGRISEDNOGPZNHG\n\n$ smidgen generate-seed --json\n{ seed: 'UZQRLQNQAAXNSJAZTTMWGCAMQCCZBKTQMC9GKRBMVGXWCBIZAOA9LEPBKZKFSPMUEAKGRISEDNOGPZNHG' }\n```\n\n### get-balance [address] [--json | --watch | --threshold | --provider]\n\nGets the balance of a wallet. If `json` is true, it prints JSON.\nThe `--watch` option lets you watch a wallet for changes.\n\nIf an address is provided as argument, it will not require a seeds and\nprint the balance of the given address.\n\n**Example:**\n\n```\n$ smidgen get-balance\nEnter your seed:\nBalance: 471735365 (471.735365 Mi)\n\n$ smidgen get-balance --json\n{\"balance\":471735365}\n\n$ smidgen get-balance YHPMMBIMEGWGNKRIDNODAXABWBSRZGOQTAPOUAFODCOCOXZMVUZDRFYHMOJMMREBYYJQGKKZSEGIAFWHYYOXVPVFNY\nBalance: 55 (0.000055 Mi)\n```\n\n### generate-address [--json | --depth | --mwm | --provider]\n\nGenerates a new address and attaches to tangle.\n\nIf `json` is true, it prints JSON.\nUse `depth` to configure tip selection and `mwm` to change the minimum\nweight magnitude.\n\n\n### transfer \u0026lt;amount\u0026gt; \u0026lt;address\u0026gt; [\u0026lt;amount\u0026gt; \u0026lt;address\u0026gt;...] [--json | --depth | --mwm | --force | --provider]\n\nTransfers a given amount of *i* to an address. You can define multiple output adresses.\nWith `--force` enabled smidgen will not check if the target address was used\nbefore, which can lead to loss of IOTA for the owner of the address.\n\n**Important:** Right now smidgen is not doing the POW itself and depends on a full node as a provider for transfers. You can specify a full node with `--provider`.\n\n### reattach \u0026lt;transaction\u0026gt; [--provider]\n\nReplays a specific transaction.\n\n**Important:** Right now smidgen is not doing the POW itself and depends on a full node as a provider for transfers. You can specify a full node with `--provider`.\n\n### regenerate-addresses [--amount | --json | --depth | --mwm | --force | --provider]\n\nRegenerates addresses to recover balances after a fresh snapshot. Default amount for addresses to generate is 25.\n\n### multisig create \u0026lt;id\u0026gt; \u0026lt;file\u0026gt; [--no-validation | --force]\n\nStarts the creation of a multisignature wallet. `id` is the identifier for\nthe first party that signs the wallet.\n\n`--force` can be used to overwrite an existing setup-file.\n\nWith `--no-validation` smidgen does not check if the provided seed may have been already used via getKeyIndex. This comes handy if you have no internet connection.\n\n### multisig add \u0026lt;id\u0026gt; \u0026lt;file\u0026gt; [--no-validation]\n\nAdds another party to the setup file used for multisignature wallet generation.\n\nWith `--no-validation` smidgen does not check if the provided seed may have been already used via getKeyIndex. This comes handy if you have no internet connection.\n\n### multisig finalize \u0026lt;file\u0026gt;\n\nCreates two addresses for transferring IOTA from the multisig wallet.\nOne as the main address, and a second one which is used for remaining balance\nafter the transfer.\n\n### multisig transfer \u0026lt;amount\u0026gt; \u0026lt;address\u0026gt; [\u0026lt;amount\u0026gt; \u0026lt;address\u0026gt;...] \u0026lt;id\u0026gt; \u0026lt;file\u0026gt; [--provider | --balance]\n\nTransfers a given amout to one or more target addresses. Takes the id of the signing\nparty and the multisignature file, containing the account data.\n\nWith `--balance` we can override the current balance. This way smidgen will not query the tangle for the current balance.\n\n**Important:** Right now smidgen is not doing the POW itself and depends on a full node as a provider for transfers. You can specify a full node with `--provider`.\n\n### multisig reattach \u0026lt;file\u0026gt;\n\nReads a wallet file and takes the current main address and sends 0i to it, from a random seed generated on the fly, to resurrect the wallet after a snapshot.\n\n## Multisignature Wallets\n\nMultisignature wallets add an extra layer of security. With them, we can create addresses, that need multiple Seeds for a transaction. The seeds can be owned by one or multiple persons.\n\n**Important:** Seeds to create multisignature wallets should just be used for one wallet.\n\nSmidgen uses a file that is shared between Seed-owners. With the file we manage the wallet with its addresses and transfers. This makes it easier to keep track of the current state. Private keys are not part of the file. Please make sure you read and understood the [Offical IOTA Multisig FAQ](https://github.com/iotaledger/wiki/blob/master/multisigs.md).\n\n**Important:** Right now smidgen is not doing the POW itself and depends on a full node as a provider for transfers. You can specify a full node with `--provider`.\n\nsmidgen tries to make multisignature wallet creation safe. As part of it tries to find out if a seed was previously used with a single-signature wallet. This is done via `getKeyIndex`so it checks if the seed was used with another transaction before. However, when a node is offline, you have no WiFi or you don't want the additional safety net you can disable the checks with `--no-validation`.\n\n### Creating a Multisignature Wallet\n\nThe command for creating a wallet is:\n\n```\nsmidgen multisig create \u003cid\u003e \u003cfile\u003e\n```\n\n`id` is the identifier for the current party. The order of the signing parties is important for each transfer. By assigning an identifier to each party it easier to verify the right signing order. `file` is the file we will use to store our transactions and addresses.\n\nLet's say we have two parties, Bob and Alice, who want to manage a wallet.\n\nBob starts the process and creates the Multisignature Wallet:\n\n```\nsmidgen multisig create bob multisig.txt\n```\n\nSmidgen asks for the Seed Bob wants to use and creates the file with the digest. Tip: `smidgen generate-seed` creates a secure Seed.\n\n```\nEnter your seed:\ninfo Successfully wrote to multisig.txt\ninfo Used key index 0 (main) and 1 (remainder)\ninfo\ninfo Add another party with:\ninfo smidgen multisig add \u003cname\u003e multisig.txt\ninfo You can finalize the wallet with:\ninfo smidgen multisig finalize multisig.txt\n```\n\nBob now shares the `multisig.txt` file with Alice to continue with the process.\n\nWhen Alice receives the file, she has to use the `smidgen multisig add` command to add herself as the next party. Adding parties is possible until we finalize the wallet.\n\n```\nsmidgen multisig add alice multisig.txt\n```\n\n```\nEnter your seed:\ninfo Successfully wrote to multisig.txt\ninfo Used key index 0 (main) and 1 (remainder)\ninfo Finish address creation with:\ninfo `smidgen multisig finalize`\n```\n\nAs there are no remaining parties, Alice finalizes the wallet:\n\n```\nsmidgen multisig finalize multisig.txt\n```\n\nsmidgen returns the current main address:\n\n\n```\ninfo Successfully wrote to multisig.txt\ninfo Main address: LDSWPKCQ9HNPIVHDRUBUWB9ZZPEDFZLYXJNZKIXBFQTWZFVJZJTTOJQWYOR9XVR9NZOQXNQGWQPCCSSWZQPLPDAOIZ\n```\n\nThat's it. Alice can now share the finalized wallet file with Bob. Transfers from the generated address are just possible if both Alice and Bob sign the transfer.\n\n### Using a multisignature Wallet\n\nLet's take some IOTA from another wallet and transfer them to the new Multisignature wallet:\n\n```\nsmidgen transfer 3 --provider=http://fullnode.example.com LDSWPKCQ9HNPIVHDRUBUWB9ZZPEDFZLYXJNZKIXBFQTWZFVJZJTTOJQWYOR9XVR9NZOQXNQGWQPCCSSWZQPLPDAOIZ\n```\n\nsmidgen returns:\n\n```\nEnter your seed:\ninfo Successfully sent 3i to LDSWPKCQ9HNPIVHDRUBUWB9ZZPEDFZLYXJNZKIXBFQTWZFVJZJTTOJQWYOR9XVR9NZOQXNQGWQPCCSSWZQPLPDAOIZ\ninfo Transaction sent, hash: HMBROOZJBZYCFZTRVCDINXBLCAUX9ZREKIDWGLFAFYSFFBVBHDZTBBOCRKPNLEBZIURQXGJNXSU999999\ninfo Reattach with `smidgen reattach HMBROOZJBZYCFZTRVCDINXBLCAUX9ZREKIDWGLFAFYSFFBVBHDZTBBOCRKPNLEBZIURQXGJNXSU999999`\n```\n\nAwesome! In case our transaction is stuck, we can try to reattach with:\n\n```\nsmidgen reattach HMBROOZJBZYCFZTRVCDINXBLCAUX9ZREKIDWGLFAFYSFFBVBHDZTBBOCRKPNLEBZIURQXGJNXSU999999\n```\n\nWe can now monitor the balance of our multisignature wallet:\n\n```\nsmidgen get-balance --watch LDSWPKCQ9HNPIVHDRUBUWB9ZZPEDFZLYXJNZKIXBFQTWZFVJZJTTOJQWYOR9XVR9NZOQXNQGWQPCCSSWZQPLPDAOIZ\n```\n\nsmidgen will print the current balance every 15 seconds:\n\n```\nBalance: 0 i (0 Mi) - 3s since last update\n```\n\nTime for a tea until the funds arrive at our multisignature wallet...\n\n\nThe IOTA arrived!\n\n```\nBalance: 3 (0.000003 Mi) - 3s since last update\n```\n\nLet's continue and do our first transfer.\n\nTo kick off a transfer. Both Bob and Alice have to sign with their Seeds. As Bob signed as the first party, he also has to sign first this time.\n\nA transfer is created from the wallet file that is shared between the parties. Each transfer is appended to the file. This way we keep track of the key indexes and other details, like the current address.\n\nThe signature of the command is:\n\n```\nsmidgen multisig transfer \u003cvalue\u003e \u003caddress\u003e \u003cid\u003e \u003cfile\u003e\n```\n\nWhen we try to sign in a wrong order, smidgen will notify us:\n\n```\nsmidgen multisig transfer 3 VSBHQVNJNWR... alice multisig.txt --provider=http://fullnode.example.com\n\nERR! Wrong party signing. Current party: bob\nERR! Signing order: bob, alice\n```\n\nSo Bob has to sign first:\n\n```\nsmidgen multisig transfer 3 VSBHQVNJNWR... bob multisig.txt --provider=http://fullnode.example.com\n```\n\nsmidgen returns:\n\n```\ninfo Successfully signed transfer\ninfo Share multisig.txt with 'alice' to continue\n```\n\nGreat! Now it is Alice's turn to sign the transfer after Bob sent her the updated wallet file. smidgen will detect that the last party has signed and send the transaction. For the transfer we have to do a POW, so we need to specify a full node as provider:\n\n```\nsmidgen multisig transfer 3 VSBHQVNJNWR... alice multisig.txt --provider=http://fullnode.example.com\n```\n\nsmidgen verifies the bundle and sends the transfer:\n\n```\nEnter your seed:\ninfo Verifying bundle... Bundle: OK\ninfo Sending transaction...\ninfo Transaction sent, hash: OHHJOCLRMKQ9EMINOZXITIKWFZIQBEWPOQWCIOMWOFNOILVDYLERFLJOFANUSECBXFEXOJ...\ninfo Reattach with `smidgen reattach OHHJOCLRMKQ9EMINOZXITIKWFZIQBEWPOQWCIOMWOFNOILVDYLERFLJOFANUSECBXF`\ninfo Saved status to multisig.txt\ninfo New main address: DIYWAXPNINNJXWDPGGXAQTYTPREQYDONTZXGZMQTAGDCUOAEJXJXOIUFAVDUORHERZCXCCUMQGRAP...\n```\n\nGreat! That's it! smidgen created a new address for us.\n\nIn case we want to accept new IOTA, we have to use the new address that was just generated.\n\n## API\n\nsmidgen exposes each command as callback-based API function.\nThere is no printing and other CLI related parts in the functions and they\ncan be used to compose other programs.\n\n### smidgen['generate-seed'](iotaLib, conf, cb)\n\n  - `conf` \u0026lt;Object\u0026gt;\n    - `json` \u0026lt;Boolean\u0026gt; return json\n\n\n**Example:**\n\n```js\nconst smidgen = require('smidgen')\n\nconst conf = { json: false }\nsmidgen.load(conf, (err, smidgen) =\u003e {\n  smidgen.commands['generate-seed'](smidgen.iota, conf, (err, res) =\u003e {\n    console.log(res)\n  })\n})\n```\n\n### smidgen['get-balance'].getBalanceForSeed(iotaLib, conf, seed, cb)\n\n  - `conf` \u0026lt;Object\u0026gt;\n    - `json` \u0026lt;Boolean\u0026gt; return json\n\n**Example:**\n\n```js\nconst smidgen = require('smidgen')\n\nconst conf = { json: false }\nconst seed = 'UZQRLQNQAAXNSJAZTTMWGCAMQCCZBKTQMC9GKRBMVGXWCBIZAOA9LEPBKZKFSPMUEAKGRISEDNOGPZNHG'\n\nsmidgen.load(conf, (err, smidgen) =\u003e {\n  smidgen.commands['get-balance'].getBalanceForSeed(smidgen.iota, conf, seed, (err, res) =\u003e {\n    console.log(res)\n  })\n})\n```\n\n### smidgen['get-balance'].getBalanceForAddress(iotaLib, conf, address, cb)\n\n  - `conf` \u0026lt;Object\u0026gt;\n    - `json` \u0026lt;Boolean\u0026gt; return json\n    - `threshold` \u0026lt;Number\u0026gt;\n\n**Example:**\n\n```js\nconst smidgen = require('smidgen')\n\nconst conf = { json: false, threshold: 49 }\nconst address = 'YHPMMBIMEGWGNKRIDNODAXABWBSRZGOQTAPOUAFODCOCOXZMVUZDRFYHMOJMMREBYYJQGKKZSEGIAFWHYYOXVPVFNY'\n\nsmidgen.load(conf, (err, smidgen) =\u003e {\n  smidgen.commands['get-balance'].getBalanceForAddress(smidgen.iota, conf, address, (err, res) =\u003e {\n    console.log(res)\n  })\n})\n```\n\n### smidgen['generate-address'](iotaLib, conf, cb)\n\n  - `conf` \u0026lt;Object\u0026gt;\n    - `json` \u0026lt;Boolean\u0026gt; return json\n    - `depth` \u0026lt;Number\u0026gt; set depth for tip selection\n    - `mwm` \u0026lt;Number\u0026gt; set minimum weight magnitude\n\n```js\nconst smidgen = require('smidgen')\n\nconst conf = { json: false, depth: 4, mwm: 18 }\nsmidgen.load(conf, (err, smidgen) =\u003e {\n  smidgen.commands['generate-address'](smidgen.iota, conf, (err, address) =\u003e {\n    console.log(res)\n  })\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fsmidgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitfinexcom%2Fsmidgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fsmidgen/lists"}