-
Notifications
You must be signed in to change notification settings - Fork 194
/
index.html
58 lines (58 loc) · 2.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Generating Ethereum Addresses</title>
<link href="https://fonts.googleapis.com/css?family=M+PLUS+Rounded+1c" rel="stylesheet">
<link rel="stylesheet" href="main.css">
<title>Generating ETH accounts</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<h1>Generating Ethereum accounts and signing transactions in Javascript</h1>
<div id="app">
<div>
<div><button v-on:click="generateNew">Generate New Mnemonic</button></div>
Mnemonic: <textarea v-model="mnemonic"></textarea>
<p>**Note that in this demonstration application, this mnemonic will generate different sets of keys than
<a href="https://metamaks.io">Metamask</a>
or <a href="https://myetherwallet.com">My Ether Wallet.</a>**</p>
</div>
<div v-if="privKey !== ''">
<p>Private Key: {{privKey.toString('hex')}}</p>
<p>Public Key: {{pubKey.toString('hex')}}</p>
<p>Ethereum address: {{ETHaddress}}</p>
<button v-on:click="signSampleTx">Sign sample transaction</button>
</div>
<div v-if="recoveredAddress !== ''">
<h3>Transaction</h3>
<code>
Unsigned Transaction:
{ nonce: '0x00',
gasPrice: '0x09184e72a000',
gasLimit: '0x2710',
to: '0x31c1c0fec59ceb9cbe6ec474c31c1dc5b66555b6',
value: '0x10',
data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
chainId: 1 }
</code>
<br><br>
<div>
<code>Signed raw tx: {
nonce: '0x00',
gasPrice: '0x09184e72a000',
gasLimit: '0x2710',
to: '0x31c1c0fec59ceb9cbe6ec474c31c1dc5b66555b6',
value: '0x00',
data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
v: {{'0x' + signedSample.v.toString('hex')}},
r: {{'0x' + signedSample.r.toString('hex')}},
s: {{'0x' + signedSample.v.toString('hex')}}
}</code>
</div>
<p>Recovered address: {{recoveredAddress}}</p>
</div>
</div>
</body>
<script src="./bundle.js"></script>
</html>