40

It's not certain yet, but: Do NOT rely on very fine-grained calculations of current gas costs. Assume that gas costs of contract calling may go up or down by up to an order of magnitude in a future hard fork. If creating contracts in assembly (ie. not serpent, solidity or LLL), do NOT use dynamic JUMP/JUMPI operations (ie. every JUMP/JUMPI should be ...


9

event is a keyword in solidity that allows you to easily retrieve data that a contract generated in a Javascript frontend. It is cheaper in terms of gas to write an event than to write into a storage variable (like your struct array). You can then .watch for these events and pull them into your UI. This is the recommended way to go. For performance reasons ...


6

I'm not sure if you are describing the dataflow rather than the actual system architecture, but if you are it isn't entirely correct. Overview of decentralised applications: Alex Van de Sande wrote a great article on building serverless applications and in it he contrasts the distinction between a centralised build and a decentralised build. https://blog....


6

There are two ways this is done today: 1. Normal Accounts Generate wallet keys / addresses that your users transfer to, and you have to send gas to those addresses in order to move funds. Downsides: collecting funds requires you to send gas to these addresses which will ultimately result in dust accumulating in these storing and managing the account ...


4

I don't think solution number 4 is cheating. The blockchain is more of a consensus engine and not exactly a database, if you store all your data on the public blockchain it'll be pretty expensive too. Storing the bulk of the data on ipfs or swarm then just the hash in the blockchain is becoming a standard solution for Dapps to avoid high costs


4

As Sebastian stated, you want to be cautious of what data you want to store on the blockchain in the contract. That being said, the gas cost for storing the data will land on the transaction issuer for creating an event. Likewise, any "transaction" based call that needs to iterate this data will become very costly depending on the amount of data and the ...


4

You have good intution - a Dapp is supposed to be a sort of p2p application executing exclusively on the user's (client) computer. It is supposed to communicate with external entities using Ethereum blockchain and possibly other p2p platforms like IPFS. Of course - depending on the requirements - some form of centralization might be necessary. But in ...


3

At the time of writing my question, one thing I did not consider was the key feature of using Ethereum in the first place... Immutability. The private data I want to store also needed to be immutable. This is something that only the blockchain can offer, so, in this case, I will be going for option 1, storing the private data on-chain. My concern was that ...


3

As Metamask injects a Web3 instance in window object you can check for existence of the object. In order to detect if metamask is unlocked you can check in the Web3 instance if there's some address available. To refresh the data automatically in JavaScript you can then use setInterval(MyCheckingMethod,1000); in your main application instance. A quick ...


3

First, I think this is an excellent question. I've been thinking along the same lines for a while, but I never put the thoughts in clear words such as these. All the points under advantages are correct, and important. Cheap being operative. The first disadvantage is, I think, the rub. In many cases, you cannot properly generate the logs without having some ...


3

For the situation you are describing, I believe your best option is to create events for each type of CRUD operation allowable for your data, and emit them within every transaction. When creating the events on the contract, be sure to add indexed to the event parameters you wish to track/filter (e.g. userId, etc...). This will allow for easy recovery of ...


3

If your requirements are limited to payment, then checkout the aztec protocol and specifically their implementation of a zero knowledge wrapper for dai. With this your users can transact privately, safely, and with stability, as Dai is a decentralized USD pegged stablecoin. If your purpose isn't focused around payments, then definitely look into Zokrates for ...


3

In ERC-721, each token is completely unique and non-interchangeable with other tokens. The key features of both are: ERC-20: For money and money-like tokens. ERC-721: For things and thing-like tokens. According to the nature of these tokens, nowadays most of the games are using ERC-721 tokens e.g. Cryptokitties because kitties are unique and non-...


2

Besides your centralised architecture which requires full trust in your server, you have 2 options. light client (as 5chdn mentioned) client side wallet connecting to a node. The 2nd design is not "wrong". While you service your clients with an own node, and arguably this node could fake some transactions in the short run, it is a good balance between ...


2

You never use private keys to encrypt, you always use the public key to encrypt and the private key to decrypt. Assuming your are looking for the public key: To generate a new keypair you can use ethkey. For simplicity, I will generate a brain wallet from your nick, so you can reuse these params. Do not use this on public network. $ ethkey generate brain ...


2

Creating a dapp is simple once you figure out how to get started with the basics such as accessing smart contracts in Go, and sending transactions. Here's an example from the Ethereum Development with Go book. Store.sol pragma solidity ^0.4.24; contract Store { event ItemSet(bytes32 key, bytes32 value); string public version; mapping (bytes32 =>...


2

In Ethereum, the closest you can get to a fiat currency is to use DAI, a decentralised stable coin. It was created by MakerDao and, despite being at the beginning, they are doing a great job. DAI is 10x better than other centralised solutions which merely peg the token to a USD bank account. To address your question, there is no way around the problem other ...


2

Ethereum only uses integer arithmetic and will truncate mathematical operations. The expression, will calculate 5/100 first which is 0. winningBid.amount * (5/100) = winningBid.amount * 0 = 0 The solution is to force the order of the operations to first multiply require(_amount > winningBid.amount + (winningBid.amount * 5) / 100); Also it is ...


2

If the real world object has some parameters or attributes that can be digitized and are unique to every object then it can be uploaded to a blockchain and we can track its ownership. Suppose somebody bought an item using ether/token then you can add a event of its purchase and store its current owner. If the person wants to sell it to somebody else he must ...


2

The ordinary ways of storing data in swarm are: HTTP API calls the FUSE module that can mount swarm as a filesystem. HTTP is comparatively slow, so it's not so well suited for high volume of i/o. In operations like these, FUSE or a direct hack into the swarm storage stack layer is probably whay you want. You will specifically want to look at the DPA ...


2

Safemath library is useful for prevent integer rage overflow or underflow after integer operations. Its very important because it will impact user data or global ERC20 or any token value. Resultant your token will returns unexpected results. You can't update existing contract. If you write extra statement in ethereum that consumes gas for steps. i.e it ...


2

To use the Parity chrome extension in your browser you need to run a local node. You are not connected to a local Parity Node. Seamless integration with the Ethereum network is thus not available. Metamask is more flexible and allows you to connect to the main network or testing network without running a local node. With metamask you can still connect ...


2

Unlike MongoDB, which is a NoSQL database which is still somewhat a centralized database with a centralized console, Swarm is certainly the preferred choice as it is the native base layer service of the ethereum web 3 stack. Swarm is funded by the Ethereum Foundation so its tightly integrated with Ethereum.


2

The two choices of whether to store all quotations in the smart contract and whether to emit events are independent: You should keep all quotations in the smart contract if you need to access them in the smart contract, e.g. if there is another method that needs to read quotations for its logic. You can either model them as a Solidity array. In this case ...


1

Advantage: if there is a 256-bit overflow in the computation, then the operation will be aborted with an exception, and all preceding changes in state (global) variables will be reverted. Disadvantage: cost slightly more gas for each operation.


1

I would consider your app being a standalone utility. Take a look at "What is a DApp?" for a pretty detailed description on what a DAPP is.


1

You might find it useful to look at the zeppelin smart contract that verifies a merkle proof for a given root and leaf ; https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/MerkleProof.sol


1

I think there is an inherent conflict between the assumption of a private blockchain and the idea the data in this chain would be immutable. The argument that things in the public blockchain are essentially immutable has merit, because you would have to get the entire blockchain to conspire to edit the blockchain to make a change. OTOH, a private ...


1

You can use nested mappings, it is kind ugly but you can hide some of the complexity in a library contract Db { mapping (address => mapping (bytes32 => bytes32)) data; // function getAge(address usr) public view returns (uint) { return getUint(usr, keccak256('age')); } function setAge(address usr, uint age) public { ...


1

This problem is endemic to the use of IP addressing: Generally speaking, IP provides a connectionless delivery service for variable size packets, which does not guarantee ordering, delivery, or lack of duplication, but is merely best effort (although some packets may get better service than others). Senders can send to a destination address without ...


Only top voted, non community-wiki answers of a minimum length are eligible