This library provides all tools required to write a client, node or even your
own protocol implementation for the [p2panda
] network. It is shipped both as
a Rust crate [p2panda-rs
] with WebAssembly bindings and a NPM package
[p2panda-js
] with TypeScript definitions running in NodeJS or any modern web
browser.
The core p2panda [
specification
] is fully functional but still under review so please be prepared for breaking API changes until we reachv1.0
. Currently no p2panda implementation has recieved a security audit.
bash
cargo add p2panda-rs
```rust use p2pandars::entry::encode::encodeentry; use p2pandars::entry::EntryBuilder; use p2pandars::identity::KeyPair; use p2pandars::operation::encode::encodeoperation; use p2panda_rs::operation::OperationBuilder;
// Id of the schema which describes the data we want to publish. This should // already be known to the node we are publishing to. pub const SCHEMAID: &str = "profile0020c65567ae37efea293e34a9c7d13f8f2bf23dbdc3b5c7b9ab46293111c48fc78b";
// Generate new Ed25519 key pair. let key_pair = KeyPair::new();
// Add field data to "create" operation. let operation = OperationBuilder::new(&SCHEMA_ID.parse()?) .fields(&[("username", "panda".into())]) .build()?;
// Encode operation into bytes. let encodedoperation = encodeoperation(&operation)?;
// Create Bamboo entry (append-only log data type) with operation as payload. let entry = EntryBuilder::new().sign(&encodedoperation, &keypair)?;
// Encode entry into bytes. let encodedentry = encodeentry(&entry)?;
println!("{} {}", encodedentry, encodedoperation); ```
Run this code from the examples
folder:
bash
cargo run --example=create_operation
You will need the following tools to start development: - Rust - wasm-pack
```bash
cargo test
wasm-pack test --headless --firefox ```
GNU Affero General Public License v3.0 AGPL-3.0-or-later
This project has received funding from the European Union’s Horizon 2020 research and innovation programme within the framework of the NGI-POINTER Project funded under grant agreement No 871528