I am learning blockchain technology. I read many tutorials and I got the basic idea of what blockchain is but I am confused with the fact that are there individual separate blockchains for separate DAPPs and the people who are using that DAPP, will only be the part of that DAPP's blockchain and what the blocks in Ethereum blockchain really contain ?
If anyone can clear my novice doubt, that would be very helpful.
Thanks in advance :)
A dApp, which is a decentralized application, may or may not have it's own blockchain. It depends.
For example, there's the Ethereum mainnet, which is public, and anyone can have their dApp interact with it. In this case the dApp doesn't have it's own blockchain.
However, anyone can fork or run their own copy of Ethereum, which in this case, it's a separately owned blockchain instance so it'll have it's down data and blocks not pegged to the public mainnet blockchain.
A DApp is a decentralized Application. This is usually a set made of:
a smart contract (your backend if you like)
some web frontend to interact with it (UI)
A specific smart contract is deployed on one or several chains. It depends what the author decided to do.
Regarding your frontend, you could implement it so it can interact with your smart contract on all the chains you support.
So if your smart contract is deployed on mainnet + testnet for instance, you could write your frontend to support both.
So a given DApp may support multiple chains but an author may also decide to write different Smart Contract + UI depending on the chain it is supposed to run on.
The most basic DAPP you'll write is a (javascript) frontend with a single Smart Contract stored on Ethereum as the backend. A Smart Contract is a Robot Account. It's a regular account WITH code AND storage.
When a transaction hits the Robot Account, the "Ethereum Machine" will start the robot and run its code. Maybe the robot will write to its storage, start other robots, etc. But this is still part of "THE" Blockchain, because it's just a transaction. Slightly more complicated than "move X$ from A to B", but still a simple transaction with a source, target and payload.
There's ONE Blockchain on Ethereum, it's a chain of Block. And a Block is a list of transactions. And a Transaction is a source, target and payload.
Once you start writing more complex DAPPs, maybe Ethereum won't be sufficient anymore. Maybe you need to store large files which is too expensive on Ethereum. That's where you may use other PLATFORMS, that are going to use their own Blockchain.
If you want more implementation details, checkout the Ethereum Yellow Paper:
"The Transaction" is described in section 4.3
"The Block" is described in section 4.4.
Each Smart Contract have their own Merkle Patricia Trie which ressemble a Blockchain but it's more of an implementation detail.
I wrote in more details about how Ethereum Storage works with gas & cost considerations & why you may want to use something else, I hope that can help you.
Related
I am starting to learn about blockchain. After reading about the main concepts composing a blockchain network, I have some doubts that I am not able to solve despite performing many searches on the internet.
On the one hand, it is clear that transactions are grouped into blocks and the miner node that solve the consensus algorithm is the one putting the block in the distributed ledger. However, I have read that Ethereum (usually used for cryptocurrency with Ether) could be used as blockchain platform for different applications such as food traceability, assets management, etc. In this case, all these applications are using the same distributed ledger, i mean, the Ethereum distribution ledger can store different kinds of blocks, i.e. blocks from a food traceability application, from the assets management one or those derived from cryptocurrency?
On the other hand, I understand the role of smart contracts but it is not too clear for me which is the difference among the consensus and contract layer and when smart contracts are needed.
Could you help me with these doubts?
Thank you in advance for your help
Can the Ethereum distribution ledger store different kinds of blocks, i.e. blocks from a food traceability application, from the assets management one, or those derived from cryptocurrency?
Food traceability, assets management, cryptocurrency, whatever the use case or name you provide at the marketing layer will have no effect on the stored data in a smart contract that runs on EVM. For example, if you use postgresql as your backend database for your next food delivery or asset management app does that changes how postgresql stores data in blocks, it's internal data representation, its indexing mechanism, or its query interface?
When smart contracts are needed?
The need for smart contracts is to provide permanent, transparent logic in a programming language like solidity, vyper which gets converted to bytecode, and only that bytecode is deployed in the network (Internally, it's just a transaction sent to zero address). In return, you get the contract's address to interact with the contract's ABI and you do have that permanently with its state.
Additionally, the consensus layer will be handled by eth-node implementation so don't worry about it. You may have a look at layer 2 scaling in later phases.
More reading should help:
Mastering Ethereum
Ethereum Yellow Paper
Recently I have been working on a class project. I have built a Supply chain Dapp, that was based on truffle framework and ganache as a local blockchain. I have some issues regarding the concepts of private Ethreum blockchain.
My question is, is it possible to build a real-world private Ethereum blockchain for a specific organization without any transaction fees and what other costs should I be aware of? And the second question is do I need to deploy my Dapp on Rinkeby? It's just that I read somewhere that you should deploy your dapp to testnets like Rinkeby to demonstrate that it functions well in a setting more like to the Ethereum mainnet.
Since I just used ganache for the dapp, I wanted to be certain
I found some answers online but they were not satisfactory, it would be greatly appreciated and helpful if you could provide me with some directions on the subject, as I am relatively new to this. Thank you.
Yes you can. These are generally called permissioned chains. While you incur compute cost, your org or anyone given permission to use the chain doesn't pay for gas.
There is still a gas price, it is essentially useless since as the authority on the chain you can mint infinite gas. Such chains usually have PoA (proof-of-authority consensus).
You can use these clients to build such chains:
GoQuorum - geth fork which lags in upstream updates by a few months. Has lots of consensus algo options like QBFT/Raft. Additionally ships with privacy tx manager. Application level permissioning.
OpenEthereum (Deprecated) - My personal favorite. I have worked with this client extensively and wrote a public humanitarian chain spec with it (https://github.com/grassrootseconomics/kitabu-chain). Uses AuRA consensus. Well documented.
Nethermind - Supports AuRa consensus. Haven't used it, but should have more features than OpenEtherem.
Geth - Supports Clique. I am not a fan of clique consensus but it can work well.
I have documented some PoA consensus comparisons here. You might find it useful.
My question is, is it possible to build a real-world private Ethereum blockchain for a specific organization without any transaction fees and what other costs should I be aware of?
No, because each transaction will consume CPU, IO and network bandwidth. These must be measured and the transaction stopped, or otherwise, one malicious transaction can halt the whole network by consuming all the resources. Thus, at least an internal unit of accounting is needed.
And the second question is do I need to deploy my Dapp on Rinkeby?
Why would you do that? Please read xyproblem.info on how to ask more understandable questions.
I understand from your question that you built a Dapp and tested it using Ganache and Truffle frameworks. However, you wish to test your application on a testnet similar to rinkeby.
It appears that there are certain projects which allow you to create a mainnet fork. You just need to provide them with the infura URL of the mainnet, and they will spin up your local Ethereum mainnet fork. This enables you to test your dapp under mainnet conditions. Additionally, you may assign as many tokens as you wish to your address.
Here is a link to a repository that can perform this task.
https://github.com/yearn/yearn-mainnet-fork
To deploy your contract on the local blockchain instance, you will simply need to use the RPC URL provided by this repository.
Yes, you can indeed.
Both GoQuorum and Besu allow you to create a completely gas-free network.
https://consensys.net/docs/goquorum/en/latest/concepts/free-gas-network/?h=gas
I'm documenting in this blockchain world. Basically I would like to make some web application in which a user decides to make a donation, and would like to see who made the donation and to which entity. I have several doubts, the first one:
1-Is it possible to use blockchain using javascript? (can smartcontracts be done in javascript?)
2- If the donation is made using blockchain, is it necessary to use a cryptocurrency? or you can use real money and make the transaction (using some means like paypal)
3- Can real money be transferred by some means such as paypal using blockchain?
Thank you very much, your answers will document me much more
Is it possible to use blockchain using javascript? (can smartcontracts be done in javascript?)
Every blockchain has a SDK, the part of the software which lets you
interact with the real blockchain( A decentralise ledger). There
are generally two parts in the Blockchain , One is client and one
is processor.
As you must have guessed, Client is the one who sends the transaction,
This transaction must satisfy certain rules in order to be accepted by
the transaction processor. If the transaction gets validated by
transaction processor, The transaction will be added to the block alongwith
other transactions and this block will then be added to the blockchain.
Copied to all other nodes (Forks are a different story)
Generally Most blockchains lets you interact with the blockchain through
ABCI which is just an interface to convert your transaction into
a format understandable by the blockchain processor.
Some blockchains has their fixed transaction processing logic like Ethereum for
security and some lets you write your own transaction processing logic like
Sawtooth, Fabric etc.
Permissioned and some public blockchains like Hyperledger projects and
cosmos SDK lets you write your own application layer logic for Blockchain,
So yes, You can write those transactions in Javascript or any other programming
language, as long as it satisfies the interface.
Public blockchain deals with tokens having real worth. Their transaction logic
is already fixed, but some of them does provide javascript API's like NEO
(Not sure about that)
2- If the donation is made using blockchain, is it necessary to use a cryptocurrency? or you can use real money and make the transaction (using some means like paypal)
You can do that and put the donation receipt on Blockchain linked with
real identities of people. This way if anybody wants to check who pays
how much donation, They can query blockchain for the user address.
3- Can real money be transferred by some means such as paypal using blockchain?
This can also be done, but this will involve using a crypt exchange,
centralised or decentralise. You can convert the real money into crypto
of your choice at one end and vice versa at the other hand.
Note: This is based on my limited knowledge of Cryptocurrencies. Please consult more people or any professional company before acting on this advice.
I don't think any protocols offer the possibility to implement their smart contracts in Java Script, but you can build a translator between the two languages which could potentially benefit others in the open source community.
So you want have some engineers do some work for you, in this case build an web application. There are several ways you can get this done, here are some ideas:
a) issue tokens which pays profits based on the success of your new business, you might be able to do this on a protocol that is not tied to any specific crypto or fiat currency.
The users can use an exchange to convert your tokens to their favorite one.
b) approach a private equity or VC fund and get them to pay for it.
c) forget about blockchain, and just pay for the project to your favorite engineers.
I just got chance to work on Ethereum, block-chain based platform. But I don't have a clear idea in which scenarios this is used, any real life use of this.Could anybody help me understand blockchain based platform and its real life uses?
Welcome to blockchain world.Don't get demotivated, Blockchain area is relatively new & hard to find good tutorials.I also started learning blockchain related technologies a month ago & I would like to share some ideas about Blockchain & Ethereum.Since your question is not directly related to Nodejs & Javascript,I would like to suggest you modify the question first.
We all start as noobs, but we can choose to end as noobs or as professionals.
Original cartoon can be found at http://ericsammons.com/what-is-the-blockchain/
Blockchain, a secure distributed ledger (data structure or database) that maintains a continuously growing list of ordered records, called “blocks.”Please watch this youtube video - Blockchain 101 - A Visual Demo to understand the basics of Blockchain.
That is a very basic visual introduction to the concepts behind a blockchain. He introduces the idea of an immutable ledger using an interactive web demo. If you are interested in playing with this on your own, it is available online at:https://github.com/anders94/blockchain-demo
Blockchain was originally developed as the technology behind cryptocurrencies like Bitcoin. A vast, globally distributed ledger running on millions of devices, it is capable of recording anything of value. Money, equities, bonds, titles, deeds, contracts, and virtually all other kinds of assets can be moved and stored securely, privately, and from peer to peer, because trust is established not by powerful intermediaries like banks and governments, but by network consensus, cryptography, collaboration, and clever code.You can learn more about Blockchain use cases from this TED talk.
Ethereum, a type of blockchain that can be used to develop decentralized applications & several banks have already adapted Ethereum to develop and test blockchain trading applications. The Ethereum blockchain was developed by a Canadian named Vitalik Buterin and this blockchain has some extraordinary capabilities. One of them is that you can build smart contracts. It's kind of what it sounds like. It's a contract that self-executes, and the contract handles the enforcement, the management, performance and payment — the contract kind of has a bank account, too, in a sense — of agreements between people.Also, JPMorgan Chase & Co, Microsoft, Intel, and more than two dozen other companies have teamed up to develop standards and technology to make it easier for enterprises to Ethereum.
Since you are using NodeJs, use Truffle to connect your Ethereum blockchain network.Truffle is a development environment, testing framework and asset pipeline for Ethereum, aiming to make life as an Ethereum developer easier. With Truffle, you get:
Built-in smart contract compilation, linking, deployment and binary management.
Automated contract testing with Mocha and Chai.
Configurable build pipeline with support for custom build processes.
Scriptable deployment & migrations framework.
Network management for deploying to many public & private networks.
Interactive console for direct contract communication.
Instant rebuilding of assets during development.
External script runner that executes scripts within a Truffle environment.
You can find a great sample project here:https://github.com/tomw1808/truffle_eth_class1
You can find really good courses on Building A Decentralised Blockchain Application in Udemy.Please message me,if you need any further information.
One example of using blockchain is Bitcoin.
The bitcoin network is a peer-to-peer payment network that operates on a cryptographic protocol. Users send and receive bitcoins, the units of currency, by broadcasting digitally signed messages to the network using bitcoin wallet software. Transactions are recorded into a distributed, replicated public database known as the blockchain, with consensus achieved by a proof-of-work system called "mining". The protocol was designed in 2008 and released in 2009 as open source software by "Satoshi Nakamoto", the name or pseudonym of the original developer/developer group. [emphasis added]
See:
https://en.wikipedia.org/wiki/Blockchain
https://en.wikipedia.org/wiki/Bitcoin_network
Node modules that can help you with developing your app:
https://www.npmjs.com/package/blockchain
https://www.npmjs.com/package/bcoin
I understand that the BigChainDB is a distributed DB at the basic level.
It claims that is solves the problem of Scalability in the BlockChain world. What i don't understand is that how it fits into the overall block chain architecture.
In the typical Block Chain world, each node has the full copy of the
data and validates any new transactions? How does this work in the
BigChain DB when the data is distributed? Each node validates only the
blocks that it holds? Even if thats the case, it needs the entire
chain? Not clear on the processing scalability here.
Can i build a block chain network just with the BigChainDB or do i
need something like Ethereum or Hyperledger to build the block chain
network itself?
If i can build the blockchain network with BigChainDB, then what is
the equivalent of smart contract in BigChainDB?
BigchainDB internally uses RethinkDB as a datastore. Technically, the blockchain is stored as JSON strings inside RethinkDB. And BigchainDB is a kind of wrapper on top of this storage which provides the needed cryptography, techniques for building the blocks, parsing the blocks and provides utility methods to access the database. RethinkDB provides clustered storage with possible shard based architecture. This makes BigchainDB scalable when RethinkDB is configured accordingly.
Yes. It is possible to build a blockchain network just with BigchainDB.
BigchainDB library provides APIs to be called from our code. So we can build any application(preferably in Python) and integrate BigchainDB into it. This means, the business logic stays inside our application code. This is totally different from Smart contracts used in Ethereum.
You can have a look at my github code for more insights. It is my college project and not much documentation is available :-D It is a voucher transfer application where company like Sodexo issue vouchers and users can redeem it in private companies like Starbucks.