Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- QRL Migration Splitter
- This tool helps you protecting your privacy by suggesting how to
- migrate your ERC-20 QRL tokens into mainnet QRL before
- the end of the migration process on 28 Feb 2019.
- The idea behind this script is to hide your total holdings by
- splitting them in multiple addresses of your choice, each with
- a randomized migration date and held amount.
- After the script has run, a text based table will be printed
- on your console so that you can copy it and use it as a reminder.
- Instructions:
- 1) Generate as many QRL addresses as you desire
- you can either use the online wallet at https://wallet.theqrl.org
- or the safer command line version https://github.com/theqrl/qrl)
- 2) Fill the Configuration Section below according to your addresses
- and preferences
- 3) Run this script in a javascript console.
- ( on chrome you can open it by left-clicking anywhere on any page,
- then select 'inspect' --> 'console' tab,
- paste this script in the console, press enter and you're done:
- you should now see a table with dates, amounts and the corresponding
- address to carry out the migration. )
- Cheers from /u/sire_giarasso
- donations:
- Q010600d4bb6f045df6a95f3ad32d802798b32be9d09366f1d85c9846021c707d08dda8f5a34185
- */
- ///////////////////////////////////////////////////////////
- //
- // CONFIGURATION SECTION
- // -- edit the variables below according to your holdings.
- //
- ///////////////////////////////////////////////////////////
- // Mandatory:
- total_quanta_to_distribute = 100.00000000 // The amount of QRL you own
- destination_addresses = [
- 'Q010600d4bb6f045df6a95f3ad32d802798b32be9d09366f1d85c9846021c707d08dda8f5a34185',
- 'Q0106000dc923eb43f1dce12c5cdeefd424cd9ba7dfe00534c6b613a60518efc5866029f266a10a',
- 'Q0106002f0c933e0f88805625a5548dae65d9011c80e8b624e881d4d5534513fd9f32a494d40e2f'
- ]
- // Optional:
- minimum_balance_per_wallet = 1
- start_date = new Date('Dec 6 2018 14:44:29 GMT+0100')
- end_date = new Date('Jan 31 2019 18:00:00 GMT+0100') // Migration ends on 28 Feb 2019
- ///////////////////////////////////////////////////////////
- //
- // CODE SECTION
- // -- no need to edit stuff from here onwards.
- //
- ///////////////////////////////////////////////////////////
- period = (1000*60*60*24)
- periods = (end_date-start_date)/period
- shor_per_quanta = 10**9
- total_quanta_to_distribute *= shor_per_quanta
- distribute = function (addresses, shor_amount, min) {
- var qrl_addresses = {}
- var reserved_amount = (min * addresses.length)
- var available_amount = shor_amount - reserved_amount
- if (reserved_amount >= available_amount) {
- throw new Error('distribute(): Wrong amounts')
- }
- var distribution_table = {}
- addresses.forEach((a)=>{
- distribution_table[a] = Math.random()
- })
- total = 0
- addresses.forEach((address)=> {
- total += distribution_table[address]
- })
- addresses.forEach((address)=> {
- distribution_table[address] = distribution_table[address] / total
- })
- var remaining_amount = available_amount
- for (var i = 0; i < addresses.length; i++) {
- if (i < addresses.length - 1) {
- distributed_amount = parseInt(available_amount * distribution_table[addresses[i]])
- amount = min + distributed_amount
- remaining_amount -= distributed_amount
- } else {
- amount = min + remaining_amount
- }
- if (!qrl_addresses[addresses[i]]) {
- qrl_addresses[addresses[i]] = 0
- }
- qrl_addresses[addresses[i]] += amount / shor_per_quanta
- }
- return qrl_addresses
- }
- distribution = distribute(destination_addresses, total_quanta_to_distribute, minimum_balance_per_wallet * shor_per_quanta)
- payments = []
- for (var i in distribution) {
- date = new Date(start_date.getTime() + (period * Math.random() * periods) )
- payments.push({ address: i, quantity: distribution[i], date: date })
- }
- payments = payments.sort( (a,b)=> a.date - b.date )
- out=''
- payments.forEach(x=>{
- out += `${x.date.toDateString()}\t\t${x.quantity}\t\t${x.address}\n`
- })
- console.log(out)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement