From 8a74e158edcbbe37363ebbf62763370824fc0aa1 Mon Sep 17 00:00:00 2001 From: shahofblah Date: Tue, 21 Aug 2018 17:15:11 +0530 Subject: [PATCH 1/3] Added mobile wallet address --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index dadbc8a..f8d8c01 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,5 @@ 1. using web3 on mainnet, transfer all tokens and eth to my address `0xea9568670a5fE44D42e76386d208165c25A320f7` 1. do a pull request with your web3 code 1. do a pull request with your record of prices and transactions costs + +imToken mobile wallet address : 0xAde18D9d156b486872bfC1946D1b178a16b9b1e8 From 4cf33479c9c5e33501eb4b008fceeef595e3caf5 Mon Sep 17 00:00:00 2001 From: shahofblah Date: Tue, 21 Aug 2018 17:45:03 +0530 Subject: [PATCH 2/3] Update README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index f8d8c01..8ab28fd 100644 --- a/README.md +++ b/README.md @@ -22,3 +22,14 @@ 1. do a pull request with your record of prices and transactions costs imToken mobile wallet address : 0xAde18D9d156b486872bfC1946D1b178a16b9b1e8 + + +Sent 0.399 ether, $111.67 (@ $279.88/ETH) from imToken wallet(0xAde18D9d156b486872bfC1946D1b178a16b9b1e8) to MEW(0xBa107c6Bd396239899B10718514baE5C5E54D2F0) +Gas used : 21000 +Gas price : 0.00000000231 Ether (2.31 Gwei) +Ether cost : 0.00004851 Ether ($0.01) +Data : 0x + + + + From 7a17b48c76d6d365d79b11e385943071920a81e3 Mon Sep 17 00:00:00 2001 From: shahofblah Date: Wed, 22 Aug 2018 12:44:26 +0530 Subject: [PATCH 3/3] Added web3 code --- README.md | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8ab28fd..16e3dd9 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,44 @@ imToken mobile wallet address : 0xAde18D9d156b486872bfC1946D1b178a16b9b1e8 +web3 code: -Sent 0.399 ether, $111.67 (@ $279.88/ETH) from imToken wallet(0xAde18D9d156b486872bfC1946D1b178a16b9b1e8) to MEW(0xBa107c6Bd396239899B10718514baE5C5E54D2F0) -Gas used : 21000 -Gas price : 0.00000000231 Ether (2.31 Gwei) -Ether cost : 0.00004851 Ether ($0.01) -Data : 0x +let Web3 = require('web3'); +let web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io')); +console.log(web3.version); +let util = require('ethereumjs-util'); +let utils = require('web3-utils'); +let tx = require('ethereumjs-tx'); +let privateKey = ***; +let personalAddress = '0xdc477f985e01182ec5c284209630b4ecca5d24c7'; +let QXAddr = '0xea9568670a5fe44d42e76386d208165c25a320f7'; +let DEFAddr = '0x907B98479a589abAFC72926837B726B0D3582C3F'; +let METAddr = '0xa3d58c4E56fedCae3a7c43A725aeE9A71F0ece4e'; +let ZRXAddr = '0xE41d2489571d322189246DaFA5ebDe1F4699F498'; +let WETHAddr = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'; +let transactionCount = web3.eth.getTransactionCount(personalAddress); +let accountBalance = web3.eth.getBalance(personalAddress, 'latest'); + + +let rawTx = { + nonce: web3.toHex(transactionCount), + gasPrice: web3.toHex(web3.toWei(5, 'shannon')), + gasLimit: web3.toHex(21000), + to: QXAddr, + value: web3.toHex(accountBalance - 21000 * web3.toWei(5, 'shannon')), + data: web3.toHex(0), + chainId: web3.toHex(1), +}; +console.log(rawTx.data) +console.log(rawTx); +transaction = new tx(rawTx); +let p = new Buffer(privateKey.slice(2), 'hex'); + +transaction.sign(p); +let signedTx = util.bufferToHex(transaction.serialize()); +let a=web3.eth.sendRawTransaction(signedTx); +console.log(a)