Coder Social home page Coder Social logo

wallet-migration's Introduction

Wallet Migration

I work in ethereum exchange and mobile wallet development, if you are like me you might have multiple software wallets with various assets in them for use or testing. Perhaps you have mutliple assets spread across multiple wallets, maybe some of the wallets don't have eth to transfer the assets out, it is too time consuming to figure out the eth needs of each account, send each asset and them empty the eth. Or maybe you are just concerned that your seed phrase has been compromised and you want to drain your account quickly to a safe account.

This application allows to you take multiple wallets and consolidate them into one destination. It takes seed phrases and private keys then queries the node to find any token transaction those accounts have had to determine which accounts have balances to transfer. It determines if each account has enough eth to transfer the assets and sends eth from other accounts if necessary to cover the gas costs. Then sends all tokens from all accounts to the destination and finally empties any eth left behind.

Obviously it is not a good idea to input your private keys or seed phrases in to the computer but if you are immediately condolidating them to a safe destination then the risks are limited. Whatever the reason for using the application you should never use the seed phrases/private keys again!

Installation

install golang
clone repo
cd repo directory
go get
go build

Running

walletMigrate "{"node_url": "https://mainnet.infura.io/v3/APIKEYGOESHERE","destination_address": "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B","mnemonics": ["seed phrases go here usually twelve to twenty four words perhaps bicycle"],"private_keys": ["0xpr1vat3k3y1nh3xad3c1mal"],"gas_price_multiplier": 1.5,"simulate": true,"number_of_accounts": 1,"pending_nonce": false,"token_transfer_gas_limit": 100000}"

{
  "node_url": "https:\/\/mainnet.infura.io\/v3\/APIKEYGOESHERE",
  "destination_address": "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B",
  "mnemonics": ["seed phrases go here usually twelve to twenty four words perhaps bicycle"    
  ],
  "private_keys": ["0xpr1vat3k3y1nh3xad3c1mal"    
  ],
  "gas_price_multiplier": 1.5,
  "simulate": false,
  "number_of_accounts": 1,
  "pending_nonce": true,
  "token_transfer_gas_limit": 100000
}
  • node_url: this is a link to an ethereum node, you can sign up for a free infura account and get an api key or run your own node
  • destination_address: where you want the consolidated accounts to go to
  • mnemonics: an array of strings with 12+ word seed phrases to account
  • private_keys: single private key hex with or without 0x prefix that is used for a single account
  • gas_price_multiplier: the ethereum node suggests a gas price, this multiplier allows you to increase the gas price you pay for these asset transfer and eth transfers. To get all transactions mined quicker increase this 2, 2.5, 3 times the current safe gas price.
  • simulate: just prints accounts and asset balances and the transactions that would be submitted
  • number_of_accounts: for each seed phrases many accounts can be generated, this is the number of accounts squared that will be generated. Because not all eth wallets follow the same standard for generating account paths this increases both the change element and the address index element of the derivation path (m/44'/60'/0'/{change}/{address index}). https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#Path_levels
  • pending_nonce: if you want to preserve any pending transactions that may already be submitted for the account NOTE: if you have long pending tx on an account the migration of assets will be delayed until those previous tranasctions complete
  • token_transfer_gas_limit: override the calculated gas limits for sending assets and use this number. Use this if assets don't seem to transfer properly because the node/smart contract estimate the gas needed incorrectly.

wallet-migration's People

Contributors

nullable-eth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.