2

I'm looking for a platform that enables to place serverless code for Dapps, without cloud services - so that app can remain completely centralized.

2
  • 1
    Completely decentralized you meant? Commented Jun 6, 2017 at 15:39
  • Yes Igor, I added a clarification as a comment to Eric's answer.
    – Noam
    Commented Jun 7, 2017 at 4:48

1 Answer 1

1

Your question isn't very clear. Any Dapp is by definition decentralized (Decentralized Application). It consists of one or more contracts that live on the Ethereum blockchain and can be interacted with via web3 enabled browsers like Mist. Meaning as the end user, your client connects directly to your Ethereum contract(s) via the web3.js library, which in turn acts as an interface for JSON-RPC methods that interact with Ethereum nodes.

As far as AWS Lambda specifically, it serves a different purpose then Ethereum altogether. When you talk to a contract in Ethereum in the EVM (Ethereum Virtual Machine), the only work that other nodes are concerned about is the verification of changes in the contract's state. Meaning, if you run a function that adds 1+1 and return it, you are not changing the state. Thus the addition runs client side, on your machine. But if you were to assign that value to an unsigned 32 bit integer with a value of 5 you change the state, which must be verified by the network and thus requires gas as a financial incentive to do so. Consider the following example:

Contract myContract {

uint32 i = 5;

    function CalculateSum(){

        // This calcuation is run by the client.
        // j has local scope because it is in the function,
        // meaning assigning to j does not change the contract state, 
        // and therefore this calculation costs no gas:

        uint32 j = 1 + 1;

        // This calculation is also run by the client, 
        // but because i is scoped to the contract
        // by assigning it the client-calculated value of 2,
        // we require the network to verify the change in state.
        // This costs gas:

        i = 1 + 1;

    }
}

Also, if you're looking for to make a decentralized API, if all an API does is expose data, then you could store a modest amount of data in the state of a contract, and have functions that people can call via the web.js library and JSON-RPC methods. Then you could include a function for updating/setting the data, but that would require some degree of centralization because an individual or restricted group of individuals would be setting the data. You could use oracles to listen and react to events on the blockchain, but you'd still just be running computations on the oracle hardware off-chain.

Lastly, if someone is connecting to your API, they most likely trust the data that you expose anyway. If it's a matter of not trusting the data, then you don't really have many options other than physically trying to ensure that the data is valid because you're dealing with centralized endpoints. For example, Intel was trying to implement a blockchain for keeping track of supply chains for fish, combining blockchain with IOT:

http://www.coindesk.com/intel-demos-seafood-tracking-sawtooth-lake-blockchain/

But you still have to trust the authenticity and accuracy of the data reported by the IOT devices, which requires an off-chain solution.

Basically, Ethereum isn't meant for what you're trying to do. It isn't a cloud computing platform like Lambda. Nor is it meant for decentralized storage (for that, check out IPFS) Finally, it doesn't make sense to build an API on Ethereum, because to do so you are inevitably just exposing data from a central or multiple centralized sources. Ethereum is a platform to enforce contracts and conditions, and verify modifications to their state.

1
  • Eric - thank you very much, that was very comprehensive. I guess I could have better clarified that I'm not looking for an API for Dapp functionality ON the Ethereum network, but rather off chain functionality (which will typically be most of the app), such as checking stock prices, shipment statuses etc. My assumption is that for being completely decentralized, it won't make sense to keep hosting that code on amazon and similar cloud services in the long run.
    – Noam
    Commented Jun 7, 2017 at 4:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.