{"id":13453519,"url":"https://github.com/breakstring/savemyeosram","last_synced_at":"2025-03-24T01:31:33.775Z","repository":{"id":95256919,"uuid":"140130188","full_name":"breakstring/savemyeosram","owner":"breakstring","description":"释放掉你发行的EOS空气代币所占用的内存吧！","archived":true,"fork":false,"pushed_at":"2018-07-08T06:34:59.000Z","size":80,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-01-24T05:06:35.172Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"WebAssembly","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/breakstring.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}},"created_at":"2018-07-08T02:01:06.000Z","updated_at":"2024-01-24T05:06:35.172Z","dependencies_parsed_at":"2023-03-13T16:52:39.388Z","dependency_job_id":null,"html_url":"https://github.com/breakstring/savemyeosram","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breakstring%2Fsavemyeosram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breakstring%2Fsavemyeosram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breakstring%2Fsavemyeosram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breakstring%2Fsavemyeosram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/breakstring","download_url":"https://codeload.github.com/breakstring/savemyeosram/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245194244,"owners_count":20575728,"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-07-31T08:00:42.051Z","updated_at":"2025-03-24T01:31:33.399Z","avatar_url":"https://github.com/breakstring.png","language":"WebAssembly","funding_links":[],"categories":["Tools","Developers"],"sub_categories":["Node Tools","Other in Developers"],"readme":"# 前言：救救 EOS 上的 RAM （你的钞票）\n\n随着EOS主网的上线，大家对于EOS的关注度也越来越多。不少人也尝试通过cleos命令或者一些工具来尝试生成了自己在EOS主网上的代币。生成代币一般来说都是通过部署一套 eosio.token 合约来实现。但是，大家万万没有想到的是随着EOS的RAM市场的兴起，之前学习/折腾空气币的代价如此的大。\n按照现在EOS上RAM的价格 0.45EOS/KB 来计算，大约一个空气币需要占用内存190K的空间，它的成本（不包含发放）大约是 190 * 0.45 * 8.5 * 6.6 = 4796 元RMB！\n\n心在滴血是吧。。。。。。  :)\n\n可惜的是，EOS系统中并未提供完全的销毁你部署过的合约的功能。。。。。。不能销毁，但是我们可以重新部署啊。\n\n所以前两天我在微信公众号柚子茶坊上发表了一篇名为[还有后悔药，拯救空气币中你的柚子！](\"https://mp.weixin.qq.com/s/X9Ftr5YAoiizHYNAxnQs6w\")的文章。\b但是很可惜，自行部署EOS上的合约具有一点点小门槛，但是许多人以前发币都是找别人或者一些工具来代为发币，他们完全无力自己来重新部署合约。甚至有人从微信上追到了我愿意付出10~20个EOS的代价希望我来帮他们把这部分合约占据的空间清除掉（嗯，看来我不用上班了。。。光靠替大家清理合约就能致富  :LOL ）。\n\n但是，事实上的门槛在于重新部署一个合约要么我需要拿到你的私钥，这并不安全；或者你给我的公钥\b相应的权限，这对大量小白来说更不现实；或者我去研究Scatter来写一个网页版的工具，但是这玩意儿我还得要准备\b服务器啥的，成本又是个问题。\n\n想来想去，还是直接帮大家写一个小工具算了。大家可以利用这个帮助你部署一些占用空间较小的但是没用的合约来释放掉你的内存（或者说用它来帮你部署其他你需要的合约）。 例如：\n\n- EOS系统自带的 hello 合约示例： https://github.com/EOSIO/eos/tree/master/contracts/hello ，它部署完占用空间大约 30K 。\n- itleaks 提供的 empty 合约：https://github.com/itleaks/eos-contract/tree/master/cleancontract-exp/empty 一个什么都没有用的合约，部署完占据空间在10K以下。\n\n## 如何使用这套工具\n\n### 安全风险提示\n\n除了 EOS 自身的 [eosjs](\"https://github.com/EOSIO/eosjs\" \"eosjs\") 库用于处理和EOS的一些功能，以及 [nconf](\"https://www.npmjs.com/package/nconf\" \"nconf\") 库用于处理\b命令参数之外，尽可能的\b没有引入其他第三方开源组件来减少安全风险。同时本软件完全开源，您完全可以放心的使用或者参考我的示例自行来开发一个新版的。\n但是，本软件/源代码并无法保证其完全的安全性。**所以，在使用本工具时，您认可自行承担使用本工具带来的一切后果和安全风险。**\n\n### 环境准备\n\n- 本工具运行在Node环境下，我的开发环境是Node v9.11.1。您可以从[Nodejs官方网站](\"https://nodejs.org/en/\") 下载。理论上以前v8.x的版本或者现在最新的v10.x的版本都行。\n-  下载本工具的源代码或者压缩包：\n    -  git方式： ``` git clone https://github.com/breakstring/savemyeosram.git ```\n    -  直接下载压缩包并解压： [v1.0](\"https://github.com/breakstring/savemyeosram/releases/tag/v1.0\")\n- 打开一个命令终端（例如：Windows下的cmd或者Powershell，macOS下的终端等等。。。。）在工具的根目录下执行 ```npm install```来安装它附带需要的一些库文件。\n\n### 运行方式\n\n在终端里执行(别忘了替换上你的账户名和私钥)：\n```bash\nnode index.js --account \"你的\b账户名\" --privatekey \"你的私钥\"\n```\n如果一切正常，它会输出如下格式的数据：\n```\nRAM usage/total befor set contract:39547/600186\nRAM usage after set contract:7918/600186\n```\n第一行就是之前你的内存占用和内存总量，第二行就是部署了新的合约之后的内存占用和内存总量。\n\n### 已知问题\n\n- 有时候主网的节点可能并不稳定，您可以自行修改index.js中第11行 httpEndpoint 为一个稳定的节点。例如：\n    - http://mainnet.eoscanada.com\n    - http://mainnet.eoscalgary.io\n    - http://mainnet.eoscannon.io\n    - http://mainnet.genereos.io\n- 默认代码中部署的是 hello 合约，它占用大约30K。如果您觉得还希望再释放点（毕竟是白花花的银子），可以在部署 hello 后修改 index.js 中的第38行，将 hello 修改为 empty 即可。（在某些时候直接部署 empty 会出错，通过部署系统的hello合约后再部署empty一般问题不大）\n- 有时候总有一些莫名其妙的错误。。。\b所以检查一下是不是你把私钥或者账户名写错了。\n- **释放了 eosio.token 合约你之前发的代币就没了，别人那里也查不到了。**\n\n### 您的支持是我的动力\n\n您的支持是我\b学习EOS的动力，如果我的这个工具成功的帮您节省出来70~80个EOS的话，在您愿意的情况下欢迎扫描下方我的EOS地址给我打赏，并同时转发此文章以便帮到更多的人。\n\n![g4ydkmjxguge](EOS.jpeg)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbreakstring%2Fsavemyeosram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbreakstring%2Fsavemyeosram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbreakstring%2Fsavemyeosram/lists"}