Skip to content

Instantly share code, notes, and snippets.

@SalatielSauer SalatielSauer/
Last active Jul 1, 2019

What would you like to do?
NodeJS for mining Discord Gift keys.
//by @SalatielSauer
//Version: 21/12/2018
var request = require("request");
var counter = 0;
var letras = [
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", 'p', "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", 'P', "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"
var fs = require("fs");
fs.writeFile('genkeys.txt', "//Start \n", function(err, result) {
if(err) console.log('error', err);
var stream = fs.createWriteStream("genkeys.txt", {flags:'a'});
var delaytime = 0;
var valids = 0;
function verify(key) {
var keyl = link + key;
setTimeout(function() {
url: keyl,
json: true
}, function (error, response, body) {
var message = JSON.stringify(body);
// Connection issues
if (message == null){
console.log("Unverified:" + key);
console.log("could not verify the key, trying again... \n (maybe you're offline) \n ----------")
} else {
delaytime = 2300;
// Rate Limit
if (message.match("limited")){
console.log("Unverified:" + key);
console.log("\n too fast, waiting...");
// Invalid key
if (message.match("Unknown Gift Code")){
console.log("" + key);
// Valid key
if (message.match("application_id")){
console.log("--------VALID KEY!--------: \n" + key + "\n--------------------------");
stream.write("" + key + "\n");
var data = new Date();
var dia = data.getDate();
var mes = data.getMonth()+1;
var ano = data.getFullYear();
var horas = data.getHours();
var minutos = data.getMinutes();
var segundos = data.getSeconds();
console.log(counter + "| " + dia + "/" + mes + "/" + ano + " | " + horas + ":" + minutos + ":" + segundos + " | Valids: " + valids + "\n -------");
}, delaytime);
function genkey(){
link = "";
var finalkey = "";
for (var i = 0; i <= 15; i++) {
var rnd = letras[Math.floor(Math.random() * letras.length)];
finalkey = finalkey + rnd;
if (i == 15){
finalkey = "";

Some Important Informations

  • This kind of mining is not illegal.
  • This is far from a "hacking script".
  • Keys are valid for a few minutes after a user action, so the chances of getting a valid one are minimal.
  • A key is generated every 2.5 seconds, it can not be less than this to avoid a "block" coming from discord api.
    • Even with this delay, sometimes the block will happen ("You are being rate limited."), but it will only last a few seconds.
  • Although not illegal, if you are lucky enough to get a valid key, be aware that someone else will have this key stolen if you claim it (and this is not cool xD).
  • Everything was done for study proposals, use at your own risk!!1

How it works

  • Generates a 16-letter combination
  • Uses discord's api to check if the url is valid
  • If the api url page contains the text "Unknown" that combination is considered invalid, and the code runs again
  • If it does not contain "Unknown" it means that that combination is somehow valid, so it is saved to a text file in the same folder as the script was run (and you will see a message on the screen).

To work you will need to have the request installed (more info: And npm:

After installing npm, you can install request with the command: npm install request

To run the script is simple, just run 'node dgkminer.js' at the terminal.

Everything has been tested with Linux and Windows, using NodeJS v11.4.0 and NPM v6.4.1.


This comment has been minimized.

Copy link
Owner Author

commented Dec 21, 2018


  • Counter and Timestamp were added
  • Connection problems will no longer cause an error and stop the process.


  • Codes generated while Rate Limit will not be lost any more.
  • Now the counter will only count invalid and valid attempts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.