can somebody check my understanding on DApps and smart contracts in general? (Please excuse the long winded-ness I’ve only been reading about DApp’s for 3 days now so I’m very new and I’m kind of walking myself through how it works as I’m talking about)

My current understanding of smart contracts says that when any processing takes place on the EVM, there’s a certain amount of gas required for the work done. That gas is paid in a certain amount of ETH, determined by whomever initiated the transaction.

This makes sense to me in regular ETH transactions and smart contracts. In order to run your code or send your ETH you pay a small fee for the work done to make that transaction happen. Cool. That’s not much different from bitcoin.

But then when you add DApps and, by extension, tokens into the mix, it gets a little more complicated.

Let’s say I have a DApp that runs a decentralized version of Runescape or something. Let’s say the DApp uses RUNE as it’s token.

In the RuneScape DApp’s ico, I set some arbitrary amount to be what RUNE is worth in ETH. People buy a bunch of RUNE using ETH and all of this ETH is stored in the contract itself, which is then itself used as gas to fuel the DApp on the platform.

The RUNE token allows certain utility on the RuneScape DApp, such as allowing the use of certain spells or dungeons or whatever. This utility can be converted into real-world value (entertainment value in this case), and thus the RUNE token is worth something. The token can be mintable or non-mintable depending on the architecture of the DApp.

Once people have access to the token and circulation becomes regulated, the market will begin to determine the value of these tokens. At this point you have your fully fledged erc20 token and DApp.

Is this correct? Or do I have something mixed up somewhere?

Also, how does one ensure that their DApp doesn’t have the gas in the contract expended if no more ETH is being added to the contract in the case of a non-mintable token?

I set some arbitrary amount to be what RUNE is worth in ETH.

This is one possibility, but others exist.

which is then itself used as gas to fuel the DApp on the platform.

Contracts don't store gas per se. More commonly, the ETH is withdrawn by the seller.

Once people have access to the token and circulation becomes regulated, the market will begin to determine the value of these tokens. At this point you have your fully fledged erc20 token and DApp.

The requirement of ERC20 is technical, not regulatory. It's an ERC20 because of the way the interface is written. It is common for such tokens to find their way to secondary markets before applications are fully developed. Price discovery can take place before the system is in production.

At this point you have your fully fledged erc20 token and DApp.

You have your ERC20 token the moment you publish the contract, although it's probably worthless until you have a Dapp. You have a Dapp when you make software that works. Your dapp optionally requires your token or is otherwise concerned with your token (Your app, your call). Dapps may be concerned with multiple tokens. E.g. a distributed exchange.

how does one ensure that their DApp doesn’t have the gas in the contract expended if no more ETH is being added to the contract in the case of a non-mintable token?

One doesn't try to ensure the contract has sufficient funding to pay for gas. Indeed, contracts cannot pay for their own gas at this time. Users pay for gas when they interact with contracts. This has non-trivial influence over the way Dapps are designed.

Hope it helps.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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