Skip to content

Commit 6cda62e

Browse files
committed
Write top-level Readme.
1 parent 6c53919 commit 6cda62e

File tree

3 files changed

+17
-36
lines changed

3 files changed

+17
-36
lines changed

Cargo.toml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[package]
22
name = "pchain-types"
3-
version = "0.4.1"
3+
version = "0.4.2"
44
authors = ["ParallelChain Lab <[email protected]>"]
55
edition = "2018"
6-
description = "Types prescribed in the ParallelChain F Blockchain Protocol"
6+
description = "Data types defined in the ParallelChain Protocol"
77
license = "Apache-2.0"
8-
repository = "https://github.com/parallelchain-io/parallelchain-protocol-types"
8+
repository = "https://github.com/parallelchain-io/pchain-types-rust"
99

1010
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1111

@@ -17,12 +17,8 @@ hex = "0.4.3"
1717
rand = "0.7"
1818

1919
[dependencies]
20-
base64 = "0.13"
2120
borsh = "=0.10.2"
2221
ed25519-dalek = "1.0.1"
23-
hotstuff_rs = { git = "https://github.com/parallelchain-io/hotstuff_rs" }
22+
hotstuff_rs = { version = "0.2", git = "https://github.com/parallelchain-io/hotstuff_rs" }
2423
rs_merkle = "1.1"
2524
sha2 = "0.10"
26-
27-
[features]
28-
default = []

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ParallelChain Types (Rust)
22

3-
Rust implementations of the data types defined in the [ParallelChain Protocol](https://github.com/parallelchain-io/parallelchain-protocol), including transactions, blocks, cryptographic primitives, and RPC requests and responses.
3+
Rust implementation of the data types defined in the [ParallelChain Protocol](https://github.com/parallelchain-io/parallelchain-protocol), including transactions, blocks, cryptographic primitives, and RPC requests and responses.
44

55
Read the docs at: [docs.rs](https://docs.rs/pchain-types/0.4.2/pchain_types/)
66

@@ -14,9 +14,9 @@ Read the docs at: [docs.rs](https://docs.rs/pchain-types/0.4.2/pchain_types/)
1414

1515
## Common use cases
1616

17-
- Generating a keypair.
18-
- Creating and signing a transaction.
19-
- Creating RPC requests, and interpreting responses.
17+
- Generating a keypair: (https://docs.rs/pchain-types/0.4.2/pchain_types/cryptography/index.html#generating-a-keypair)
18+
- Creating and signing a transaction: (https://docs.rs/pchain-types/0.4.2/pchain-types/blockchain/struct.Transaction.html#creating-a-transaction).
19+
- Creating RPC requests: [RPC](https://docs.rs/pchain-types/0.4.2/pchain_types/rpc).
2020

2121
## Versioning
2222

src/blockchain.rs

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,15 @@ pub struct BlockHeader {
7777
impl Serializable for BlockHeader {}
7878
impl Deserializable for BlockHeader {}
7979

80-
/// Transactions are digitally signed instructions that tell
81-
/// the Mainnet state machine to execute a sequence of ‘commands’.
80+
/// Digitally signed instructions that tell the ParallelChain state machine to execute a sequence of [commands](Command).
81+
///
82+
/// ## Creating a Transaction
83+
///
84+
/// There are two ways of creating an instance of transaction:
85+
/// 1. Using the [constructor function](Transaction::new): this takes in the user-provided fields of a transaction and
86+
/// computes its signature and hash automatically.
87+
/// 2. Using a struct expression (i.e., `Transaction { signer: ..., }`): this does not check the signature and hash
88+
/// fields.
8289
#[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize)]
8390
pub struct Transaction {
8491
/// The public address of the external account which signed this transaction
@@ -248,25 +255,3 @@ pub enum ExitStatus {
248255

249256
impl Serializable for ExitStatus {}
250257
impl Deserializable for ExitStatus {}
251-
252-
/// SignedTx is a data structure utlized in generating
253-
/// signed [Transaction] for submission to ParallelChain.
254-
#[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize)]
255-
pub struct SignedTransaction(Transaction);
256-
257-
impl Serializable for SignedTransaction {}
258-
impl Deserializable for SignedTransaction {}
259-
260-
impl Deref for SignedTransaction {
261-
type Target = Transaction;
262-
263-
fn deref(&self) -> &Self::Target {
264-
&self.0
265-
}
266-
}
267-
268-
impl From<SignedTransaction> for Transaction {
269-
fn from(signed_tx: SignedTransaction) -> Self {
270-
signed_tx.0
271-
}
272-
}

0 commit comments

Comments
 (0)