Skip to content

Commit

Permalink
Examples and privkey.png
Browse files Browse the repository at this point in the history
  • Loading branch information
Pethical committed Jun 27, 2018
1 parent d2d0b09 commit b433cf9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
31 changes: 25 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# MicroCoin API
# MicroCoin API
MicroCoin Rider is an API server for the MicroCoin ecosystem.
It acts as the interface between MicroCoin network and applications that want to access the MicroCoin network.
It allows you to submit transactions to the network, check the status of accounts, subscribe to transactions, etc.
Expand Down Expand Up @@ -37,17 +37,36 @@ After this, the owner of the account will be you, and the old owner will not hav

## Download the client SDK
First you need a MicroCoin client SDK.
You can download it from [here](), or clone from our [Github](https://github.com) repository.
You can download it from [here](), or clone from our [Github](https://github.com/MicroCoinHU/MicroCoin-Javacript-SDK) repository.
```bash
git clone https://
npm i elliptic
npm install
git clone https://github.com/MicroCoinHU/MicroCoin-Javacript-SDK.git
```
In the dist folder you will find the precompiled, production ready files.

## Keys and signatures
MicroCoin works with ECDSA signatures, so you need to work with ECDSA keys and signatures.
You can use your favorite **ECDSA** package, or use `elliptic.js`. We are using `elliptic.js` in our demos.
You can find a detailed documentation on the official github page https://github.com/indutny/elliptic

## HTML boilerplate
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MicroCoin client minimum project</title>
<script src="/dist/microcoin-promise.js"></script>
<script src="/dist/elliptic.js"></script>
</head>
<body>
<script>
var api = new MicroCoin.AccountApi();
api.getAccount("0-10").then(account => console.log(account));
</script>
</body>
</html>
```

## Generate new ECDSA keyPair
If you have no keys, you must generate a new key, then store it in a secure place.
**Please note: if you lose your key, you lose your accounts and your coins**
Expand All @@ -60,12 +79,12 @@ If you have a key, you can import it from a hexadecimal string.
```js
var ec = new elliptic.ec("secp256k1");
var myKey = ec.keyPair({ "priv":"PRIVATE KEY IN HEX", "privEnc":"hex" });
```

### Where is your private key?

![Private key](/img/privkey.png)

```
## Export ECDSA key
Sometimes you need save your key, or you need to display it. You can export your key using this method
```js
Expand Down
15 changes: 15 additions & 0 deletions examples/start.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MicroCoin client minimum project</title>
<script src="../dist/microcoin-promise.js"></script>
<script src="../dist/elliptic.js"></script>
</head>
<body>
<script>
var api = new MicroCoin.AccountApi();
api.getAccount("0-10").then(account => console.log(account));
</script>
</body>
</html>
Binary file added img/privkey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b433cf9

Please sign in to comment.