1

I'm currently building smart contracts for the supply chain of "datte". Is it possible to price my own token from an external entity "like a chainlink", so that my tokens now have a changing price? If yes, what is the right article or example?

I am using hyperledger Besu (Ethereum).

2 Answers 2

1

Yes, you can use Chainlink to provide a dynamic price for your token within your supply chain.

Chainlink is an oracle service that securely connects smart contracts to external data sources, allowing you to retrieve real-time information such as token prices.

Before diving, I really recommend you to familiarize yourself with Chainlink.

One of Chainlink's strengths is its reliance on multiple data sets and nodes to provide price feeds. This ensures it provide accuracy even if any data source is compromised or hacked.

Creating an oracle to provide your token's price is easy technically.

The main challenge is securizing and determining which users or entities can update the price.

You can create an oracle by implementing a getter function that returns the current price and a setter function that allows the price to be updated.

pragma solidity ^0.8.0;

    contract SimpleOracle {
        uint256 private _priceXYZ;
 
        // Getter function to retrieve the current price of XYZ
        function getPriceXYZ() external view returns (uint256) {
            return _priceXYZ;
        }
    
        // Setter function to update the price of XYZ
        function setPriceXYZ(uint256 newPrice) external {
            _priceXYZ = newPrice;
        }
    }

But again, here is all about who can call setPriceXYZ, how many people are involved in this process, on which data set you rely.

I hope this answers your question.

0

Yes it is possible to buid your own Chainlink, but it is not easy. One article is not sufficient, you need to be skilled in smart contracts and domain-specific knowledge. If you do not have this information expect to spend 3-6 months studying.

I suggest you study how Chainlink works in very detail. Because it is open source, you can learn and understand everything about it. My suggestion is that do not try to create your own solutions until you understand how existing solutions work.

1
  • 1
    True but it's for my end of study i need to find some solution Mar 26 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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