Is Cosmos also a general Smart Contract platform?

I’m sort of confused. Can Cosmos host its own smart contracts independent of other blockchains or is it mostly a tool for interblockchain comms?

Yes. The difference is the following:
With Ethereum or some other examples, the blockchain is a virtual machine, which computes the smart contracts, that are written in a specific language. For Ethereum this language is solidity, which emerged from Javascript. For Cosmos you have a blockchain, which is not a virtual machine, but rather a database, which can be queried. So you can decide on any programming language to use. It doesn’t matter, as long as your program, which talks to the blockchain, is able to replicate the correct state. This means that you can check transactions for validity and send valid transactions. Comparing to the world of web development, Cosmos or Tendermint introduces something like MongoDB, where different applications can talk to each other, even if they do not share the same data structures. All they need to do is having the same interface. For web development this is called REST API (among others), for Cosmos/Tendermint this is called ABCI.

You ask if Cosmos can host its own smart contracts independently, yes not only that, it can also replicate the state of other blockchains, but it does not need to. This allows to have many blockchains connected and still do independent things. This also outlines how Cosmos is able to scale horizontally, because you can create subchains, stuff like Lightning in the world of bitcoin, without any protocol changes or whatever. Spawning subchains is intrinsically built in.

5 Likes

Would you be able to use something like C++ in Cosmos as well? Also, what would be the performance of running a “normal” program via Cosmos? Let’s say you were running a social network like Twitter (and assuming we found a solution for data storage).

Been reading about EOS WASM - is that concept meaningful here? Does Cosmos have a similar concept?

Well, the easy answer is “sure, of course”. You can use any language, as long as it is able to talk to ABCI. You can also use Web Assembly if you want. But you are referring to Cosmos here, which is not built to do such things. Cosmos is designed to connect many blockchains and regarding CAP-Theorem favors consistency over availability. For such services like Twitter availability is very important, still this is not the main issue. The main issue is fees. For every transaction fees must be paid. The same is true for EOS. So if you want to build a “normal” program with a blockchain, I don’t think it makes sense to charge new users fees, in a currency they don’t have.
In my opinion programs like Twitter will never be realized in Cosmos. A different story is tendermint, I think it makes sense to realize such things in tendermint and connect it to Cosmos. It will be a different blockchain, allowing for special transactions without fees, but it can (and therefore will be) connected to Cosmos. This is the reason why Cosmos or better say tendermint scales horizontally - you can create blockchains on the same technology and connect it to Cosmos, still able to do payment-crucial things in Cosmos, but normal transactions in your own specifically designed economy.

Finally some words on transaction throughput:
The problem of programs running on blockchains regarding speed is not the language it is implemented in. The bottleneck is not that you use some Javascript instead of C++, the bottleneck is that all nodes/validators need to be synchronized and all clients need that information to continue. The bottleneck is this process of synchronization. So if some EOS advocate tells you, that 50.000 tx per second are achieved on a single computer, this is not a good measure of performance. In a real run computers must be synchronized that are on opposite sites of the globe, where physically pings cannot be below 100 ms, so block intervals of (much) less than 1s are not possible. That way you have to put all say 50k transactions into one block, blocks are always synchron, so all nodes must synchronize. If you want to process a lot of data like facebook or twitter, this is just impossible. You cannot scale this vertically. It gets even worse if you want to have multiple applications in one blockchain, which is the case for the current implementation of Ethereum. One solution is to let go of synchron blocks, like IOTA. Another solution is to split these applications into different blockchains or even different layers of one application into different chains. In your twitter example, one chain for the user management, another chain for the messenges. The latter can be faster but most not be as consistent as the former. What you need then is a way to connect these blockchains, which is the solution Cosmos offers.

5 Likes

Hi Prawda - how can I get in touch with you?

1 Like

You can always shoot us an email to partners@tendermint.com!

Thanks Jack! Quick one, do you know if it’s possible to use Plasma Cash with Ethermint to create an Ethereum sidechain?

Are there any good tutorials and smart contract recommended security guidelines to follow. any such info pointers would help