rchain / bounties

RChain Bounty Program
MIT License
90 stars 62 forks source link

Port Trust Metric to Rholang #561

Open kennyrowe opened 6 years ago

kennyrowe commented 6 years ago

Measure of Completion: Code Proof of Concept published on Github Suggested Budget: $5,000

kennyrowe commented 6 years ago

@dckc any idea who might like to join this effort?

Jake-Gillberg commented 6 years ago

Interested

dckc commented 6 years ago

@leithaus I heard you ask about a decentralized version of the trust metric just as today's weekly debrief ended... I guess that could work with public keys and pet names or something... computing the trust metric involves picking a seed, so it's somewhat inherently centralized in that sense.

Are oracles to connect to github and/or discord credentials important? Or shall we just live in the future for this?

What does anybody have in mind for user interfaces to RChain? Do we have a design for a web3 analog? Maybe just stick to CLI for this? I'm inclined to use the waterken web_send protocol, I think.

dckc commented 6 years ago

unforgeable names might do fine without any public key crypto. hm.

dckc commented 6 years ago

some noodling: https://gist.github.com/dckc/cd9626d556d771f2d710ad7091fed1f9

Jake-Gillberg commented 6 years ago

noodles on top of the noodles: https://gist.github.com/Jake-Gillberg/61dbfabbe262f9d86a70d2159a735e9a

Realized that you probably need to nest the makePlayer inside of the makeGameBoard contract. You can't just trust that someone will pass you a function that will gather a list of friends. They could just decide to never return and then you are stuck at getCerts.

dckc commented 6 years ago

Good point about never returning... in due course we should be able to represent that as a behavioral type. But for now, yes, having the game board set the player rules makes sense.

dckc commented 6 years ago

Our endorse method is incomplete without methods to edit and delete endorsements.

dckc commented 6 years ago

I wonder how to connect web server apps with rnode.

I like the capper architecture (node.js plus waterken style messaging). It seems compatible with the RhoVM style, but I'm not sure the GRPC interfaces exported by rnode suffice yet. I'm not sure how to do a client side persistent for, for example.

David405 commented 6 years ago

@dckc I have had similar thoughts too, have you thought of the possibility of RNode working with web3.js or even having a similar JavaScript API?

By the way, porting the Trust metric to rholang should make it unalterable, what then happens if we intend to make changes to the trust metric?

dckc commented 6 years ago

On web3... yes, that's the idea...

Does web3 support subscribing to changes at a name? If so, perhaps it would work. I'm more familiar with capper, which borrows from waterken web_send.

See also Distributed Electronic Rights in JavaScript.

dckc commented 6 years ago

I don't understand what you mean about making the trust metric unalterable. I don't understand how Rholang is different from python / PHP / js in this regard.

David405 commented 6 years ago

Ahhh, I guess the right word should have been "stores persistent records" rather than "unaltered", I now have a better understanding.

Is Dr SES in use yet or it is still just a proposition? I can't find any useful document as to its usage in a project.

David405 commented 6 years ago

I am not sure if web3.js supports subscribing to changes on a name, Capper seems interesting also but it is not clear how it can interact with a blockchain node.

dckc commented 6 years ago

I'm making progress talking to rnode from a Capper app. The Capper app is doing OAuth2.

https://github.com/dckc/rchain-dbr/tree/oauth_gateway/gateway 74a28a7 https://github.com/dckc/rchain-dbr/blob/oauth_gateway/gateway/server/rnodeAPI.js

progress toward signing Rholang data from javascript last night: https://gist.github.com/dckc/b963d3e77726118ff5aac1be152e98aa

dckc commented 6 years ago

I'm starting to clean up and document the code I wrote over the last couple days. I moved design notes to CONTRIBUTING.md and added a Porting the trust metric to Rholang with node.js and Capper section.

Noteable commits

dckc commented 6 years ago

trustCertTest deploys signed transaction! (462efb4)

trustCertTest code is https://github.com/dckc/rchain-dbr/blob/oauth_gateway/gateway/server/main.js#L129-L173

We generate a key for our gateway:

<keyPair gateway 1 key: b6251833e2a1...> 'b6251833e2a1210fee3a1ff10ed1ca870ebe65c9832974d90c97250a7d5b935b'

Then we suppose these data come from a web form (authenticated with OAuth):

    const cert1 = {
    voter: "dckc",
    subject: "bob",
    rating: 2,
    cert_time: clock().toISOString()
    };

Using the RSON convention, this becomes:

@{"cert_time"}!("2018-07-22T05:37:22.804Z") | @{"rating"}!(2) | @{"subject"}!("bob") | @{"voter"}!("dckc")

then we make a call to a certify contract with that data and its signature:

@{"certify"}!(
  @{"cert_time"}!("2018-07-22T05:37:22.804Z") | @{"rating"}!(2) | @{"subject"}!("bob") | @{"voter"}!("dckc"), "a63e593c8723996483dce9ed820aaeb13ec3ef8b55f1c0851ee608b0b0df8082eafba7cb5ccb7ca7318ad8a92977fe79a6ef00eb6966a621784a99302d1cc806" )

and we deploy it using gRPC:

05:50:49.203 [grpc-default-executor-193] INFO  c.rchain.casper.MultiParentCasper$ - CASPER: Received Deploy #1532238649198 -- @{"certify"}!(@{"cert_tim...

I'm hitting some weird issue with propose (addBlock) via gRPC, but when I rnode propose, it likes the new block:

05:53:05.134 [repl-io-286] INFO  c.rchain.casper.MultiParentCasper$ - CASPER: New fork-choice tip is block 0d15d9886d....

TODO: deploy another contract that checks the signature.

kennyrowe commented 6 years ago

:thumbs up:

On Sat, Jul 21, 2018 at 22:56 Dan Connolly notifications@github.com wrote:

trustCertTest deploys signed transaction! (462efb4)

We generate a key for our gateway:

<keyPair gateway 1 key: b6251833e2a1...> 'b6251833e2a1210fee3a1ff10ed1ca870ebe65c9832974d90c97250a7d5b935b'

Then we suppose these data come from a web form (authenticated with OAuth):

const cert1 = {

voter: "dckc", subject: "bob", rating: 2, cert_time: clock().toISOString() };

Using the RSON convention, this becomes:

@{"cert_time"}!("2018-07-22T05:37:22.804Z") | @{"rating"}!(2) | @{"subject"}!("bob") | @{"voter"}!("dckc")

then we make a call to a certify contract with that data and its signature:

@{"certify"}!( @{"cert_time"}!("2018-07-22T05:37:22.804Z") | @{"rating"}!(2) | @{"subject"}!("bob") | @{"voter"}!("dckc"), "a63e593c8723996483dce9ed820aaeb13ec3ef8b55f1c0851ee608b0b0df8082eafba7cb5ccb7ca7318ad8a92977fe79a6ef00eb6966a621784a99302d1cc806" )

and we deploy it using gRPC:

05:50:49.203 [grpc-default-executor-193] INFO c.rchain.casper.MultiParentCasper$ - CASPER: Received Deploy #1532238649198 -- @{"certify"}!(@{"cert_tim...

I'm hitting some weird issue with propose (addBlock) via gRPC, but when I rnode propose, it likes the new block:

05:53:05.134 [repl-io-286] INFO c.rchain.casper.MultiParentCasper$ - CASPER: New fork-choice tip is block 0d15d9886d....

TODO: deploy another contract that checks the signature.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rchain/bounties/issues/561#issuecomment-406843187, or mute the thread https://github.com/notifications/unsubscribe-auth/AGAAnF5B2OADHQSxGlN26787ny3Ra7G6ks5uJBQMgaJpZM4S_TpA .

dckc commented 6 years ago

web UI connected to RChain! (fa1554f)

OAuth parts are still a bit rough.

I'd like to demo this. And/or deploy it to our staging server. Or maybe make a screencast.

For now, how about just a screenshot...

trust-metric-web-rchain

David405 commented 6 years ago

This is supercool!!!

@dckc is it possible for us to have a zoom session, or better still show it to us during Colab today(perhaps we could deploy it to the staging server there too) or Saturday's office hours? I could use a lot of help from this.

dckc commented 6 years ago

Please do try to deploy it to a staging server. I put some effort into documentation. Let me know where it's not enough.

If collab is during office hours today, no, I'm not available.

On Tue, Jul 24, 2018, 1:57 AM David Asamonye notifications@github.com wrote:

This is supercool!!!

@dckc https://github.com/dckc is it possible for us to have a zoom session, or better still show it to us during Colab today(perhaps we could deploy it to the staging server there too) or Saturday's office hours? I could use a lot of help from this.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rchain/bounties/issues/561#issuecomment-407301981, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJNynnpg83d34OIBaEomo_z1RMQFAgIks5uJsVzgaJpZM4S_TpA .

dckc commented 6 years ago

Anybody got a validating node whose gRPC port I can connect to via an ssh tunnel? Aside from a gRPC server to connect to, I have the app deployed at https://dckc-rchain-dbr.glitch.me/ .

p.s. @jimscarver points out all we needed to do was open firewall ports with ufw. I'm pruning those comments from here; see also #830 and the collab discord.

As I mentioned: the OAuth parts are a bit rough. After you log in, replace ? with # in the URL. Then the page should start to do more useful stuff.

Unfortunately, when you hit Save it will hang waiting for gRPC. (It comes back after 2 minutes when TCP times out.)

dckc commented 6 years ago

As I showed the code to @JoshOrndorff and @jimscarver we agreed the rnodeAPI.js part should go in its own repository / package. So:

dckc commented 6 years ago

With @JoshOrndorff , I made a bunch of progress on the rholang side tonight:

https://github.com/dckc/rchain-dbr/blob/master/communityTrust.rho 81e0f9c

He did some code clean-up in RChain-API; I aim to sync up with that.

dckc commented 6 years ago

I put together some rough slides on work in this area:

2a887b8 https://github.com/dckc/RChain-API/tree/talk-reveal/talk

and I managed to make a pdf version