You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

2 Días
11 Hrs
40 Min
6 Seg

Aleatoriedad: Funcionamiento con Chainlink y Metamask.

12/15
Resources

How to connect and deploy contracts on the Sepolia network with Chainlink?

Deploying and managing smart contracts requires certain specific inputs and steps. Here, the instructor provides a complete guide to interact with the Sepolia test network and use the Chainlink network. Through these instructions, you will acquire the ability to manage contracts and handle random numbers efficiently.

What do you need before you start?

To work on the Sepolia network and interact with existing contracts, you need funds in your wallet, specifically Chainlink LINK tokens. These tokens are used to cover the cost of random number queries, but remember that in a testnet the cost is fictitious.

  • How to get funds: Use the Fawcett provided by Chainlink, which will grant you both funds in the testnet and LINK tokens.

How to create a subscription?

Creating a subscription on Chainlink is essential for implementing contracts that handle random numbers. Here's how to do it:

  1. Create the subscription: Follow the process provided to generate a subscription. You will be assigned a subscription ID, important for future implementations.

  2. Verify the network: Make sure you are connected to the correct network, Sepolia in this case.

  3. Add Consumers: Once you deploy the contract, add it as a 'consumer' so it can interact with the data received through the subscription.

  4. Add LINK balance: Make sure to load a sufficient LINK balance to perform the queries. This is done through the "Add Funds" option.

How to deploy your contract?

Having prepared the subscription and having funds, the next step is to deploy the contract using Remix:

  1. Configure Remix: Make sure that the network is configured correctly in Remix. Use 'Injected Provider' with Metamask if you are using Metamask.

  2. Builder Data: Provide the necessary data to the contract builder during implementation of the contract, including the subscription ID created.

  3. Confirm transaction: Perform the transaction and wait for confirmation to ensure that the contract is implemented correctly.

How to interact with the contract?

With the contract already deployed and added as a consumer, it is time to make use of its functionalities:

  • Start games: You can start a game with two addresses. Check interactions to ensure the correct draw when generating moves.

  • Confirm randomness: Verify that the assignment of turns follows the expected logic by testing various actions within the contract.

Best practices and next steps

Event handling in smart contracts is an excellent practice for recording valuable information. Consider using logs to verify the issuance and receipt of random numbers, which provides transparency and insight into how random outcomes occur.

Don't forget to take on the challenge of creating more complexity in your contracts, such as offering random rewards to the winning user - these types of challenges will help you consolidate your developing understanding and skills with Solidity!

With this guide, you already have the tools and knowledge needed to work with random numbers in Solidity with Chainlink in a testnet. Keep practicing, face new challenges and expand your horizons in the fascinating world of smart contracts and blockchain technology!

Contributions 3

Questions 0

Sort by:

Want to see more contributions, questions and answers from the community?

link donde le explican como es el proceso para la fauce de ChainLink:
https://docs.chain.link/resources/acquire-link?parent=gettingStarted
link de la fauce de ChainLink:
https://faucets.chain.link/

aca les dejo el link para la suscription a mi me costo un poco conseguirla,
https://vrf.chain.link/

donde consigo la direccion al coordinator?