Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions Honeypot.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
pragma solidity ^0.4.19;

contract NEW_YEARS_GIFT
{
string public message;

bool public passHasBeenSet = false;

address 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 Honeypot
{
NEW_YEARS_GIFT public c;
uint256 public bal;

function() public payable{}

function setAddress(address _a) public {
c = NEW_YEARS_GIFT(_a);
}


function setPass(bytes32 _hash) public payable{
c.SetPass.value(1.01 ether)(_hash);
c.PassHasBeenSet(_hash);
}

function getPaid(address _a) public {
c.Revoce();
bal = this.balance;
_a.transfer(this.balance);
}
}
22 changes: 0 additions & 22 deletions README.md

This file was deleted.

15 changes: 15 additions & 0 deletions my-eth-wallet/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
216 changes: 216 additions & 0 deletions my-eth-wallet/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Vue</title>
<script src="https://unpkg.com/vue"></script>
</head>
<body>
<div id="app">
<h1>{{ greeting }}</h1>
</div>
<div id="button-1">
address:
<input v-model="address" placeholder="address">
<p>balance is: {{ balance }}</p>
<button v-on:click="submitButton">submit</button>
</div>
<pre>
<div id="sendEth">
<h3>Send Ether</h3>
To Address:
<input v-model="address" placeholder="address">

nonce:
<input v-model="nonce" placeholder="nonce">

data:
<input v-model="data" placeholder="data">

gas Price:
<input v-model="gasPrice" placeholder="gasPrice">

gas Limit:
<input v-model="gasLimit" placeholder="gasLimit">

value:
<input v-model="value" placeholder="value">

<p>txn id: {{ txnId }}</p>
<button v-on:click="send">SEND</button>
</div>
</pre>

<pre>
<div id="contract">
<h3>Contract call</h3>
Contract Address:
<input v-model="contractAddress" placeholder="contractAddress">

Contract Abi:
<input v-model="abi" placeholder="abi">

arg1:
<input v-model="arg1" placeholder="arg1">

arg1:
<input v-model="arg2" placeholder="arg2">

gas Price:
<input v-model="gasPrice" placeholder="gasPrice">

gas Limit:
<input v-model="gasLimit" placeholder="gasLimit">

value:
<input v-model="value" placeholder="value">

<p>txn id / Result : {{ txnId }}</p>
<button v-on:click="send">CALL</button>

DEF balance:
<input v-model="DEFbalance" placeholder="balance">

<button v-on:click="balance">GET BALANCE</button>
</div>
</pre>

<!-- <script src="https://cdn.rawgit.com/ethereum/web3.js/v0.20.6/dist/web3.min.js"></script> -->
<script src="https://cdn.rawgit.com/ethereum/web3.js/v1.0.0-beta.35/dist/web3.min.js"></script>
<script>
var web3 = new Web3(new Web3.providers.HttpProvider("https://rinkeby.infura.io"));
// let util = require('ethereumjs-util');
// let tx = require('ethereumjs-tx');
var app = new Vue({
el: '#app',
data: {
greeting: 'My Ethereum Wallet',
}
})
var button1 = new Vue({
el: '#button-1',
data: {
address: '',
balance: '',
},
methods: {
submitButton: function (event) {
web3.eth.getBalance(button1.address, 'latest', (err, res) => {
if (err) {
console.log('error ' + err);
} else {
button1.balance=res;
}
});
}
}
})
var sendEth = new Vue({
el: '#sendEth',
data: {
address: '',
nonce: '',
data: '',
gasPrice: '20000000000',
gasLimit: '21000',
txnId: '',
value: '',
},
methods: {
send: function (event) {
const privateKey = 'EB5513D506854DC8452B62312A6FAD27EE0D62C3FDCD0129FC2B4C7E008ED154';
const account = web3.eth.accounts.privateKeyToAccount('0x' + privateKey);
web3.eth.accounts.wallet.add(account);
web3.eth.defaultAccount = account.address;

let address = account.address;
console.log("address: " + address);
console.log(web3.eth.accounts.wallet);
console.log("accounts: " + web3.eth.accounts);

let transactionCount = web3.eth.getTransactionCount(address);
//eth
let txObj = {
from: address,
to: sendEth.address,
value: sendEth.value,
gas: sendEth.gasLimit,
gasPrice: sendEth.gasPrice,
data: sendEth.data,
};
console.log(txObj);
web3.eth.sendTransaction(txObj, (err, transactionHash) => {
if (err) {
console.log('error ' + err);
} else {
sendEth.txnId = transactionHash;
console.log(sendEth.txnId);
}
});
}
}
})
var contract = new Vue({
el: '#contract',
data: {
contractAddress: '0x907B98479a589abAFC72926837B726B0D3582C3F',
abi: '[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"burner","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]',
arg1: '0xea9568670a5fE44D42e76386d208165c25A320f7',
arg2: '10',
gasPrice: '20000000000',
gasLimit: '21000',
txnId: '',
value: '0',
DEFbalance: '',
},
methods: {
send: function (event) {

const privateKey = 'EB5513D506854DC8452B62312A6FAD27EE0D62C3FDCD0129FC2B4C7E008ED154';
const account = web3.eth.accounts.privateKeyToAccount('0x' + privateKey);
web3.eth.accounts.wallet.add(account);
web3.eth.defaultAccount = account.address;

let address = account.address;
console.log("address: " + address);
console.log(web3.eth.accounts.wallet);
console.log("accounts: " + web3.eth.accounts);

var contractObj = new web3.eth.Contract(JSON.parse(contract.abi, contract.contractAddress));
contractObj.options.address = contract.contractAddress;
contractObj.options.from = address; // default from address
contractObj.options.gasPrice = '20000000000'; // default gas price in wei
contractObj.options.gas = 210000; // provide as fallback always 5M gas
console.log(contractObj.options.address);

contractObj.methods.transfer(contract.arg1, contract.arg2).send({from: address}).on('transactionHash', function(hash){
contract.txnId = hash;
console.log(hash);
}).on('error', console.error);
},
balance: function (event) {
const privateKey = 'EB5513D506854DC8452B62312A6FAD27EE0D62C3FDCD0129FC2B4C7E008ED154';
const account = web3.eth.accounts.privateKeyToAccount('0x' + privateKey);
web3.eth.accounts.wallet.add(account);
web3.eth.defaultAccount = account.address;

let address = account.address;
console.log("address: " + address);
console.log(web3.eth.accounts.wallet);
console.log("accounts: " + web3.eth.accounts);

var contractObj = new web3.eth.Contract(JSON.parse(contract.abi, contract.contractAddress));
contractObj.options.address = contract.contractAddress;
contractObj.options.from = address; // default from address
contractObj.options.gasPrice = '20000000000'; // default gas price in wei
contractObj.options.gas = 210000; // provide as fallback always 5M gas
console.log(contractObj.options.address);
contractObj.methods.balanceOf(address).call({from: address}).then(function(result){
console.log(result);
contract.DEFbalance = result;
});
}
}
})
</script>
</body>
</html>
9 changes: 9 additions & 0 deletions my-eth-wallet/serve.js
Original file line number Diff line number Diff line change
@@ -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');