{"id":23513132,"url":"https://github.com/radmen/eth-split","last_synced_at":"2025-07-15T04:04:23.093Z","repository":{"id":142219539,"uuid":"87120881","full_name":"radmen/eth-split","owner":"radmen","description":"Split received eth equally","archived":false,"fork":false,"pushed_at":"2020-01-29T08:59:03.000Z","size":15,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-28T00:40:44.041Z","etag":null,"topics":["ethereum","solidity","testrpc","truffle"],"latest_commit_sha":null,"homepage":"","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/radmen.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-04-03T21:06:05.000Z","updated_at":"2020-01-29T08:59:05.000Z","dependencies_parsed_at":"2023-05-06T12:31:25.401Z","dependency_job_id":null,"html_url":"https://github.com/radmen/eth-split","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/radmen/eth-split","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radmen%2Feth-split","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radmen%2Feth-split/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radmen%2Feth-split/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radmen%2Feth-split/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/radmen","download_url":"https://codeload.github.com/radmen/eth-split/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radmen%2Feth-split/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263558266,"owners_count":23480134,"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":["ethereum","solidity","testrpc","truffle"],"created_at":"2024-12-25T13:27:00.806Z","updated_at":"2025-07-15T04:04:23.070Z","avatar_url":"https://github.com/radmen.png","language":"JavaScript","readme":"# eth-split\r\n\r\nSemi-automatic contract which splits received ether equally to declared shareholders.\r\n\r\n# foreword\r\n\r\nI was asked to create a contract which would automatically split received ether from mining pools to declared shareholders.\r\n\r\nMining pools tend do set low gas limit for transactions so it turned out that this contract should only receive transfer. Payout to shareholders has to be triggered manually (using `payout()` method).\r\n\r\n# development\r\n\r\n## required software:\r\n\r\n* [truffle](https://github.com/trufflesuite/truffle) \r\n* [TestRPC](https://github.com/ethereumjs/testrpc)\r\n* *(optional)* [Docker](https://github.com/docker/docker) (with `docker-compose`) - for convenience, I'm using dedicated images\r\n\r\n## installing dependencies\r\n\r\n```\r\ndocker-compose run --rm truffle install\r\n```\r\n\r\n## running tests\r\n\r\n```\r\ndocker-compose up -d testrpc\r\ndocker-compose run --rm truffle test\r\n```\r\n\r\nAfter longer development (and test runs) it may turn out that `coinbase` set in TestRPC may run out of ether which will fail tests. If this happens TestRPC server has to be restarted.\r\n\r\n```\r\ndocker-compose restart testrpc\r\n```\r\n\r\n## building README file\r\n\r\nWhen contract is changed `README` file should be updated.  \r\nI've created a simple PHP build tool which will use README template and pass to it information about compiled contract.\r\n\r\nTo use it, simply, run `make docs`. This command requires `docker` and `docker-compose` to be installed.\r\n\r\nIf you don't want to use `docker` you can compile README with this commands:\r\n\r\n```\r\nsolc --combined-json \"abi,bin\" zeppelin/SafeMath.sol=/usr/src/app/installed_contracts/zeppelin/contracts/SafeMath.sol --optimize contracts/EthSplit.sol \u003e build/solc.json\r\n\r\nphp docs/build.php \u003e README.md\r\n```\r\n\r\nNote: you will need to install `solc` compiler and `PHP` (\u003e= 7.0).\r\n\r\n# contract\r\n## interface\r\n\r\n### pretty version:\r\n\r\n```json\r\n[\r\n    {\r\n        \"constant\": false,\r\n        \"inputs\": [],\r\n        \"name\": \"payout\",\r\n        \"outputs\": [\r\n            {\r\n                \"name\": \"result\",\r\n                \"type\": \"bool\"\r\n            }\r\n        ],\r\n        \"payable\": false,\r\n        \"type\": \"function\"\r\n    },\r\n    {\r\n        \"inputs\": [\r\n            {\r\n                \"name\": \"shareholdersList\",\r\n                \"type\": \"address[]\"\r\n            },\r\n            {\r\n                \"name\": \"donateTo\",\r\n                \"type\": \"address\"\r\n            }\r\n        ],\r\n        \"payable\": false,\r\n        \"type\": \"constructor\"\r\n    },\r\n    {\r\n        \"payable\": true,\r\n        \"type\": \"fallback\"\r\n    }\r\n]\r\n```\r\n\r\n### minified:\r\n\r\n```json\r\n[{\"constant\":false,\"inputs\":[],\"name\":\"payout\",\"outputs\":[{\"name\":\"result\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"inputs\":[{\"name\":\"shareholdersList\",\"type\":\"address[]\"},{\"name\":\"donateTo\",\"type\":\"address\"}],\"payable\":false,\"type\":\"constructor\"},{\"payable\":true,\"type\":\"fallback\"}]\r\n```\r\n\r\n## compiled data\r\n\r\nContract was compiled by stable version of `solc` compiler. It was optimized using default values.\r\n\r\n```\r\n6060604052341561000c57fe5b6040516102e13803806102e183398101604052805160208201519101905b815161003d906000906020850190610061565b5060018054600160a060020a031916600160a060020a0383161790555b50506100f2565b8280548282559060005260206000209081019282156100b6579160200282015b828111156100b65782518254600160a060020a031916600160a060020a03909116178255602090920191600190910190610081565b5b506100c39291506100c7565b5090565b6100ef91905b808211156100c3578054600160a060020a03191681556001016100cd565b5090565b90565b6101e0806101016000396000f300606060405236156100255763ffffffff60e060020a60003504166363bd1d4a811461002e575b61002c5b5b565b005b341561003657fe5b61003e610052565b604080519115158252519081900360200190f35b6000600160a060020a033016318180808315156100725760009450610159565b61008830600160a060020a0316316103e8610160565b600154909350600160a060020a0316158015906100ca5750600154604051600160a060020a039091169084156108fc029085906000818181858888f193505050505b156100d55782840393505b6000546100e3908590610160565b9150600090505b60005481101561015457600080548290811061010257fe5b906000526020600020900160005b90546040516101009290920a9004600160a060020a0316906108fc8415029084906000818181858888f19350505050151561014b5760006000fd5b5b6001016100ea565b600194505b5050505090565b60006000610170600084116101a3565b828481151561017b57fe5b049050610198838581151561018c57fe5b068285020185146101a3565b8091505b5092915050565b8015156101b05760006000fd5b5b505600a165627a7a723058204a6bb82f31f0037b61714b9cc89d6209d7aaf19401b9ae01bfb7a4152a586ac40029\r\n```\r\n\r\n## deployment\r\n\r\n### web3\r\n\r\n```js\r\nconst shareholdersList = [\r\n    // array of ETH wallet address\r\n    // eg. 0x0 :)\r\n];\r\nconst donateTo = '0x0'; // don't donate\r\nconst contract = web3.eth.contract([{\"constant\":false,\"inputs\":[],\"name\":\"payout\",\"outputs\":[{\"name\":\"result\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"inputs\":[{\"name\":\"shareholdersList\",\"type\":\"address[]\"},{\"name\":\"donateTo\",\"type\":\"address\"}],\"payable\":false,\"type\":\"constructor\"},{\"payable\":true,\"type\":\"fallback\"}]);\r\n\r\ncontract.new(shareholdersList, donateTo, {\r\n    from: web3.eth.accounts[0],\r\n    gas: '4700000',\r\n    data: '0x6060604052341561000c57fe5b6040516102e13803806102e183398101604052805160208201519101905b815161003d906000906020850190610061565b5060018054600160a060020a031916600160a060020a0383161790555b50506100f2565b8280548282559060005260206000209081019282156100b6579160200282015b828111156100b65782518254600160a060020a031916600160a060020a03909116178255602090920191600190910190610081565b5b506100c39291506100c7565b5090565b6100ef91905b808211156100c3578054600160a060020a03191681556001016100cd565b5090565b90565b6101e0806101016000396000f300606060405236156100255763ffffffff60e060020a60003504166363bd1d4a811461002e575b61002c5b5b565b005b341561003657fe5b61003e610052565b604080519115158252519081900360200190f35b6000600160a060020a033016318180808315156100725760009450610159565b61008830600160a060020a0316316103e8610160565b600154909350600160a060020a0316158015906100ca5750600154604051600160a060020a039091169084156108fc029085906000818181858888f193505050505b156100d55782840393505b6000546100e3908590610160565b9150600090505b60005481101561015457600080548290811061010257fe5b906000526020600020900160005b90546040516101009290920a9004600160a060020a0316906108fc8415029084906000818181858888f19350505050151561014b5760006000fd5b5b6001016100ea565b600194505b5050505090565b60006000610170600084116101a3565b828481151561017b57fe5b049050610198838581151561018c57fe5b068285020185146101a3565b8091505b5092915050565b8015156101b05760006000fd5b5b505600a165627a7a723058204a6bb82f31f0037b61714b9cc89d6209d7aaf19401b9ae01bfb7a4152a586ac40029'\r\n}, (e, contract) =\u003e {\r\n    console.log(e, contract);\r\n    if (contract \u0026\u0026 typeof contract.address !== 'undefined') {\r\n         console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);\r\n    }\r\n});\r\n```\r\n\r\n# usage\r\n\r\nDeployed contract is able to do two things:\r\n\r\n1. receive ether transfers\r\n2. payout stored ether to defined shareholders (via `payout()` method)\r\n\r\n## selfdestruct\r\n\r\nCurrently contract does not support selfdestructing.\r\n\r\n## security considerations\r\n\r\nThis contract is not secured in any way. It doesn't have to. \r\n\r\n* shareholders list can't be changed\r\n* triggering `payout()` will give no benefit for someone who is not defined in shareholders list\r\n\r\n~~# donate~~\r\n\r\n~~If you're happy with my work feel free to donate me with some ether (`0x4a03ec5e48de60048d8fd5e004b443db51d9f0f5`) :)~~\r\n\r\n## automatic donation\r\n\r\n**Update**: please don't follow those instructions - I don't own the wallet anymore.\r\n\r\nIf you're **very** happy with my work you can set `donateTo` constructor argument during contract deployment.  \r\nEvery time you make a payout I'll receive 0.1% of that transfer.~~\r\n\r\n```js\r\nconst shareholdersList = [\r\n    // array of ETH wallet address\r\n    // eg. 0x0 :)\r\n];\r\nconst donateTo = '0x4a03ec5e48de60048d8fd5e004b443db51d9f0f5';\r\nconst contract = web3.eth.contract([{\"constant\":false,\"inputs\":[],\"name\":\"payout\",\"outputs\":[{\"name\":\"result\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"inputs\":[{\"name\":\"shareholdersList\",\"type\":\"address[]\"},{\"name\":\"donateTo\",\"type\":\"address\"}],\"payable\":false,\"type\":\"constructor\"},{\"payable\":true,\"type\":\"fallback\"}]);\r\n\r\ncontract.new(shareholdersList, donateTo, {\r\n    from: web3.eth.accounts[0],\r\n    gas: '4700000',\r\n    data: '0x6060604052341561000c57fe5b6040516102e13803806102e183398101604052805160208201519101905b815161003d906000906020850190610061565b5060018054600160a060020a031916600160a060020a0383161790555b50506100f2565b8280548282559060005260206000209081019282156100b6579160200282015b828111156100b65782518254600160a060020a031916600160a060020a03909116178255602090920191600190910190610081565b5b506100c39291506100c7565b5090565b6100ef91905b808211156100c3578054600160a060020a03191681556001016100cd565b5090565b90565b6101e0806101016000396000f300606060405236156100255763ffffffff60e060020a60003504166363bd1d4a811461002e575b61002c5b5b565b005b341561003657fe5b61003e610052565b604080519115158252519081900360200190f35b6000600160a060020a033016318180808315156100725760009450610159565b61008830600160a060020a0316316103e8610160565b600154909350600160a060020a0316158015906100ca5750600154604051600160a060020a039091169084156108fc029085906000818181858888f193505050505b156100d55782840393505b6000546100e3908590610160565b9150600090505b60005481101561015457600080548290811061010257fe5b906000526020600020900160005b90546040516101009290920a9004600160a060020a0316906108fc8415029084906000818181858888f19350505050151561014b5760006000fd5b5b6001016100ea565b600194505b5050505090565b60006000610170600084116101a3565b828481151561017b57fe5b049050610198838581151561018c57fe5b068285020185146101a3565b8091505b5092915050565b8015156101b05760006000fd5b5b505600a165627a7a723058204a6bb82f31f0037b61714b9cc89d6209d7aaf19401b9ae01bfb7a4152a586ac40029'\r\n}, (e, contract) =\u003e {\r\n    console.log(e, contract);\r\n    if (contract \u0026\u0026 typeof contract.address !== 'undefined') {\r\n         console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);\r\n    }\r\n});\r\n```\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradmen%2Feth-split","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fradmen%2Feth-split","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradmen%2Feth-split/lists"}