{"id":22072581,"url":"https://github.com/broxus/ton-distribution","last_synced_at":"2026-01-24T21:15:12.469Z","repository":{"id":54729366,"uuid":"279638451","full_name":"broxus/ton-distribution","owner":"broxus","description":"Set of tools for distributing TONs across multiple receivers","archived":false,"fork":false,"pushed_at":"2022-02-09T22:45:34.000Z","size":192,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-14T16:41:36.539Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/broxus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-14T16:31:52.000Z","updated_at":"2024-04-14T16:41:36.540Z","dependencies_parsed_at":"2022-08-14T01:01:00.788Z","dependency_job_id":null,"html_url":"https://github.com/broxus/ton-distribution","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/broxus%2Fton-distribution","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/broxus%2Fton-distribution/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/broxus%2Fton-distribution/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/broxus%2Fton-distribution/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/broxus","download_url":"https://codeload.github.com/broxus/ton-distribution/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227432282,"owners_count":17775894,"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-11-30T21:13:49.266Z","updated_at":"2026-01-24T21:15:12.439Z","avatar_url":"https://github.com/broxus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Distributing TONs across multiple receivers\n\nThis repo contains smart contracts and Node JS scripts, which allows to execute massive TON distributions.\n\n## Install\n\n```\n$ node --version\nv10.21.0\n$ npm install\n```\n\n## Contract description\n\nThe contract source is available at [/contracts/airdrop.sol](./contracts/airdrop.sol). To deploy contract you need to specify the following attributes:\n\n- Refund address\n- List of amounts\n- List of receivers\n- Refund lock duration in seconds\n\n**Important**: Attributes are specified at the creation step and can't be changed later.\n\nRecommended size for addresses amount - **100 addresses**.\n\n### Refund address\n\nThis address will be used in case you need to return your TONs. The contract has the `refund()` method which refunds all contract's balance to the refund address.\n\n### Refund lock duration\n\nThis parameters describes the amount of seconds that should pass since the contract creation. Only after that refund function can be executed.\n\n## Pipeline description\n\nBellow you can find the detailed description for each action, required for distribution process.\n\n### 1. Create new key pair\n\nThis pair will be used for contract creation. The keys will be automatically written in the `keys.json` file.\n\n```\n$ node examples/generate-keys.js \n\nNew keys written in the keys.json\n{ public:\n   '266c96f4a194cbacdb1329a37ddc285f237ad32d01ff1a9532d127e62123a53e',\n  secret:\n   'a2a2de9256ed927cbc639ece41a63b857a5f93ec16a31b439cb57060f44ff14a' }\n```\n\nBe careful: running the script again will rewrite the previous keys. Do this if you need to deploy another instance of the contract.\n\n### 2. Specify the distribution details\n\nYou need to edit the `config.yaml` file or create new file with YAML configuration. Basic layout is already provided in `config.yaml`:\n\n```yaml\naddresses_and_amounts_csv: 'validators.csv'\nrefund_destination: '0:28861a9d4a9c9766e1129f7323e01ba0c98c33d5414c0036b8194282ff7abc5c'\nkeys: 'keys.json'\nrefund_lock_duration_in_seconds: 10000\ncontractAddress: ''\n```\n\nAll the scripts bellow supports the `--config` flag with the path to the configuration (`config.yaml` by default).\n\n#### 2.1 CSV format\n\nThe csv file should include 2 columns: first one is raw addresses and the second one is amount in nanograms. Also, there should be no header line:\n\n```\n0:28861a9d4a9c9766e1129f7323e01ba0c98c33d5414c0036b8194282ff7abc5c,100\n0:28861a9d4a9c9766e1129f7323e01ba0c98c33d5414c0036b8194282ff7abc5c,123\n0:28861a9d4a9c9766e1129f7323e01ba0c98c33d5414c0036b8194282ff7abc5c,1000000\n0:28861a9d4a9c9766e1129f7323e01ba0c98c33d5414c0036b8194282ff7abc5c,10000000000\n```\n\n### 3. Get the feature contract address\n\n```\n$ node examples/pre-deploy.js \nFuture address of the contract will be: 0:be3cdd3cdda63901cdcd9ced1d3e50d7f1d8207b2711cfda4e4b4899434c2a77\nUse this address for wallet: UQC-PN083aY5Ac3NnO0dPlDX8dggeycRz9pOS0iZQ0wqdyya\n```\n\n### 4. Send the TONs for contract deployment\n\nUse any wallet (for example [Broxus wallet](https://l1.broxus.com/freeton/wallet)) to send TONs. The amount of TONs depends on the amount of provided pairs (receiver, amount). For 1 pair 0.1 TON is enough.\n\n![broxus-wallet](./static/broxus-wallet.png)\n\n### 5. Deploy contract\n\nAfter the TONs were received by the contract, you can deploy the contract.\n\n```\n$ node examples/deploy.js \nContract deployed at 0:be3cdd3cdda63901cdcd9ced1d3e50d7f1d8207b2711cfda4e4b4899434c2a77\n```\n\n### 6. Verify the contract details\n\n**Important** At this step, specify the contract address at the `contractAddress` field at configuration file.\n\nYou can verify that the attributes are correct by calling the list of getter functions in contract. The script bellow just automates this process.\n\n```\n$ node examples/get-contract-details.js\nContract balance: 69361999\nTotal amount: 100\n\nSufficient balance\n\nRefund address: 0:28861a9d4a9c9766e1129f7323e01ba0c98c33d5414c0036b8194282ff7abc5c\nRefund lock ends at: Wed Jul 15 2020 23:49:13 GMT+0300 (Moscow Standard Time)\nList of receivers and amounts with distribution status:\n0 false '0:28861a9d4a9c9766e1129f7323e01ba0c98c33d5414c0036b8194282ff7abc5c' 100\n```\n\n### 7. Send the TONs to the contract\n\nAfter you make sure that everything is correct, you should send the necessary amount of TONs to the contract. This also can be done with Broxus wallet.\n\n### 8. Run the distribution\n\nThe important thing that each pair of (address, amount) will take part in distribution only once. So in any case, no address will receive the amount twice.\n\n```\n$ node examples/distribute.js\nCalled successfully\n```\n\n### 9. Run the refund\n\nIf you need to refund some TONs you can use the following script:\n\n```\n$ node examples/refund.js\nCalled successfully\n```\n\n## Testing\n\nThe contract have been tested for\n\n- Refund case\n- Distribute case\n- Double distribute case\n- Distribute and refund case\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbroxus%2Fton-distribution","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbroxus%2Fton-distribution","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbroxus%2Fton-distribution/lists"}