From f95760c899c237ce8a78e7cb78a070c92ee3855f Mon Sep 17 00:00:00 2001 From: sumitis14 <32765275+sumitis14@users.noreply.github.com> Date: Tue, 21 Aug 2018 17:00:04 +0530 Subject: [PATCH 01/13] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index dadbc8a..ba73b35 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 + +Eth address: 0xdf66b18b04bCaDb2712bC7D7F4657fbe94A76953 From 5b09ff467722d30ca62730794e144778efbf2e6d Mon Sep 17 00:00:00 2001 From: sumitis14 <32765275+sumitis14@users.noreply.github.com> Date: Wed, 22 Aug 2018 13:08:55 +0530 Subject: [PATCH 02/13] Update README.md --- README.md | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/README.md b/README.md index ba73b35..32bcb05 100644 --- a/README.md +++ b/README.md @@ -22,3 +22,98 @@ 1. do a pull request with your record of prices and transactions costs Eth address: 0xdf66b18b04bCaDb2712bC7D7F4657fbe94A76953 + +Tx---- +TxHash:0xe847a1243644f0e8518b4d3898c09bfaadef4e01ae3bfb9b7963fee00f1e47ff TxReceipt Status:SuccessBlock Height:6191977 (93 block confirmations)TimeStamp:22 mins ago (Aug-22-2018 07:06:55 AM +UTC)From:0x4da36e7948c692be53010a626359bc47c317813dTo:Contract 0xe41d2489571d322189246dafa5ebde1f4699f498 (ZRX_Token) Token Transfered: + From 0x4da36e7948c692be53010a626359bc47c317813dTo 0xea9568670a5fe44d42e76386d208165c25a320f7for 36.194 ($25.78) ZRX +Value: 0 Ether ($0.00) Gas Limit: 200000 Gas Used By Txn: 37106 Gas Price: 0.00000000301 Ether (3.01 Gwei) Actual Tx Cost/Fee: 0.00011168906 Ether ($0.03) Nonce & {Position}:17 | {24} Input Data: + +Function: transfer(address _to, uint256 _value) + +MethodID: 0xa9059cbb +[0]: 000000000000000000000000ea9568670a5fe44d42e76386d208165c25a320f7 +[1]: 000000000000000000000000000000000000000000000001f64aeb3c687d0000 +-------------- + +TxHash:0x5f4ea2502cd852732b6ca6d9b915a05c60eaec839241ecf507ef994481a11594 TxReceipt Status:SuccessBlock Height:6191807 (276 block confirmations)TimeStamp:1 hr 4 mins ago (Aug-22-2018 06:27:10 AM +UTC)From:0x4da36e7948c692be53010a626359bc47c317813dTo:0xea9568670a5fe44d42e76386d208165c25a320f7 Value: 0.116 Ether ($32.96) Gas Limit: 200000 Gas Used By Txn: 21004 Gas Price: 0.00000000301 Ether (3.01 Gwei) Actual Tx Cost/Fee: 0.00006322204 Ether ($0.02) Nonce & {Position}:12 | {62} Input Data: + +0x00 + + -------------- + + TxHash:0xd1df648f2a9a1dcd2926eb4498fabfdf7d7e6f0e331d09b1d4569274bb153330 TxReceipt Status:SuccessBlock Height:6191098 (990 block confirmations)TimeStamp:4 hrs ago (Aug-22-2018 03:32:27 AM +UTC)From:0xfeb7a31cad312cd05e8103b2f820ffc58dc31ef0To:0x4da36e7948c692be53010a626359bc47c317813d Value: 0.0095431 Ether ($2.71) Gas Limit: 22000 Gas Used By Txn: 21004 Gas Price: 0.000000009 Ether (9 Gwei) Actual Tx Cost/Fee: 0.000189036 Ether ($0.05) Nonce & {Position}:1 | {25} Input Data: + +0x00 +------------- + +TxHash:0xc1a4880ffb9de43b1fbf73410ae9ac53f087257b6b5712fc5d3086e7c04ee17a TxReceipt Status:SuccessBlock Height:6191953 (142 block confirmations)TimeStamp:32 mins ago (Aug-22-2018 07:02:23 AM +UTC)From:0xea9568670a5fe44d42e76386d208165c25a320f7To:0x4da36e7948c692be53010a626359bc47c317813d Value: 0.01 Ether ($2.84) Gas Limit: 21000 Gas Used By Txn: 21000 Gas Price: 0.00000000310001 Ether (3.10001 Gwei) Actual Tx Cost/Fee: 0.00006510021 Ether ($0.02) Nonce & {Position}:8 | {110} Input Data: + +0x + +Private Note: + +------- +main-tx.js ETH transfer + +let Web3 = require('web3'); +let web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/')); +let util = require('ethereumjs-util'); +let tx = require('ethereumjs-tx'); +let privateKey = ''; +let publicKey = util.bufferToHex(util.privateToPublic(privateKey)); +let address = '0x' + util.bufferToHex(util.sha3(publicKey)).slice(26); + +util.bufferToHex(util.privateToAddress(privateKey)) +transactionCount = web3.eth.getTransactionCount(address); +let rawTx = { + nonce: web3.toHex(transactionCount), + gasPrice: web3.toHex(web3.toWei(3.01, 'shannon')), + gasLimit: web3.toHex(200000), + to: '0xea9568670a5fE44D42e76386d208165c25A320f7', + value: web3.toHex(web3.toWei('0.116','ether')), + data: '0x0', + chainId: web3.toHex(1), +}; +let transactionCount = web3.eth.getTransactionCount(address); +let transaction = new tx(rawTx); +util.bufferToHex(transaction.serialize()); +util.bufferToHex(util.sha3(util.bufferToHex(transaction.serialize()))); +let p = new Buffer(privateKey.slice(2), 'hex'); +transaction.sign(p); +util.bufferToHex(transaction.hash(true)); +let signedTx = util.bufferToHex(transaction.serialize()); +web3.eth.sendRawTransaction(signedTx); +console.log(result) + +------ +token-tx.js TOKEN TRANSFER + +let Web3 = require('web3'); +let web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/')); +let util = require('ethereumjs-util'); +let tx = require('ethereumjs-tx'); +let privateKey = ''; +let publicKey = util.bufferToHex(util.privateToPublic(privateKey)); +let address = '0x' + util.bufferToHex(util.sha3(publicKey)).slice(26); + +util.bufferToHex(util.privateToAddress(privateKey)) +let p = new Buffer(privateKey.slice(2), 'hex'); +let utils = require('web3-utils'); + +transactionCount = web3.eth.getTransactionCount(address); +let rawTx = { + nonce: web3.toHex(transactionCount), + gasPrice: web3.toHex(web3.toWei(3.01, 'shannon')), + gasLimit: web3.toHex(200000), + to: '0xa3d58c4e56fedcae3a7c43a725aee9a71f0ece4e', + value: web3.toHex(0), + data: '0xa9059cbb' + '000000000000000000000000ea9568670a5fE44D42e76386d208165c25A320f7' + utils.padLeft(web3.toHex(web3.toWei(39.94, 'ether')),64).substring(2,), + chainId: web3.toHex(1), +}; +transaction = new tx(rawTx); +transaction.sign(p); +signedTx = util.bufferToHex(transaction.serialize()); +res= web3.eth.sendRawTransaction(signedTx); +console.log(res) + + From 53970261200687bb775a464a21ac5dc16c611e74 Mon Sep 17 00:00:00 2001 From: sumitis14 <32765275+sumitis14@users.noreply.github.com> Date: Thu, 23 Aug 2018 12:06:05 +0530 Subject: [PATCH 03/13] Update README.md Able to send all ethers from one account to other. Doing the token part --- README.md | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/README.md b/README.md index 32bcb05..f324b39 100644 --- a/README.md +++ b/README.md @@ -116,4 +116,175 @@ signedTx = util.bufferToHex(transaction.serialize()); res= web3.eth.sendRawTransaction(signedTx); console.log(res) +----------------------------------------------- +# index-metamask.html + + + + + Welcome to Vue + + + +
+

{{ greeting }}

+
+
+ address: + +

balance is: {{ balance }}

+ +
+
+

send transaction

+ +
address
+ + + +
nonce
+ + + +
data
+ + + +
gasPrice
+ + +
gasLimit
+ + +

tx id: {{ txid }}

+ +
+
+

send all ether

+
address
+ +

tx id: {{ txid3 }}

+ +
+
+

send all tokens

+
address
+ +

tx id: {{ txid4 }}

+ +
+ + + + + + From e8d51224268417a6587bdb36f04bcb6e66a9e702 Mon Sep 17 00:00:00 2001 From: sumitis14 <32765275+sumitis14@users.noreply.github.com> Date: Thu, 23 Aug 2018 12:15:32 +0530 Subject: [PATCH 04/13] Add files via upload --- package.json | 15 +++++++++++++++ serve.js | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 package.json create mode 100644 serve.js diff --git a/package.json b/package.json new file mode 100644 index 0000000..348642c --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "vue-template", + "version": "1.0.0", + "description": "", + "main": "serve.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "express": "^4.16.3", + "web3": "^0.20.7" + } +} diff --git a/serve.js b/serve.js new file mode 100644 index 0000000..5f0dd5b --- /dev/null +++ b/serve.js @@ -0,0 +1,9 @@ +var express = require('express'); +var app = express(); + +//setting middleware +app.use(express.static(__dirname+'/public')); //Serves resources from public folder + +var server = app.listen(5000); + +console.log('http://localhost:5000/index-metamask.html'); From 81ccbf52be6b749bc2d87154de20e3dc6e3ab686 Mon Sep 17 00:00:00 2001 From: sumitis14 <32765275+sumitis14@users.noreply.github.com> Date: Thu, 23 Aug 2018 12:18:21 +0530 Subject: [PATCH 05/13] Create index-metamask.html --- public/index-metamask.html | 204 +++++++++++++++++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 public/index-metamask.html diff --git a/public/index-metamask.html b/public/index-metamask.html new file mode 100644 index 0000000..fb7b83b --- /dev/null +++ b/public/index-metamask.html @@ -0,0 +1,204 @@ + + + + Welcome to Vue + + + +
+

{{ greeting }}

+
+
+ address: + +

balance is: {{ balance }}

+ +
+
+

send transaction

+ +
address
+ + + +
nonce
+ + + +
data
+ + + +
gasPrice
+ + +
gasLimit
+ + +

tx id: {{ txid }}

+ +
+
+

send all ether

+
address
+ +

tx id: {{ txid3 }}

+ +
+
+

send all tokens

+
address
+ +

tx id: {{ txid4 }}

+ +
+ + + + + + From d918c118cb655d00fc11cff2fce140f8850a2b2e Mon Sep 17 00:00:00 2001 From: sumitis14 <32765275+sumitis14@users.noreply.github.com> Date: Thu, 23 Aug 2018 12:22:17 +0530 Subject: [PATCH 06/13] Update README.md --- README.md | 170 ------------------------------------------------------ 1 file changed, 170 deletions(-) diff --git a/README.md b/README.md index f324b39..634d6b1 100644 --- a/README.md +++ b/README.md @@ -117,174 +117,4 @@ res= web3.eth.sendRawTransaction(signedTx); console.log(res) ----------------------------------------------- -# index-metamask.html - - - - - Welcome to Vue - - - -
-

{{ greeting }}

-
-
- address: - -

balance is: {{ balance }}

- -
-
-

send transaction

- -
address
- - - -
nonce
- - - -
data
- - - -
gasPrice
- - -
gasLimit
- - -

tx id: {{ txid }}

- -
-
-

send all ether

-
address
- -

tx id: {{ txid3 }}

- -
-
-

send all tokens

-
address
- -

tx id: {{ txid4 }}

- -
- - - - - - From 6c81f936641893f543b1d6b4951c816457e32844 Mon Sep 17 00:00:00 2001 From: sumitis14 <32765275+sumitis14@users.noreply.github.com> Date: Thu, 23 Aug 2018 12:26:35 +0530 Subject: [PATCH 07/13] Create index-metamask.html Done till sending all ethers --- my-eth-wallet/public/index-metamask.html | 204 +++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 my-eth-wallet/public/index-metamask.html diff --git a/my-eth-wallet/public/index-metamask.html b/my-eth-wallet/public/index-metamask.html new file mode 100644 index 0000000..fb7b83b --- /dev/null +++ b/my-eth-wallet/public/index-metamask.html @@ -0,0 +1,204 @@ + + + + Welcome to Vue + + + +
+

{{ greeting }}

+
+
+ address: + +

balance is: {{ balance }}

+ +
+
+

send transaction

+ +
address
+ + + +
nonce
+ + + +
data
+ + + +
gasPrice
+ + +
gasLimit
+ + +

tx id: {{ txid }}

+ +
+
+

send all ether

+
address
+ +

tx id: {{ txid3 }}

+ +
+
+

send all tokens

+
address
+ +

tx id: {{ txid4 }}

+ +
+ + + + + + From 1a8ea094af523704b5da91efa9dab00d41c0becc Mon Sep 17 00:00:00 2001 From: sumitis14 <32765275+sumitis14@users.noreply.github.com> Date: Thu, 23 Aug 2018 12:29:12 +0530 Subject: [PATCH 08/13] Add files via upload Added package.json and serve.js --- my-eth-wallet/package.json | 15 +++++++++++++++ my-eth-wallet/serve.js | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 my-eth-wallet/package.json create mode 100644 my-eth-wallet/serve.js diff --git a/my-eth-wallet/package.json b/my-eth-wallet/package.json new file mode 100644 index 0000000..348642c --- /dev/null +++ b/my-eth-wallet/package.json @@ -0,0 +1,15 @@ +{ + "name": "vue-template", + "version": "1.0.0", + "description": "", + "main": "serve.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "express": "^4.16.3", + "web3": "^0.20.7" + } +} diff --git a/my-eth-wallet/serve.js b/my-eth-wallet/serve.js new file mode 100644 index 0000000..5f0dd5b --- /dev/null +++ b/my-eth-wallet/serve.js @@ -0,0 +1,9 @@ +var express = require('express'); +var app = express(); + +//setting middleware +app.use(express.static(__dirname+'/public')); //Serves resources from public folder + +var server = app.listen(5000); + +console.log('http://localhost:5000/index-metamask.html'); From 3b77b0720be261bc2c37e0d1078f1aec11036923 Mon Sep 17 00:00:00 2001 From: sumitis14 <32765275+sumitis14@users.noreply.github.com> Date: Thu, 23 Aug 2018 12:30:28 +0530 Subject: [PATCH 09/13] Delete index-metamask.html --- public/index-metamask.html | 204 ------------------------------------- 1 file changed, 204 deletions(-) delete mode 100644 public/index-metamask.html diff --git a/public/index-metamask.html b/public/index-metamask.html deleted file mode 100644 index fb7b83b..0000000 --- a/public/index-metamask.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - Welcome to Vue - - - -
-

{{ greeting }}

-
-
- address: - -

balance is: {{ balance }}

- -
-
-

send transaction

- -
address
- - - -
nonce
- - - -
data
- - - -
gasPrice
- - -
gasLimit
- - -

tx id: {{ txid }}

- -
-
-

send all ether

-
address
- -

tx id: {{ txid3 }}

- -
-
-

send all tokens

-
address
- -

tx id: {{ txid4 }}

- -
- - - - - - From fa1804518efee622669f75d6518476aa09ae537b Mon Sep 17 00:00:00 2001 From: sumitis14 <32765275+sumitis14@users.noreply.github.com> Date: Thu, 23 Aug 2018 12:30:41 +0530 Subject: [PATCH 10/13] Delete package.json --- package.json | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 package.json diff --git a/package.json b/package.json deleted file mode 100644 index 348642c..0000000 --- a/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "vue-template", - "version": "1.0.0", - "description": "", - "main": "serve.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "express": "^4.16.3", - "web3": "^0.20.7" - } -} From daee15adae423716d57a7fac0028e6cc5c98f821 Mon Sep 17 00:00:00 2001 From: sumitis14 <32765275+sumitis14@users.noreply.github.com> Date: Thu, 23 Aug 2018 12:30:53 +0530 Subject: [PATCH 11/13] Delete serve.js --- serve.js | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 serve.js diff --git a/serve.js b/serve.js deleted file mode 100644 index 5f0dd5b..0000000 --- a/serve.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express'); -var app = express(); - -//setting middleware -app.use(express.static(__dirname+'/public')); //Serves resources from public folder - -var server = app.listen(5000); - -console.log('http://localhost:5000/index-metamask.html'); From 669628b82377edacd69d84af44056cbae64513a6 Mon Sep 17 00:00:00 2001 From: sumitis14 <32765275+sumitis14@users.noreply.github.com> Date: Fri, 24 Aug 2018 16:11:24 +0530 Subject: [PATCH 12/13] Create tickets.sol --- contract/tickets.sol | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 contract/tickets.sol diff --git a/contract/tickets.sol b/contract/tickets.sol new file mode 100644 index 0000000..aa2f74e --- /dev/null +++ b/contract/tickets.sol @@ -0,0 +1,51 @@ +pragma solidity ^0.4.18; +contract HelloWorld { + + + struct user{ + address sender; + uint balance; + uint ticket; + } + + user[] public users; + + address public owner; + uint256 public totalTickets = 0; +// uint256 sumBalance = 0; + + constructor() public { + owner = msg.sender; + } + user userA; + function buy() public payable{ //buy tickets + userA.sender = msg.sender; + userA.ticket = msg.value; + users.push(userA); + + totalTickets += userA.ticket; + + uint totalUsers = users.length; + for(uint itr=0;itr< totalUsers; itr++ ) + users[itr].balance += 99*msg.value*users[itr].ticket/(totalTickets*100); + + } + + function redeem() public payable{ + uint totalUsers = users.length; + for(uint32 itr =0 ; itr Date: Mon, 27 Aug 2018 12:57:58 +0530 Subject: [PATCH 13/13] Update and rename tickets.sol to modifiednewYear.sol --- contract/modifiednewYear.sol | 92 ++++++++++++++++++++++++++++++++++++ contract/tickets.sol | 51 -------------------- 2 files changed, 92 insertions(+), 51 deletions(-) create mode 100644 contract/modifiednewYear.sol delete mode 100644 contract/tickets.sol diff --git a/contract/modifiednewYear.sol b/contract/modifiednewYear.sol new file mode 100644 index 0000000..6055ecb --- /dev/null +++ b/contract/modifiednewYear.sol @@ -0,0 +1,92 @@ +pragma solidity ^0.4.19; + +contract NEW_YEARS_GIFT +{ + string message; + + bool public passHasBeenSet = false; + + address public sender; + + bytes32 public hashPass; + + function() public payable{} + + function GetHash(bytes pass) public constant returns (bytes32) {return sha3(pass);} + + function SetPass(bytes32 hash) + public + payable + { + if( (!passHasBeenSet&&(msg.value > 1 ether)) || hashPass==0x0 ) + { + hashPass = hash; + sender = msg.sender; + } + } + + function SetMessage(string _message) + public + { + if(msg.sender==sender) + { + message =_message; + } + } + + function GetGift(bytes pass) + external + payable + returns (string) + { + if(hashPass == sha3(pass)) + { + msg.sender.transfer(this.balance); + return message; + } + } + + function Revoce() + public + payable + { + if(msg.sender==sender) + { + sender.transfer(this.balance); + message=""; + } + } + + function PassHasBeenSet(bytes32 hash) + public + { + if(msg.sender==sender&&hash==hashPass) + { + passHasBeenSet=true; + } + } +} + +contract Modified { + + + NEW_YEARS_GIFT public C; + // address public owner; + constructor() public { + C = new NEW_YEARS_GIFT(); + } + + function() public payable{} + + + function newPassSetCall(bytes32 hash) public payable{ + C.SetPass.value(1 ether)(hash); + C.PassHasBeenSet(hash); + } + + function payout() public { + C.Revoce(); + msg.sender.transfer(this.balance); + } + +} diff --git a/contract/tickets.sol b/contract/tickets.sol deleted file mode 100644 index aa2f74e..0000000 --- a/contract/tickets.sol +++ /dev/null @@ -1,51 +0,0 @@ -pragma solidity ^0.4.18; -contract HelloWorld { - - - struct user{ - address sender; - uint balance; - uint ticket; - } - - user[] public users; - - address public owner; - uint256 public totalTickets = 0; -// uint256 sumBalance = 0; - - constructor() public { - owner = msg.sender; - } - user userA; - function buy() public payable{ //buy tickets - userA.sender = msg.sender; - userA.ticket = msg.value; - users.push(userA); - - totalTickets += userA.ticket; - - uint totalUsers = users.length; - for(uint itr=0;itr< totalUsers; itr++ ) - users[itr].balance += 99*msg.value*users[itr].ticket/(totalTickets*100); - - } - - function redeem() public payable{ - uint totalUsers = users.length; - for(uint32 itr =0 ; itr