Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in Blockchain by (4.1k points)

I'm currently doing a project attempting to developing a currency and model for P2P energy transactions, where every kwh of renewable energy generated mints one coin to that producer. And my question is regarding destroying coins in a smart contract.

All of the current implementations similar to my project don't have a proper protocol for destroying coins that would aim to prevent hyper deflation in its value. Some projects destroy their proposed energy currency through transaction costs and lost wallets but I don't think that's enough. This is because energy coins can be minted at an exponential rate if more and more people begin to adopt the project and use their solar panels and wind farms to mint big amounts of coins. And coins would stay in circulation that represent energy generated (and used) days/weeks/months ago in the past.

I want to propose that you can use these coins to pay the utilities for energy consumption, and this will ultimately destroy those exact coins, which is written in the immutable smart contract that the consumer and energy company will agree upon.

I'm new to computer coding and I don't want to assume one can easily write in a smart contract to say destroy() the specified number of coins. Would it be possible for one to do this and make it work? I think I just need a second opinion!



1 Answer

0 votes
by (14.4k points)

You can write a method for your contract to destroy tokens. 

You can do this by removing X amount of tokens from the address count. Then remove X amount of tokens from the total token supply.

With this approach, you can effectively destroy tokens. However, sending tokens to lost accounts is not advised because there is no guarantee that there will be control over the private key for that account.

Another way to do this is to take the user spent tokens and send them to a 0x address that locks them in forever. This way just by looking at the balance of the 0x address, you can know how many tokens were burnt in the history of your smart contract.

Browse Categories