rchain-community / rchain-api

An API for rchain dapps to communicate with the blockchain
Other
22 stars 12 forks source link

`rclient account --new`, `rclient sign`, alicePaysBob, ethSig, loader, locker #57

Closed dckc closed 5 years ago

dckc commented 5 years ago

What do you think about syncing with where I'm at? Is it cost-effective to break these into smaller PRs?

JoshOrndorff commented 5 years ago

Technical Thoughts

RChain-API should probably have some kind of mission statement or something to avoid scope creep. Although we never discussed it. I always thought of it as something like:

RChain-API is a js library that makes it easy and convenient for js devs to interact with the RChain Coop's RNode client, and the dApps that it runs.

So I imagined that RChain-API wouldn't have an entry point (except for testing or maybe an example). According to that vision, here's what I think about the various things you suggested bringing in.

Personal Thoughts

As you know I'm trying to distance myself from the coop, but still very excited about rholang and process calculi for the blockchain in general. So @dckc, you're basically the primary maintainer on this project now. So if you want to take it in a different direction than my proposed mission statement, that's totally up to you, and I'll still be as supportive as I can.

dckc commented 5 years ago

We did discuss scope a bit... it's just that we're doing sufficiently well on the "easy and convenient" part that using this as a playground is much easier than making new projects. :)

I'll see what I can do about at least organizing rclient, loader, ethsig as examples which could be moved to separate projects straightforwardly.

dckc commented 5 years ago

Nonce management doesn't seem complicated to me. It's about 10 lines of code, no?

dckc commented 5 years ago

My understanding is that a nonce is necessary for digital signatures to provide adequate security.

I would need to see a compelling argument to the contrary.

odeac commented 5 years ago

how do you manage nonces in presence of parallelism?

If you have two processes working with the locker how do you make sure that both work with a valid nonce?

dckc commented 5 years ago

The down-side of a nonce that I see is performance / scalability: it serializes what would otherwise be concurrent work.

dckc commented 5 years ago

Ah.. so the complication you refer to is in the callers. Yes, that is a challenge.

odeac commented 5 years ago

My proposal relies on the uniqueness of the return channel and the uniqueness of the proxy channel, both being Rholang unforgeable names.

This way the return channel acts as a nonce so we are protected from a replay attack.

Also, the returned poxy acts as a session key i.e. when it gets out of scope the item stored in the locker is no longer accessible.

JoshOrndorff commented 5 years ago

In my conversation with @odeac in rchain-dev#cryptography, we decided that once https://rchain.atlassian.net/browse/RCHAIN-1048 is fixed, the unforgeable name will be session-specific and can serve the role that a nonce is currently serving.

dckc commented 5 years ago

Is the full argument that unforgeable names subsume serial nonces available somewhere?

(What's "session-specific"?)

dckc commented 5 years ago

@odeac with the getSeedProxy design, am I limited to sending unary messages to the seed? How would I send a typical message such as seed!("voteFor", "Lincoln", *reject, *resolve)?

dckc commented 5 years ago

The unary limitation is one aspect of an issue I've been asking about since June: a uniform calling convention for rholang.

https://forum.rchain.coop/developer/rholang/ocap-happy-method-dispatch-idioms-in-rholang/#post-252

Monte has a uniform calling interface, which means that any message can be sent to any object, and rejection is always done inside the object’s message-receiving code at runtime. -- monte docs

Monte inherits its uniform calling interface from E, but I'm not sure where that aspect of E was originally documented.

dckc commented 5 years ago

Do we have spread syntax? i.e. for (...msg <- proxy) { seed ! (...msg)}

dckc commented 5 years ago

return ! (proxy) should be return ! (bundle+{proxy}), yes?

dckc commented 5 years ago

@odeac would you please re-open RCHAIN-1048?