1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-11-22 17:50:09 +01:00

more typo fixes

This commit is contained in:
Matthias Kretschmann 2017-06-07 15:49:44 +02:00
parent 5d76fb2b1b
commit 708c16f785
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -42,10 +42,10 @@ import * as driver from 'js-bigchaindb-driver';
// http(s)://<bigchaindb-API-url>/ (e.g. http://localhost:9984/api/v1/) // http(s)://<bigchaindb-API-url>/ (e.g. http://localhost:9984/api/v1/)
const API_PATH = 'http://localhost:9984/api/v1/'; const API_PATH = 'http://localhost:9984/api/v1/';
// create a new user with a public-private keypair // Create a new user with a public-private key pair
const alice = new driver.Ed25519Keypair(); const alice = new driver.Ed25519Keypair();
// Create a transation // Create a transaction
const tx = driver.Transaction.makeCreateTransaction( const tx = driver.Transaction.makeCreateTransaction(
{ assetMessage: 'My very own asset...' }, { assetMessage: 'My very own asset...' },
{ metaDataMessage: 'wrapped in a transaction' }, { metaDataMessage: 'wrapped in a transaction' },
@ -55,10 +55,10 @@ const tx = driver.Transaction.makeCreateTransaction(
alice.publicKey alice.publicKey
); );
// sign/fulfill the transaction // Sign/fulfill the transaction
const txSigned = driver.Transaction.signTransaction(tx, alice.privateKey); const txSigned = driver.Transaction.signTransaction(tx, alice.privateKey);
// send it off to BigchainDB // Send it off to BigchainDB
let conn = new driver.Connection(PATH, { 'Content-Type': 'application/json' }); let conn = new driver.Connection(PATH, { 'Content-Type': 'application/json' });
conn.postTransaction(txSigned) conn.postTransaction(txSigned)
.then(() => conn.getStatus(txSigned.id)) .then(() => conn.getStatus(txSigned.id))
@ -73,7 +73,7 @@ The expected flow for making transactions:
- `new driver.Ed25519Keypair()` - `new driver.Ed25519Keypair()`
2. Construct a transaction payload that you can send off to BigchainDB: 2. Construct a transaction payload that you can send off to BigchainDB:
- `driver.Transaction.makeCreateTransaction()` for creating a new asset or - `driver.Transaction.makeCreateTransaction()` for creating a new asset or
- `driver.Transaction.makeTransferTransaction()` for transfering an existing asset - `driver.Transaction.makeTransferTransaction()` for transferring an existing asset
3. A transaction needs an output (\*): 3. A transaction needs an output (\*):
- `driver.Transaction.makeOutput()` still requires a crypto-condition - `driver.Transaction.makeOutput()` still requires a crypto-condition
- `driver.Transaction.makeEd25519Condition()` should do the trick for a simple public key output. - `driver.Transaction.makeEd25519Condition()` should do the trick for a simple public key output.
@ -89,11 +89,8 @@ The expected flow for making transactions:
This implementation plays "safe" by using JS-native (or downgradable) libraries for its crypto-related functions to keep compatibilities with the browser. If you do want some more speed, feel free to explore the following: This implementation plays "safe" by using JS-native (or downgradable) libraries for its crypto-related functions to keep compatibilities with the browser. If you do want some more speed, feel free to explore the following:
* [chloride](https://github.com/dominictarr/chloride), or its underlying [sodium](https://github.com/paixaop/node-sodium) * [chloride](https://github.com/dominictarr/chloride), or its underlying [sodium](https://github.com/paixaop/node-sodium) library
library * [node-sha3](https://github.com/phusion/node-sha3) -- **MAKE SURE** to use [steakknife's fork](https://github.com/steakknife/node-sha3) if [the FIPS 202 upgrade](https://github.com/phusion/node-sha3/pull/25) hasn't been merged (otherwise, you'll run into all kinds of hashing problems)
* [node-sha3](https://github.com/phusion/node-sha3) -- **MAKE SURE** to use [steakknife's fork](https://github.com/steakknife/node-sha3)
if [the FIPS 202 upgrade](https://github.com/phusion/node-sha3/pull/25) hasn't been merged
(otherwise, you'll run into all kinds of hashing problems)
## Warnings ## Warnings
@ -101,17 +98,16 @@ This implementation plays "safe" by using JS-native (or downgradable) libraries
Make sure you keep using a crypto-conditions implementation that implements the older v1 draft (e.g. Make sure you keep using a crypto-conditions implementation that implements the older v1 draft (e.g.
[`five-bells-condition@v3.3.1`](https://github.com/interledgerjs/five-bells-condition/releases/tag/v3.3.1)). [`five-bells-condition@v3.3.1`](https://github.com/interledgerjs/five-bells-condition/releases/tag/v3.3.1)).
BigchainDB Server 0.10 does not implement the newer version of the spec and **WILL** fail if you try using a newer implementation of crypto-conditions. BigchainDB Server 0.10 does not implement the newer version of the spec and **WILL** fail if you try using a newer implementation of crypto-conditions.
> SHA3 > SHA3
Make sure to use a SHA3 implementation that has been upgraded as per [FIPS 202](http://csrc.nist.gov/publications/drafts/fips-202/fips_202_draft.pdf). Make sure to use a SHA3 implementation that has been upgraded as per [FIPS 202](http://csrc.nist.gov/publications/drafts/fips-202/fips_202_draft.pdf). Otherwise, the hashes you generate **WILL** be invalid in the eyes of the BigchainDB Server.
Otherwise, the hashes you generate **WILL** be invalid in the eyes of the BigchainDB Server.
> Ed25519 > Ed25519
If you do end up replacing `tweetnacl` with `chloride` (or any other `Ed25519` package), you might If you do end up replacing `tweetnacl` with `chloride` (or any other `Ed25519` package), you might want to double check that it gives you a correct public/private (or verifying/signing, if they use
want to double check that it gives you a correct public/private (or verifying/signing, if they use
that lingo) key pair. that lingo) key pair.
An example BigchainDB Server-generated key pair (encoded in `base58`): An example BigchainDB Server-generated key pair (encoded in `base58`):
@ -119,8 +115,7 @@ An example BigchainDB Server-generated keypair (encoded in `base58`):
- Public: `DjPMHDD9JtgypDKY38mPz9f6owjAMAKhLuN1JfRAat8C` - Public: `DjPMHDD9JtgypDKY38mPz9f6owjAMAKhLuN1JfRAat8C`
- Private: `7Gf5YRch2hYTyeLxqNLgTY63D9K5QH2UQ7LYFeBGuKvo` - Private: `7Gf5YRch2hYTyeLxqNLgTY63D9K5QH2UQ7LYFeBGuKvo`
Your package should be able to take in the decoded version of the **private** key and return you the Your package should be able to take in the decoded version of the **private** key and return you the same **public** key (once you encode that to `base58`).
same **public** key (once you encode that to `base58`).
## npm releases ## npm releases