For shared immutable key-value and time series databases
Today we’re proud to release the latest version of MultiChain, which implements a crucial new set of functionality called “streams”. Streams provide a natural abstraction for blockchain use cases which focus on general data retrieval, timestamping and archiving, rather than the transfer of assets between participants. Streams can be used to implement three different types of databases on a chain:
- A key-value database or document store, in the style of NoSQL.
- A time series database, which focuses on the ordering of entries.
- An identity-driven database where entries are classified according to their author.
These can be considered as the ‘what’, ‘when’ and ‘who’ of a shared database.
Any number of streams can be created in a MultiChain blockchain, and each stream acts as an independent append-only collection of items. Each item in a stream has the following characteristics:
- One or more publishers who have digitally signed that item.
- An optional key for convenient later retrieval.
- Some data, which can range from a small piece of text to many megabytes of raw binary.
- A timestamp, which is taken from the header of the block in which the item is confirmed.
Behind the scenes, each item in a stream is represented by a blockchain transaction, but developers can read and write streams with no awareness of this underlying mechanism. (More advanced users can use raw transactions to write to multiple streams, issue or transfer assets and/or assign permissions in a single atomic transaction.)
Streams integrate with MultiChain’s permissions system in a number of ways. First, streams can only be created by those who have permission to do so, in the same way that assets can only be issued by certain addresses. When a stream is created, it is open or closed. Open streams are writeable by anybody who has permission to send a blockchain transaction, while closed streams are restricted to a changeable list of permitted addresses. In the latter case, each stream has one or more administrators who can change those write permissions over time.
Each blockchain has an optional ‘root’ stream, which is defined in its parameters and exists from the moment the chain is created. This enables a blockchain to be used immediately for storing and retrieving data, without waiting for a stream to be explicitly created.
As I’ve discussed previously, confidentiality is the biggest challenge in a large number of blockchain use cases. This is because each node in a blockchain sees a full copy of the entire chain’s contents. Streams provide a natural way to support encrypted data on a blockchain, as follows:
- One stream is used by participants to distribute their public keys for any public-key cryptography scheme.
- A second stream is used to publish data, where each piece of data is encrypted using symmetric cryptography with a unique key.
- A third stream provides data access. For each participant who should see a piece of data, a stream entry is created which contains that data’s secret key, encrypted using that participant’s public key.
This provides an efficient way to archive data on a blockchain, while making it visible only to certain participants.
Retrieving from streams
The core value of streams is in indexing and retrieval. Each node can choose which streams to subscribe to, with the blockchain guaranteeing that all nodes which subscribe to a particular stream will see the same items within. (A node can also be configured to automatically subscribe to every new stream created.)
If a node is subscribed to a stream, information can be retrieved from that stream in a number of ways:
- Retrieving items from the stream in order.
- Retrieving items with a particular key.
- Retrieving items signed by a particular publisher.
- Listing the keys used in a stream, with item counts for each key.
- Listing the publishers in a stream, with item counts.
As mentioned at the start, these methods of retrieval allow streams to be used for key-value databases, time series databases and identity-driven databases. All retrieval APIs offer start and count parameters, allowing subsections of long lists to be efficiently retrieved (like a LIMIT clause in SQL). Negative values for start allow the most recent items to be retrieved.
Streams can contain multiple items with the same key, and this naturally solves the tension between blockchain immutability and the need to update a database. Each effective database ‘entry’ should be assigned a unique key in your application, with each update to that entry represented by a new stream item with its key. MultiChain’s stream retrieval APIs can then be used to: (a) retrieve the first or last version of a given entry, (b) retrieve a full version history for an entry, (c) retrieve information about multiple entries, including the first and last versions of each.
Note that because of a blockchain’s peer-to-peer architecture, items in a stream may arrive at different nodes in different orders, and MultiChain allows items to be retrieved before they are ‘confirmed’ in a block. As a result, all retrieval APIs offer a choice between global (the default) or local ordering. Global ordering guarantees that, once the chain has reached consensus, all nodes receive the same responses from the same API calls. Local ordering guarantees that, for any particular node, the ordering of a stream’s items will never change between API calls. Each application can make the appropriate choice for its needs.
Streams and the MultiChain roadmap
With the release of streams, we’ve completed the last major piece of work for MultiChain 1.0, and are now firmly on the path to beta. We expect to spend the next few months expanding our internal test suite (already quite large!), finishing the Windows and Mac ports, adding some more useful APIs, updating the Explorer for streams, tweaking aspects of the consensus mechanism, releasing our web demo, and generally tidying up code and help messages. Most importantly, we’ll continue to fix any bugs as soon as they’re discovered, so that our mistakes don’t interrupt your work.
In the longer term, where do streams fit into the MultiChain roadmap? Taking a step back, MultiChain now offers three areas of high-level functionality:
- Permissions to control who can connect, transact, create assets/streams, mine/validate and administrate.
- Assets including issuance, reissuance, transfer, atomic exchange, escrow and destruction.
- Streams with APIs for creating streams, writing, subscribing, indexing and retrieving.
After the release of MultiChain 1.0 (and a premium version), what’s next in this list? If you look at the API command which is used to create streams, you’ll notice an apparently superfluous parameter, with a fixed value of
stream. This parameter will allow MultiChain to support other types of high-level entity in future.
Possible future values for the parameter include
evm (for an Ethereum-compatible virtual machine),
sql (for an SQL-style database) or even
wiki (for collaboratively edited text). Any shared entity whose state is determined by an ordered series of changes is a potential candidate. Each such entity will need: (a) APIs which provide the right abstraction for updating its state, (b) appropriate mechanisms for subscribed nodes to track that state, and (c) APIs for efficiently retrieving part or all of the state. We’re waiting to learn which other high-level entities would be most useful, to be implemented by us or by third parties via a plug-in architecture.
What about smart contracts?
In a general sense, MultiChain takes the approach in which data is embedded immutably in a blockchain, but the code for interpreting that data is in the node or application layer. This is deliberately different from the “smart contracts” paradigm, as exemplified by Ethereum, in which code is embedded in the blockchain and runs in a virtual machine. In theory, because smart contracts are Turing complete, they can reproduce the behavior of MultiChain or any other blockchain platform. In practice, however, Ethereum-style smart contracts have many painful shortcomings:
- Every node has to perform every computation, whether it’s of interest or not. By contrast, in MultiChain each node decides which streams to subscribe to, and can ignore the data contained by others.
- The virtual machine used for smart contracts has drastically worse performance than code which has been natively compiled for a given computer architecture.
- Smart contract code is immutably embedded in a chain, preventing features from being added and bugs from being fixed. This was demonstrated forcefully in the demise of The DAO.
- Transactions sent to a smart contract cannot update a blockchain’s state until their final ordering is known, because of the nature of general purpose computation. This leads to delays (until a transaction is confirmed in a block) as well as possible reversals (in the event of a fork in the chain). By contrast, MultiChain can treat each type of unconfirmed transaction in the appropriate way: (a) incoming assets immediately update a node’s unconfirmed balance, (b) incoming stream items are instantly available, with their global ordering subsequently finalized, (c) permissions changes are applied immediately and then replayed in incoming blocks.
Nonetheless, as I’ve said before, we’re certainly not ruling out smart contracts as a useful paradigm for blockchain applications, if and when we see strong use cases. However, in MultiChain smart contracts would be implemented in a stream-like layer on top of the blockchain, rather than the lowest transaction level. This will preserve MultiChain’s superior performance for simpler blockchain entities like assets and streams, while offering slower on-chain computation where it’s really needed. But there are fewer such cases than you might think.
Please post any comments on LinkedIn.
All commands related to streams are documented in full in the MultiChain API page, but here is a brief summary:
- Create a stream using
createfrom ... stream
- Add an item to a stream with
- Retrieve a list of streams using
- Start or stop tracking a stream with
- Retrieve stream items using
- List stream keys and publishers with
- For large stream items, retrieve the full data using
- Control per-stream permissions with calls like
grant [address] stream1.write
- View a stream’s permissions using
Some other developer notes relating to streams:
createpermission allows an address to create streams.
- Relevant per-stream permissions are
- New blockchain parameters:
root-stream-name(leave empty for none),
- New runtime parameters:
autosubscribeto automatically subscribe to new streams created and
maxshowndatato limit the amount of data in API responses (see
- The maximum size of a stream item’s data is fixed by the
max-std-op-return-sizeblockchain parameter, as well as the smaller of the
max-std-tx-sizevalues minus a few hundred bytes.
- Nodes using the old wallet format cannot subscribe to streams, and should be upgraded.
Fidelity’s Crypto Subsidiary Targets Asian Investors To Buy Bitcoin
- Fidelity Digital Asset Services (FDAS) has partnered with Stack Funds to enable Asian investors to purchase and store cryptocurrency assets more freely and securely.
- Based in Singapore, Stack Funds is a regulated fund manager focusing on Bitcoin and other digital assets.
- According to the Bloomberg report, Stack Funds will make Fidelity’s secure custody services available to its clients, primarily based in Asia. The company outlined that the Asian market has been continuously growing in demand towards the cryptocurrency industry, especially from high-net-worth investors and family offices.
- Stack further explained that all assets under its management will be audited monthly. The firm will provide insurance coverage, weekly contributions, and redemptions to enhance capital security.
- Stack’s co-founder, Michael Collett, said that Fidelity’s involvement will enable its company to attract even more investors from the region.
- On the other hand, Christopher Tyrer, head of Fidelity Digital Assets Europe, believes that “there’s a critical need for platforms which have a deep understanding of what local and regional investors are looking for.” However, he admitted that the digital asset space has “historically lacked” such platforms.
- After its success in the US, Fidelity Digital Assets expanded its cryptocurrency services to Europe last year. The company aims at entering the Asian market as well now with the Stack Funds partnership.
Hacked? Crypto Lending Platform Cred Suspends Deposits And Withdrawals While Cooperating With Authorities
The popular cryptocurrency lending service Cred has announced that it has temporarily suspended all funds inflows and outflows. Without disclosing many details, the platform said it’s cooperating with law enforcement authorities to investigate an incident.
Cred Suspends Deposits And Withdrawals
The United States-based crypto lending platform, which recently announced joining Visa’s fast track program, updated its customers on Twitter regarding the latest troubling developments with a brief message.
“Unfortunately, we are unable to comment further at this time, but we will undertake to provide an update within the next two weeks. During this period, all inflows and outflows of funds will be suspended.” – read the statement.
Staying true to its fashion, the cryptocurrency community lashed out at Cred and its lack of details about what’s going on. This reaction prompted the lending protocol to comment once again. Firstly, Cred apologized for the concerns and inconveniences it has caused while it’s assessing the “business impact connected with a recent fraudulent incident.”
Furthermore, the post explained that Cred is currently cooperating with law enforcement authorities. However, it provided some reassurances claiming that “no client personal data or account information was compromised.”
It’s worth noting that Cred’s website reads that the platform works with “trusted security and insurance providers Fireblocks and Lockton to ensure that our customers’ digital assets have enterprise-grade security.” Nevertheless, several community members have questioned the state of their holdings on the platform, as they weren’t satisfied with Cred’s brief updates.
A Dissolved Partnership Saw This Coming?
Although it’s still unconfirmed if the so-called “incident” is indeed a hack, it seems that the issues have been transpiring for a while now. Days before Cred suspended deposits and withdrawals, one of its partners ended its relationship with the lending protocol.
The cryptocurrency wallet and trading platform, Uphold, announced on Sunday that users could no longer link their Uphold wallets to the third-party crypto lending provider Cred.
At the time of this writing, neither Uphold nor Cred have disclosed why their partnership agreement ended.
Renowned Indian-American Author Deepak Chopra May Buy Bitcoin
Deepak Chopra’s name is synonymous with meditation, mindfulness, and healing through healthy living. And according to the latest update, the world-renowned author and thought-leader is considering buying bitcoin. Mr. Chopra is also about to launch ‘Love in Action,’ his own blockchain-based token.
Deepak Chopra Officially Enters The Blockchain Space
It is important to note that Mr.Chopra had already stoked the ire of Ethereum bigwigs more than 2 years ago for being announced as a speaker at the Ethereal conference in New York in 2018. Vitalik Buterin himself blasted him as a ‘fraud’ publicly on Twitter. Nonetheless, the talk went well, as per Mr. Chopra.
Fast forward to 2020, the globally revered public speaker has announced his plans to officially launch his own token. Termed ‘Love in Action,’ its launch will coincide with Suicide Prevention Week. In the words of the Chopra Foundation, the token is a “worldwide campaign to heal the world.”
When the ex-United States (FDIC) regulator turned blockchain regulation commentator Jason Bretts tapped Chopra for technical details about the token, the latter said:
We are currently working on our strategic roadmap for the ‘Love In Action’ token. Our goal is to leverage the ‘proof of state/work’ on the Hedera platform to incentivize healthy behaviors and promote wellbeing via the token. We will initially leverage hbar as the currency and convert to our own coin in the latter part of 2021.
Mr.Chopra Also Considers Buying Bitcoin
Taking cues from Mr.Chopra’s famous interview with Oprah Winfrey, Jason marveled at the idea of Deepak sending some bitcoin to the popular celebrity talk show host. He contemplated mass adoption being sparked by that one event alone, recalling his prime goal to convince the meditation guru to buy BTC.
When the Value Technology Foundation President finally asked Mr. Chopra about his bitcoin holdings, the latter replied:
I have not bought any Bitcoin to date, but have been keen on cryptocurrency and how it can be used.
The mind-body healing practitioner also said that he doesn’t own any hbars, the native token of the blockchain protocol, which will power his own DLT project.
Brett, in his article, notes that it is not necessarily for everyone to buy bitcoin or any other cryptocurrency for that matter. It can also be just about leveraging the underlying technology for social good, which in Mr. Chopra’s case, involves improving people’s mental well-being.
Lastly, the ex-ConsenSys Policy Ambassador appreciated Mr. Chopra’s efforts at utilizing blockchain to help people live better. He said:
To the degree blockchain can be used by mental health professionals – or any professional – to help validate the truth of a person’s certification or to validate a person’s well-being seems like an excellent use of it.
Featured image courtesy of CNBC
Blockchain1 month ago
Bitcoin price volatility expected as 47% of BTC options expire next Friday
Blockchain2 months ago
Market Wrap: Bitcoin’s Powell-Induced Price Swing; Ethereum Still High on Gas
Blockchain1 month ago
Bitcoin Bouncing From Bull Market Support Points To 2021 As The Year Of Crypto
Blockchain2 months ago
Blockchain Bites: Is DeFi an Inside Deal?
Blockchain1 month ago
Ethereum: Is the HODLing in yet?
Blockchain1 month ago
Hackers Have Been Trying To Crack Bitcoin Wallet Worth $750 Million But Here’s The Catch
Blockchain1 month ago
YFI Founder Puts Himself Forward for Uniswap (UNI) Delegation Duties
Blockchain3 months ago
Wealthfront Lures Millenials With Crypto Memes and Tactics