I have requirement to create a exchange for my private blockchain tokens, where registered user can buy and sell tokens, and token price goes up and down on demand and supply.

I have searched bit, but couldn't find anything in-built. So, my question is, the logic of price up and down would be inside the smart contract? or elsewhere.

And if it goes inside the smart contract, how would build the whole exchange?


If I'm understanding the question correctly, there shouldn't be any inherent difference between a private and public network. Depending on how you are selling the tokens, you could either have the price adjust using logic in the contract, or off-chain.

On chain has the potential to be more transparent, as nodes on the network can see the contract logic, and can verify that the contract does what it claims to do. How transparent this is will depend on the setup of the private network. There are various on-chain price adjustment mechanisms you could looks at, such as Uniswap, Bancor, or KyberNetwork. Please note that for this to work, you would have to have a setup where means of payment for your token are on-chain, otherwise they don't have a means of interacting with the contract.

Alternatively you could set up an off-chain backend that receives payments, and when it detects payment, sends token to an address on your private network (maybe through a form).

  • I take it the downvote means I missed something; could you tell me what, so I can either improve or delete the answer? – The Renaissance Mar 20 '20 at 9:44
  • 1
    No reason for the downvote IMO. The answer is well explained. Perhaps the only issue is that you've answered the question in the body, but not so much the question in the title. But the fact that they're different is more of a problem in the question than in the answer. – goodvibration Mar 20 '20 at 10:31
  • @goodvibration, thanks, question updated – Div Mar 20 '20 at 11:12
  • 1
    @Div when you ask 'how would I build the whole exchange', I assume you aren't asking for finished code for a whole exchange. What information would be helpful? Do you mean to ask for potential algorithms for the price to self-adjust, or something else? – The Renaissance Mar 20 '20 at 11:18
  • Yes, I'm not asking for the finished code, instead I would like to have information or guide that help me to understand the process and how implementation would looks like. For instance I have created my ERC20 tokens with some tutorials, and the same way I'm looking for this @TheRenaissance – Div Mar 20 '20 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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