Giter Site home page Giter Site logo

snapshot-voting's Introduction

Snapshot 投票脚本

安装

首先在本地安装nodejs:https://nodejs.org/en/download/

在命令行执行npm install,安装所有的依赖库。

用助记词生成地址文件

找到src/mnemonic_to_key.js文件的第21行:const mnemonic = "",把助记词输入到引号之间。

const count = 100表示的是用该助记词生成的钱包数量,根据个人情况修改即可。

然后在命令行下执行:

node src/mnemonic_to_key.js (windows的斜线可能是反的)

执行后,会在当前目录下生成一个keys.json的文件。文件生成完毕后,别忘了把助记词从js文件中删掉。

如果你的钱包不是同一个助记词生成的话,可以用按照下面的格式手动拼装出来json文件:

[
  {
    "id": 1,
    "address": "xxx",
    "privateKey": "xxx"
  },
  {
    "id": 2,
  	"address": "xxx",
  	"privateKey": "xxx"
  }
]

只要取名为keys.json即可。

投票

Json文件生成完毕后,找到index.js文件,第四行代码表示的是要对哪个项目space进行投票,比如stargate的链接为 https://snapshot.org/#/stgdao.eth/

那么'stg.eth'就是它的space。

第五行表示的是投哪一个选项。

如果你想使用刚刚生成的所有钱包地址进行投票,那么填写好space地址和投票选项后,直接在命令行下面运行

node src/index.js 即可

如果你只想用其中某一个地址投票,那么把第17行注释掉,把第19行打开,把get_account(1)括号里的1改成你要投票的地址编号(也就是json文件中对应的"id"),然后再执行

node src/index.js

致谢

感谢CryptoChasers Builder群诸多群友的指点和帮助,尤其是"深海里的猫",在我遇到困难时直接扔来了一份typescript文件,项目库中的snapshot.js只是在它的基础上做了简单修改,以便多地址使用。

snapshot-voting's People

Contributors

liangfenxiaodao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.