-
-
Notifications
You must be signed in to change notification settings - Fork 158
/
README
69 lines (50 loc) · 2.82 KB
/
README
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
59
60
61
62
63
64
65
66
67
68
69
<!--
This is a different readme file which will be published to npm
@link https://stackoverflow.com/a/52683086
The problem was that googled indexed the npm-site instead of the github site
-->
<p align="center">
<a alt="travis" href="https://travis-ci.org/pubkey/eth-crypto">
<img src="https://travis-ci.org/pubkey/eth-crypto.svg?branch=master" /></a>
<a href="https://twitter.com/pubkeypubkey">
<img src="https://img.shields.io/twitter/follow/pubkeypubkey.svg?style=social&logo=twitter"
alt="follow on Twitter"></a>
</p>
# eth-crypto
Cryptographic javascript-functions for ethereum and tutorials on how to use them together with web3js and solidity.
## Tutorials
- **[Creating Keys and use them for ethereum-transactions](./tutorials/creating-transactions.md)**
In this tutorial we will create an ethereum-identity and use it so send transactions to the blockchain.
- **[Sign and validate data with solidity](./tutorials/signed-data.md)**
In this tutorial we will sign data in javascript and validate the signature inside of a smart-contract.
- **[Sending encrypted and signed data to other identites](./tutorials/encrypted-message.md)**
In this tutorial we will use the ethereum-identites and asymmetric cryptography to send an encrypted and signed message from Alice to Bob.
## Functions
### Install
```bash
npm install eth-crypto --save
```
```javascript
// es6
import EthCrypto from 'eth-crypto';
// node
const EthCrypto = require('eth-crypto');
```
## API
- [createIdentity()](https://github.com/pubkey/eth-crypto#createidentity)
- [publicKeyByPrivateKey()](https://github.com/pubkey/eth-crypto#publickeybyprivatekey)
- [publicKey.toAddress()](https://github.com/pubkey/eth-crypto#publickeytoaddress)
- [publicKey.compress()](https://github.com/pubkey/eth-crypto#publickeycompress)
- [publicKey.decompress()](https://github.com/pubkey/eth-crypto#publickeydecompress)
- [sign()](https://github.com/pubkey/eth-crypto#sign)
- [recover()](https://github.com/pubkey/eth-crypto#recover)
- [recoverPublicKey()](https://github.com/pubkey/eth-crypto#recoverpublickey)
- [encryptWithPublicKey()](https://github.com/pubkey/eth-crypto#encryptwithpublickey)
- [decryptWithPrivateKey()](https://github.com/pubkey/eth-crypto#decryptwithprivatekey)
- [cipher.stringify()](https://github.com/pubkey/eth-crypto#cipherstringify)
- [cipher.parse()](https://github.com/pubkey/eth-crypto#cipherparse)
- [signTransaction()](https://github.com/pubkey/eth-crypto#signtransaction)
- [txDataByCompiled()](https://github.com/pubkey/eth-crypto#txdatabycompiled)
- [calculateContractAddress()](https://github.com/pubkey/eth-crypto#calculatecontractaddress)
- [hex.compress() hex.decompress()](https://github.com/pubkey/eth-crypto#hex-compressdecompress)
# [READ THE FULL DOCUMENTATION ON GITHUB](https://github.com/pubkey/eth-crypto)