How to create a stablecoin pegged with gold basically a gold-backed token using ERC20, example 1Token = 1mg gold, what are the essential functions or steps need to take care, our customer is planning to reserve some value of gold in Gold contracts, if there is a sample contract that would be fine.

1 Answer 1


The smart contract wouldn't know about the gold. You would create a usual ERC20 token, including mint and burn functions that only you can use.

You would also have a vault of gold in a building with armed guards.

When someone puts gold in the vault, you call the mint function to create some tokens on the chain. When someone takes the gold out of the vault, you call the burn function to delete the tokens. If they don't have the tokens, you don't let them take the gold from the vault.

Every month or two, you get an auditing company to count the amount of gold you have, check that it is really gold, and compare this to the number of tokens minted. You publish this report on your website and theirs, so that people know you aren't lying about the amount of gold you have.

  • Thank you for your reply, but it's not cleared my requirement , i will give some more details here... basically we want to create a ERC20 token, an utility token that always mapped with stable value here with 1mg of gold value, so user who owns a token will have value of 1mg of gold. So how to create a token with have such stable value as like other stable coins like USDT which mapped with 1 USD always. Customer is ready to reserve some gold value in custodian account/contract. Please let me know Dec 27, 2022 at 6:14
  • @PrabhakaranRajagopal You have to promise that anyone who has a token can give you the token and they can pick up 1mg of gold from your office or you will mail it to them. And people have to believe you.
    – user253751
    Dec 29, 2022 at 12:30
  • i don't think it make sense, since we going to develop an dApp and we want to reward tokens (ERC20) to our communities and those tokens should have some stable value (like a stablecoin 'paxg') that's it.. Dec 29, 2022 at 14:37
  • @PrabhakaranRajagopal PAXG works because they promise anyone who has a token can go to their office and get some gold (actually I think it is more complicated but they can still do it). Maybe your smart contract can have some PAXG, so anyone who has a token can go to the smart contract's office (the blockchain) and get some PAXG, then they can go to PAXG's office and get some gold?
    – user253751
    Dec 29, 2022 at 15:01

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.