-
Notifications
You must be signed in to change notification settings - Fork 117
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
Move blockchain-facing logic to virtualchain #54
Comments
I agree with this in general. Debating if "query blockchain state" should be in virtualchain or not. I was actually thinking of having a package that just has networking interfaces i.e., support to talk to popular bitcoin API providers for UTXOs etc, along with support to talk to bitcoind, even DHT etc. Historically, there was a "coinrpc" package (bad name!) that was merged into pybitcoin and now we're thinking about taking that functionality out and separating it again. Thoughts? |
In other words, the bigger question is that should virtualchain have support for fetching information from a wide variety of sources or should it import some package, let's call it networking-interfaces for now, to fetch that information. One way to think about it is are there other packages that would need to import this networking-interfaces package. |
I think the answer is yes e.g., let's say I'm building a monitoring service and I need to fetch information over the network but I don't need any virtualchain functionality. |
That's fine with me. I'm taking a crack at removing the pybitcoin dependency in virtualchain, and so far I've gotten away with including only a few files from pybitcoin (hash.py, merkle.py, opcodes.py). No need for utxo clients yet, but blockstack-server will need them (maybe those can just go into blockstack-utxo? or blockstack-blockchain-clients? or the like). |
Yeah so blockstack-utxo is already the kind of "networking interface" library I had in mind. How about we rename it to blockstack-rpc or something along those lines? It can be the single repository where we implement all remote API / RPC functionality. Even the client can import this later on. The library only deals with fetching data from a remote endpoint and delivering it to a client and that's it. No other logic needs to be in this package. This can help us get rid of the "basicrpc" dependency as well. What do you think? |
Sounds good. How about renaming it to "blockstack-blockchain-rpc"? It will contain all the UTXO clients, as well equivalent RPC clients for other blockchain services. |
Would there be any other rpc support in it other than blockchains? I was thinking of even merging the blockstack proxy / basicrpc stuff in this. If non-blockchain stuff is also included, then we can have a structure like: blockstack-rpc/blockchains/bitcoin.py and so on |
I was thinking of keeping the low-level blockchain proxies in virtualchain (i.e. proxies that talk directly to blockchain daemons like bitcoind and geth), and putting high-level service proxies (i.e. block explorers) in blockstack-blockchain-rpc. Maybe blockstack-blockchain-services is a better name. To answer your other question, the organization I'm taking with virtualchain is: blockstack-virtualchain/virtualchain/lib/blockchain/bitcoin/... The approach I'd take with blockstack-blockchain-services would be: blockstack-blockchain-services/blockchain-services/blockcypher/... |
Ah got it. Going back to the monitoring service example. Let's say I want to build a service that a) checks the current bitcoind block from a public bitcoin server I'll need to import virtualchain and blockchain-services and some third library (probably blockstack-client) to be able to do this correct? |
In this factoring of the world, yes. I could see our organization going one of two ways. The first is that we group functionality by interface (which is what I'm proposing). We put all the low-level blockchain RPC stuff in one package, and we put all the higher-level RESTful service clients (e.g. UTXO providers) into another package. The other possible organizing principle is to group functionality by blockchain. We'd package all the UTXO service clients along with the Bitcoin blockchain clients, we'd put all the Ethereum service APIs alongside the low-level Ethereum blockchain client, etc. I think this is closer to the way things are with pybitcoin today, and we'd also create a "pyethereum" package to complement pybitcoin. In both universes, the blockstack-client would be a separate package, since it needs to aggregate both multiple blockchains and multiple services anyway (plus it needs to talk to blockstack-server, which is doesn't really fall into either category). |
Elaborating on this a bit more, I think the factor-by-interface approach makes packaging easier than factor-by-blockchain. This is because the blockchain interfaces are lower in the stack, have simple implementations, have less dependencies, and are better maintained in practice. Also, more software needs the blockchain interfaces than the service interfaces. Service interfaces are definitely higher in the stack, and in the limit can be installed on an as-needed basis if packaging gets too hard (i.e. we might eventually forgo an all-services-in-one package in favor of an a-la-carte |
I see the difference between actual RPC vs. higher-level RESTful and why that division can make sense. Question: do you think that virtualchain is going to be a "heavy package" with lots of dependencies or a light package that I can easily install e.g., I just want to talk to bitcoind for whatever reason. If it's going to be a light package then it's fine. I can do
Or something like that. Logically we can think of virtualchain as something that has cross-chain support. |
I'm aiming to make it as light as possible, but no matter what we do it will depend on whatever supporting packages are needed by the blockchain clients themselves. I'm banking on these being small in practice--for example, virtualchain will only depend on |
Sounds good, +1 from my side. We can let others chime in as well. |
Really looking forwards to new changes to pybitcoin/blockstack-virtualchain, I was looking to integrate gridcoin into pybitcoin (https://github.com/grctest/pybitcoin) in order to match several thousand users BOINC CPIDs to alternate crypto accounts/addresses using virtualchain on the Gridcoin blockchain, I'll hold off until blockchain-facing logic has been moved around. Keep up the good work guys, your blockstack tech looks great! 👍 |
Update: |
Hey @jcnelson @muneeb-ali , How is Blockstack getting on moving the blockchain facing logic from here to blockstack-virtualchain? I am very interested in potentially running Blockstack on the Gridcoin blockchain but have been holding off from attempting to do so because the blockchain facing logic was moving about. Cheers guys :) |
You should create an issue on the Virtualchain repo: https://github.com/blockstack/blockstack-virtualchain/issues In general, we are thinking about supporting multiple blockchains. For each blockchain that we support we need to write a "blockchain driver" in virtualchain. Would be great to chat about how you're thinking about writing such a driver for Gridcoin. |
In an effort to better wrangle Blockstack's packages, especially in light of interfacing with multiple blockchains, I propose doing the following:
blockstack-virtualchain would also subsume blockstack-utxo.
The text was updated successfully, but these errors were encountered: