MultiversX Tracker is Live!

DeFi website down? You can interact with smart contracts directly!

All Cryptocurrencies

by COINS NEWS 37 Views

DeFi website down? You can interact with smart contracts directly!

Right now Sushiswap is acting up, and doesn't allow all interactions with their smart contracts. So for example you are not able to directly claim your staking rewards. There are some workarounds, but I wanted to use this opportunity to show you how to interact with a smart contract directly, even if a website is down. This is not only working for Sushi, but basically any smart contact.

Step 1: Find the contract address and interaction inputs

In the best case you have interacted with a contract before and can look up your own transactions. Also browse down to "Input Data" and see what parameters are required. In this case we have just an pid value, which was always "2" in the past and the address. We also find out the method is called "harvest" with the MethodID "0x18fccc76".

Last \"harvest\" interaction with MiniChefV2

Input Data

Input Data viewed as \"Original\" (important for later)

Step 2: Locate the method on the contract

First view the contract address on the block explorer, click on "Contract" and on "Write Contract", you will see a list of the available methods. Make sure the method has the same ID as we looked up earlier.

https://preview.redd.it/8x7dsgspevib1.png?1592&format=png&auto=webp&s=c6a285897ff592f7464a966ecbcac14fd58f6323

Step 3: Make your transaction

The harvest function doesn't require any transaction specific values, which makes it pretty easy to write to it. I just entered the value 0x2 and my address as shown here:

https://preview.redd.it/p4lfjpydfvib1.png?1356&format=png&auto=webp&s=3f920222abc88fe70fb72abd9466572bcc72d7bf

Note that "0x" is just the prefix for a hexadecimal number and not actual values, it will also be missing from the raw hex data later. The input fields didn't accept the numbers exactly as displayed in the explorer earlier (with the dozens of zeros in front. If you don't feel comfortable changing these numbers, don't worry, there is one final step.

Step 4: Double check the input

In crypto we always double check we made everything correct, right? When I entered the hexadecimal notation I was also unsure if it was the correct way to input it or if I would fuck something up.

Connect the wallet to the explorer website and hit "Write". A Metamask window pops up. Before confirming the transaction, click on the "Hex" tab and view the "Hex Data"

https://preview.redd.it/yn7ipw8tgvib1.png?700&format=png&auto=webp&s=d86441d078c7f51b5d511d03dc87921b4e25bb2b

Now we compare this with the Data Input from earlier and can confirm it's indeed exactly what we wanted. You can copy paste it into a text editor in two lines to easily compare it character by character.

So confident that everything was right, we hit confirm and pray wait.

Small note: I also ramped up the gas limit a little because I knew the contract estimated it wrong before in the past. I don't know if this is neccersery right now.

https://preview.redd.it/ysfc9bcbhvib1.png?2214&format=png&auto=webp&s=a5b261133a8c4b2880529772b721df479d74737f

After my next refresh the transaction is confirmed and the rewards in my wallet. Congratulation, you claimed your Sushi rewards without needing their centralized website!

Conclusion

Blockchain is decentralized - even if websites go down, the contracts are still working and available - you just have to know how to use them. I know many people won't be comfortable doing something like that, but this being an option is already amazing enough.

If SushiSwap ran away from one day to the other, anyone could make a website allowing interactions with their contracts again - convenient for everyone. This is not possible in the traditional financial word and one of the reasons I love blockchain so much.

tl;dr

If a DeFi website is down, you can still interact with most contracts via the block explorer directly:

  1. Find out the contract, method and input data from a past transaction
  2. Locate the contract on the block explorer
  3. Replicate the transaction by entering the right input data in the "Contract-Write Contract" tab
  4. Double check and confirm the transaction, and ta-da: You interacted with a contract without needing the website
submitted by /u/Maxx3141
[link] [comments]

Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments