-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repackage for NPM #19
Comments
It looks like your list above can be broken down into a few classes.
Just my thoughts. |
The gRPC interface provides the functions 'createBlock' and 'addBlock', which are almost always going to be called by the dApp developer after they execute a smart contract, so I provide a way to have them called internally to the function call, as parameters in the function calls: 'commit_block' and 'send_block_to_peers' respectively.
|
I don't like the name
|
@JoshOrndorff writes:
I think the package name deserves its own issue: #22 Hashing out the rest of the API design here is fine with me, for the most part... Let's stick to ocap discipline, please; that is: this call...
needs another argument for access to the network:
IOU a section for CONTRIBUTING.md. Also, combining
-- https://nodejs.org/api/http.html We could put |
Why involve
It's computable locally, without communicating with the node. Also, why pass the hash algorithm in as a name? Why not just separate functions? Are there any uses for hashing without caring what the algorithm is? So how about just: |
What is |
I'm starting to lean toward separate issues for hashing and key storage.
Is there some reason to change from the current API?
|
#23 . We do currently take
@crypto-coder If you wan to discuss this stuff more, please do open an issue. You're working on the most advanced use case so far, so let us know your thoughts. OTOH, if you're convinced, we can just let that convo die. |
Rholang can perform hashing, but it only hashes byte arrays. In my coin-faucet project, I was creating a 'race' where I would store a coin in an account identified by a salted hash (keccak256). The first user to send a transaction with the correct salt would receive the coin. The data being hashed is the name of the coin concatenated with a salt. Everytime I ran the "keccak256Hash" function inside Rholang, I would get something different than what I computed in node.js, off-chain. The keccak256Hash function in Rholang wants a byte array, so I wrote the byte array to stdout, and found that it is prepending 4 bytes in front of my concatenated text. I still don't know how to correctly compute those initial 4 bytes, but when I figure it out, I feel that we should have a function that other dApp devs can use to compute sha256, keccak256, and blake2b256 off-chain, the way that Rholang internally will compute them. The alternative (addition?) would be to amend the Rholang tutorial to describe how to compute matching hashes off-chain that include the prepended 4 bytes.
We could do a single overloaded function, or different named functions. Ultimately, I think the steps involved in generating a hash will largely be the same for all algorithms. No preference either way.
These are the 3 hashing algorithms provided natively inside Rholang. |
Not sure how to get access to RNode's keystore, but if that is a thing (by any means necessary), then that is definitely what I would want to do with these functions. Otherwise, this is a convenience feature that will do many of the same things that RSign provides, but for backend applications. This keystore is a totally contrived file of aliased pub-priv key pairs. Password-protected even. These keys are used for signing transactions. Specifically, a backend system that is acting as an automated oracle would need a way to load keys on demand. Eventually, this keystore idea will need to be a proper RChain wallet / HSM, so these functions will definitely change. For today, this is just a simple, dirty solution. |
Created a new issue for key management / signing #26 |
I bet that's protobuf encoding. the rholang string: rtest({
data: 'Bob',
rholang: '"Bob"',
hex: '2a051a03426f62',
rho: { exprs: [{ g_string: 'Bob', expr_instance: 'g_string' }] },
}), -- https://github.com/JoshOrndorff/RChain-API/blob/master/test/testRHOCore.js#L14-L19 The inital 4 bytes tell us that this par consists of one So it's not the hashing function that prepends bytes. It's the business of serializing a process. So if you want to hash "Bob", i.e. hex |
@crypto-coder says:
I've seen a lot of people around the community including myself trip on this encoding thing. I agree the protobuf encoding makes good sense in hindsight, but making it visible is like throwing obstacles in the path to success. Consider this developer story.
Ideally the answer is something like call I agree that it shouldn't be a method on the node instance. |
Do ethereum and bitcoins have norms for hashing things beyond byte
sequences?
Text encoding can be really tricky:
http://intertwingly.net/blog/2008/12/09/Just-use-Unicode
|
Yeah, I guess I don't know about that. Maybe compatibility with ethereum is a different conversation. But do you agree, @dckc, that the developer I described above shouldn't have to see protobuf to make a hash that will verify on-chain? A helper function that is not a method on the node seems like the right solution to me. @cryptocoder? |
This issue was moved to rchain/rchain-api#5 |
Need to reorganize RChain-API for NPM. Package name would be "rchain.js".
Installation using NPM: npm install --save rchain
Inclusion in Node.js: const { RNode, RCore } = require('rchain');
Inclusion in Typescript: import { RNode, RCore } from 'rchain';
Initial function set would include:
The text was updated successfully, but these errors were encountered: