Code Monkey home page Code Monkey logo

mushroom-app-tutorial's Introduction

p2panda

All the things a panda needs


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 reach v1.0. Currently no p2panda implementation has recieved a security audit.

Features

  • Generate Ed25519 key pairs.
  • Create and encode Bamboo entries.
  • Publish schemas and validate data.
  • Create, update and delete data collaboratively.
  • Encrypt data with OpenMLS.
  • Materialise documents from data changes.
  • Prepare data for node servers.

Usage

import { KeyPair } from "p2panda-js";
const keyPair = new KeyPair();
console.log(keyPair.publicKey());
use p2panda_rs::identity::KeyPair;
let key_pair = KeyPair::new();
println!("{}", key_pair.public_key());

See the demo application and its source code. More examples can be found in the p2panda-rs and p2panda-js directories.

Installation

If you are using p2panda in web browsers or NodeJS applications run:

$ npm i p2panda-js

For Rust environments run:

$ cargo add p2panda-rs

Documentation

Visit the corresponding folders for development instructions and documentation:

Benchmarks

Performance benchmarks can be found in benches. You can run them using cargo-criterion:

$ cargo install cargo-criterion
$ cargo criterion
# An HTML report with plots is generated automatically
$ open target/criterion/reports/index.html

These benchmarks can be used to compare the performance across branches by running them first in a base branch and then in the comparison branch. The HTML-reports will include a comparison of the two results.

License

GNU Affero General Public License v3.0 AGPL-3.0-or-later

Supported by



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 and NGI-ASSURE No 957073

mushroom-app-tutorial's People

Contributors

adzialocha avatar cafca avatar sandreae avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sandreae

mushroom-app-tutorial's Issues

ClientError: error deserializing plain value: data did not match any variant of untagged enum PlainValue

I'm having an error when running npm run schema

> [email protected] schema
> ts-node --esm --transpileOnly ./register-schema.ts

Create and deploy schemas for the mushroom tutorial app
Created schema field 0020a2f2bf06cf2e751ccf00b5723f5957831ff30ec59d3716490e46b3847b1582e3
Created schema field 00205fa94a2204630b1a71a40eb0d3dac03115a3961135a8136b37b45afcf24c2a9d
Created schema field 002087a31d8595d48b9c723f8affa45f7af7e82cc0be856c31d30fc5761f639f688c
Created schema field 00208c2d8ebe8b95fd4c4b02bd8595ed569e6ec5de1b816b70dbf809e08ddbe0713a
/home/heinz/workspace/p2panda/mushroom-app-tutorial/node_modules/graphql-request/dist/index.js:63
            op = body.call(thisArg, _);
                      ^
ClientError: error deserializing plain value: data did not match any variant of untagged enum PlainValue: {"response":{"data":null,"errors":[{"message":"error deserializing plain value: data did not match any variant of untagged enum PlainValue","locations":[{"line":3,"column":7}]}],"status":200,"headers":{}},"request":{"query":"\n    mutation Publish($entry: String!, $operation: String!) {\n      publish(entry: $entry, operation: $operation) {\n        logId\n        seqNum\n        backlink\n        skiplink\n      }\n    }\n  ","variables":{"entry":"00479fa93b147fbd88ff80412288727c1952943d0ace709a644525a585454e81d80401f901810020bbafb6a14f7bad4b91325d95035eac8b1157b2baf56a7238c1bf26ad513758a2b3c801c0d34517fd141e2ab7da8c98b375474168a9952c8bb91935e93ec35960047d2ad4823ff5f54ab53e190233046d3c79fd8f688ea3cac6d3d2a75ac0ae05","operation":"84010074736368656d615f646566696e6974696f6e5f7631a36b6465736372697074696f6e7828496e666f726d6174696f6e7320616e642064657461696c732061626f7574206d757368726f6f6d73666669656c6473848178443030323061326632626630366366326537353163636630306235373233663539353738333166663330656335396433373136343930653436623338343762313538326533817844303032303566613934613232303436333062316137316134306562306433646163303331313561333936313133356138313336623337623435616663663234633261396481784430303230383761333164383539356434386239633732336638616666613435663761663765383263633062653835366333316433306663353736316636333966363838638178443030323038633264386562653862393566643463346230326264383539356564353639653665633564653162383136623730646266383039653038646462653037313361646e616d65686d757368726f6f6d"}}}
    at /home/heinz/workspace/p2panda/mushroom-app-tutorial/node_modules/graphql-request/src/index.ts:497:11
    at step (/home/heinz/workspace/p2panda/mushroom-app-tutorial/node_modules/graphql-request/dist/index.js:63:23)
    at Object.next (/home/heinz/workspace/p2panda/mushroom-app-tutorial/node_modules/graphql-request/dist/index.js:44:53)
    at fulfilled (/home/heinz/workspace/p2panda/mushroom-app-tutorial/node_modules/graphql-request/dist/index.js:35:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  response: {
    data: null,
    errors: [ [Object] ],
    status: 200,
    headers: Headers { [Symbol(map)]: [Object: null prototype] }
  },
  request: {
    query: '\n' +
      '    mutation Publish($entry: String!, $operation: String!) {\n' +
      '      publish(entry: $entry, operation: $operation) {\n' +
      '        logId\n' +
      '        seqNum\n' +
      '        backlink\n' +
      '        skiplink\n' +
      '      }\n' +
      '    }\n' +
      '  ',
    variables: {
      entry: '00479fa93b147fbd88ff80412288727c1952943d0ace709a644525a585454e81d80401f901810020bbafb6a14f7bad4b91325d95035eac8b1157b2baf56a7238c1bf26ad513758a2b3c801c0d34517fd141e2ab7da8c98b375474168a9952c8bb91935e93ec35960047d2ad4823ff5f54ab53e190233046d3c79fd8f688ea3cac6d3d2a75ac0ae05',
      operation: '84010074736368656d615f646566696e6974696f6e5f7631a36b6465736372697074696f6e7828496e666f726d6174696f6e7320616e642064657461696c732061626f7574206d757368726f6f6d73666669656c6473848178443030323061326632626630366366326537353163636630306235373233663539353738333166663330656335396433373136343930653436623338343762313538326533817844303032303566613934613232303436333062316137316134306562306433646163303331313561333936313133356138313336623337623435616663663234633261396481784430303230383761333164383539356434386239633732336638616666613435663761663765383263633062653835366333316433306663353736316636333966363838638178443030323038633264386562653862393566643463346230326264383539356564353639653665633564653162383136623730646266383039653038646462653037313361646e616d65686d757368726f6f6d'
    }
  }
}

Rust is version 1.75.0

ECONNRESET when registering schema

I'm trying to run the example in the tutorial, and my aquadoggo node is running in another terminal process (v0.7.1), and then I run npm run schema and get this error:

Create and deploy schemas for the mushroom tutorial app
/mushroom-app-tutorial/node_modules/node-fetch/lib/index.js:1491
			reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
          ^
FetchError: request to http://localhost:2020/graphql failed, reason: socket hang up
    at ClientRequest.<anonymous> (/mushroom-app-tutorial/node_modules/node-fetch/lib/index.js:1491:11)
    at ClientRequest.emit (node:events:513:28)
    at ClientRequest.emit (node:domain:489:12)
    at Socket.socketOnEnd (node:_http_client:519:9)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:489:12)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ECONNRESET',
  code: 'ECONNRESET'
}

When I terminate the node and re-run the script, I get ECONNREFUSED as I might expect.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.