banner

Libyobicash

The Yobicash cryptocurrency library.

Table of Contents

Install

To install libyobicash add in your Cargo.toml:

```toml

Cargo.toml

[dependencies] libyobicash = "^0.1" ```

and in the root of your crate:

```rust //main.rs

extern crate libyobicash; ```

Usage

Look at the documentation or at the tests for guidance.

```rust // main.rs

// Bob wants to send some data to Alice through Yobicash and has found // a node offering a good price for broadcasting the data.

// let plain = some super important secret. // let alicepk = Alice public key; let bobsk = SecretKey::random(); let bobdata = Data::new(bobsk, alice_pk, &plain)?;

// let bob_coins = some spendable coins Bob owns that pay the fee // required by the node; // let bob = the output to the node that will broadcast Bob writes operation;

// One secret instance from Bob. Bob will use it to permit the network to // delete his data. let bob_instance = Scalar::random();

// The write operation containing the encrypted data that only // Bob and Alice can read. After confirmation, it will be broadcasted // to the network. let bobwrite = WriteOp::new(&bobcoins, &bobdata, bobinstance, &bob_fee)?;

println!(writeop.tojson()?);

// Now that the secret is not needed anymore, Bob and Alice agree that it // can be erased from the dagchain. Bob finds a node with making a good offer // to get rid of that data and broadcast the operation to the network.

// let nodecoins = some spendable coins the node owns that pay Bob's fee; // let nodefee = the fee promised to Bob by the node;

// Bob generates the proof of the bobwrite witness instance to send to the node // using the fee that the node will use and bobwrite itself. let bobproof = DeleteOp::proof(&bobwrite, &bobinstance, &nodefee)?;

// The node creates a delete operation with Bob's witness. // The node will delete bobwrites' Data after nodedelete get confirmed. // The other nodes of the network will do the same. let nodedelete = DeleteOp::new(&nodecoins, &bobwrite, &bobproof, &node_fee)?;

println!(nodedelete.tojson()?); ```

Maintainers

@chritchens

License

This project is license under either of

at your option.

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in libyobicash by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.