Convert Web App to Dapp for Blockchain Implementation - blockchain

I have my web-application which is in Angular2(Front end) and Rails(back end- API), now I want to implement Blckchain to this application, so needs to make it Dapp.
Here while making the Dapp, do I need to remove the Rails Back-end and convert the business login into the smart-contracts(Ethereum)?
Do I need to require to choose the cloud storage platform like Storj, Decent for storing the data?
Please share any online material/blogs which can help me into this.
EDIT
This application is having more than 50 API's, so should I have to write the 50+ smart contract for each API? that means I need to remove the all Rails API code.

Ethereum Smart contracts don't have logins…
Here is one of the best resources I can give you:
what you want to do first is to understand how the smart contracts work from here:
https://medium.com/coinmonks/ethereum-smart-contract-development-with-a-web-app-part-1-develop-the-smart-contract-ee2a7c735936
then you need to understand how to store data on the Ethereum blockchain:
https://medium.com/#ConsenSys/an-introduction-to-ipfs-9bba4860abd0
Then last you can learn more about the DApps:
https://github.com/ethereum/wiki/wiki/Decentralized-apps-(dapps)
https://www.udemy.com/ethereum-dapp/

Related

Is it possible to query the Blockchain API to get information on currency exchanges?

Coinbase stopped publishing it's user stats in 2017, so I haven't been able to find a way to see how many users currently use the exchange.
My (albeing limited) understanding is I should be able to work this information out from querying the Blockchain.
Is this possible?
I'am not sure about Ccinbase, but i know that a lot of exchanges creates completely different wallets(addresses) for each user, so its impossible to track them. You can do it for decentralized exchanges as Idex/Bancor/0x etc, because they are using specific smart-contract(only in Ethereum network)

can't find the right architecture for my crowdfunding cordapp

I am a computer science engineering student. I am working on a crowdfunding cordapp, but I still have some confusions :
I want to know if Corda is the most suitable protocol to use in a crowdfunding app or if there is better solutions ?
Is it logical that every person who wants to contribute in a project or to add a project on the platform is mandatory to run a corda network and have his own node ?
If it's not how could i handle the users accounts and their transactions ??
The next point is that I can’t figure out the right architecture of the app.
If anyone can clarify these points I would be grateful
I dont know about Corda, but I made the crowdfunding app using Truffle framework. Truffle is one of the best framework for developing Smart Contract and Distributted application. The framework allows you to run in memory blockchain too for the testing.
Regarding the Crowdfunding app I created all the business logic in the Smart Contract and handle the authentication through the meta mask plugin. The user has to have metamask which ease the transaction too. So every transaction which add the data in blockchain goes through the MetaMask. Whereas I store the etherum address of the user in the array and relevant data in the structure.
For the frontend part I used the angularJs to create the Distributted application. The app interact with Web3 library to communicate with the Blockchain. You can also find the angular box as a starting point from here

How can I include real world data in a smart contract?

Lets say that I want to write a simple contract to bet on the weather 10 days from now, or the outcome of a sporting event.
How could I connect to a third party application that hosts data and use that to write my smart contract?
What you are looking for is an oracle.
Ethereum and other blockchains are unable to access data outside of their network(The way to think about it is imagine if the entire Ethereum network tried to access the weather api you mentioned at the same time...) which is where Oracles come in. Oracles are third party services designed for use with smart contracts that provide and push external data to the chain
including weather for example.
There are many different ways to set this up and different services you can use for your own oracle
I included a link to Gnosis' white paper so you can see how they handle Oracles.
https://gnosis.pm/
And I included a link to further general explanation on Oracles https://blockchainhub.net/blockchain-oracles/

Does each DAPP has its own blockchain?

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.

BigChainDB - What exactly is that?

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.