# Distributed Lab Workshop | Armen Arakelian | ETHDam 2023

- Channel: [CryptoCanal](https://streameth.org/cryptocanal)
- Date: 2023-10-07
- Duration: 19:49
- Watch: https://streameth.org/watch/yt-IFQU5S0bdB0
- YouTube: https://www.youtube.com/watch?v=IFQU5S0bdB0

## Description

Armen Arakelian is an experienced Solidity developer and team leader at Distributed Lab.
https://distributedlab.com/

ETHDam is a Hackathon & Conference that gathered over 500 DeFi and Privacy builders on the 20th and 21st of May 2023 in Amsterdam. 

Privacy is normal. Following the arrest of Alex Pertsev, a Tornado Cash developer in the Netherlands, ETHDam 2023 is determined to counter the chilling effects of the lawsuit and bridge worlds to discuss the future of privacy and encourage to build on the shoulders of cypherpunk giants.

ETHDam is powered by CryptoCanal, - a blockchain education and events platform growing in Amsterdam, spreading its roots to Rotterdam and Zurich. ETHDam 2024 is on the map already! Keep up with us to see updates: 

CryptoCanal https://www.cryptocanal.org/
CryptoCanal Twitter https://twitter.com/CryptoCanal
Join CryptoCanal Community https://t.me/CryptoCanalCommunity 

We would like to thank our partners and sponsors that made this event possible. 🌷
Our BFF 1inch https://1inch.io/

Our Frens: 
Sismo https://www.sismo.io/
Aleph Zero https://alephzero.org/
Scroll https://scroll.io/
RAILGUN https://railgun.org/#/

And our Sisters:
oasis.app https://oasis.app/#earn
Maven11 https://www.maven11.com/
bitvavo https://bitvavo.com/en
Lido https://lido.fi/
Spankchain https://spankchain.com/
API3 https://api3.org/
Gelato https://www.gelato.network/
VanEck https://www.vaneck.com/nl/en/crypto-etn
Marlin Protocol https://www.marlin.org/
Silent Protocol https://www.silentprotocol.org/
Cyber Capital https://cyber.capital/
… and Proto https://twitter.com/protolambda 🍍

## Transcript

foreign guys so my name is Armin and once upon a time I become a solution developer and that was like about five years ago or more I don't really remember and yeah I think that's like everybody can hear me just like this thank you so actually uh today I'm gonna show you some like I would say simple hints from a developer's perspective but it may be hard for just ordinary users but I find it's really important to know so actually the idea came to me because of my practice you know I have like I have a lot of crypto friends um I have like a company clients and the crypto communities who like keep asking the questions like can you please help me with that or with this uh can you please fix my transaction or can you like show me how to interact with the smart contracts or something like this so for today I chose uh three cases that I had in my practice like some of them I had like multiple times and I like I was helping people a lot to solve them and some of them are like let's say less common uh but still interesting so like and today in in real life I'm gonna show you something um I'm gonna show you those cases and how to solve them so let's go so the first case about like it's really simple about canceling your transaction imagine you have an ethereum transaction and uh it's stuck so you just put like less gas on it so not enough and you like you want to cancel it because you want to send a new one and of course like obviously if even what works the way that you cannot send another transaction if one is not finished yet so you need to cancel it but for example imagine you send it from some like some I don't know some wallet from the application or something and it's not really shown in your metamask history for example uh for that like we need to cancel that right so for that uh we can use like I will use metamask but see you can use like any other normal wallet let's say which allows us to have some developers Tools in it and so I'll show it in practice here I have my wallet uh it's on the test net and so let's choose maybe correctly that's gonna be better yeah so here we have and let's send this stack transaction first uh for example let's like uh we like we need just anything we'll just choose like any transaction so it's like from my address to my address with with uh with some I don't know 0.1 adder and yeah we also need to put like less gas on it it's somewhere here oh so right now we can see that normal gas is like 22. G ways and we will put something like um I don't know seven right or even less like five it's not going to be enough for sure for sure and let's go let's hand it out so here we can see that spending and spoiler it's gonna dependent for really really long um and yeah right now like uh yeah I have this transaction in my history because I send it from the metamask but imagine if you don't and you need to like you need to cancel it uh so how we do it for example we can take any like I will tell a little bit about uh theory about that so how it works uh for example let's take some previous transaction from my address and we can see that every transaction it contains some like fields um some arguments in it and they're all the same and you probably know about like transaction hash and like from 2 it was sent where from and where to but also there is one field that's called called nonce and not a lot of people know about that hello uh uh yes and but this is crucial actually this Norms is just a counter on your account that shows how many transactions you actually send and it just it increments all the time like all the time and you really cannot send a transaction with the nodes that is higher than your current none so for example my last transaction from the address was with nouns 37. and it means that the next one gonna be like 38 and yeah that transaction that is spending it is it is with 38 nodes so actually like I have transactions somewhere in manpul with non-38 and what I will do I will just replace it because this transaction is not mined yet so actually it's not existing in the chain it's only in the mempool so the chain doesn't know that it's existing and I'm gonna just send another transaction with these nodes and I'm gonna just replace my current one with the new one and this way I will cancel and that one will just disappear uh so let's check it out I will open this transaction here it's still pending nice and I will send a new one and for that you just need to send like a simplest transaction possible so you take your address and send from your address to your address zero adder and it works for every transaction like imagine you were sending some tokens like interacting with smart contracts whatever it doesn't matter you will just need to send this kind of transaction with the proper nodes um and the proper guess that's also important so yeah it's like this field is not really usually shown but you can find it in your like metamask settings you can find like something like toggle like something show like uh customize notes or something like this and you just need to put it on and then you will be able to customize notes so as you can see it shows me like 39 because it thinks that's uh I had a transaction at 38 nodes but we will gonna like fool it and put 38 here and send the transaction let's go uh yeah and I don't know for what reason but Smith masks sometimes it's uh uh it fails exactly with this kind of transaction I noticed that when I was testing it so like we just need to send it twice but I don't know for what reason it's just some uh some strange stuff did it send it I'm not sure maybe it's sent oh come on should be sent okay here is the one the spending yeah with 0.1 adder come on what happens okay let's like let's send a little bit the other transaction like 0.2 it's still to my address so it doesn't matter and with nons that is 38 bomb for some reason it's it's not sent interesting stuff sorry it worked before because 37 it was the last transaction that they sent and it's already mine so like I sent the spending transaction so like this transaction is going to be with 38 so like other scan doesn't show it right now but it is with 38 and I just need to replace it and yeah that worked before I didn't know mathematics just uh it's just stupid okay let's generate like completely different transaction let's choose some random address with zero Adder click next we'll take an aggressive gas price with non-38 come on man work ah finally it worked I think right yeah so we can see that's a different transaction here and so yeah it should be mine soon will wait for it come on let's go I just want to show you what happens next to [Music] okay so I can show you that the transaction has is actually different oh it's mines finally so it is mind and we and we can see that nouns is 38 here on the second transaction and let's check the first one what happens here it disappeared as it was never existing and this is the way you can cancel your transaction easily not easily because metamax as you see it's bugging for some reason but yeah it is possible so yeah that's the first case and it's really common in my practice like a lot of people they ask me about that um let's move to the second one it's a little bit more techy but still I think like if you had a some deal with smart contract it's going to be useful for you uh so imagine you have a smart contract in the network and you really you know what they are in that smart contract you know that there is some function that you want to call and you want to extract some data from the chain but uh imagine if it's not validated on understand so you don't have any interface to it and you don't have to you don't know how to interact and you actually don't know how to code so you cannot really open like just vs code easily and write some like script to like extract it exactly from chain that's uh like that's not that easy even for me if I don't know like the interface that's uh yeah but yeah in this case we know the interface so for example we will have a contract smart contract so here it is it's really small tiny and everything that it does it stores some like some number in storage we're gonna deploy this contract to the network and then we're gonna get this data without uh this smart contract being validated on chain uh yeah so I will use remix and you will uh mostly possibly will will be using it too um let's choose something like C polia because it's faster and yeah here we are so we just can like uh remix it's like uh it's uh ID so you can just uh uh you can write some solidity code there and see it's you it's really easy to start using it so that's why I chose it for this example um let's yeah let's deploy this contract so as I said like here we have two functions one of them is like a Setter and it's gonna like put some data on chain and the second one is getter which it's gonna extract this data from chain I'm gonna deploy it on sipalia network uh wait until it's mines of course what's taking so long yeah so here we have it so like uh remix it provides us an interface of the contract that we just deployed and we can put some number there for example like five five five five five um let's set it on chain so it's going to be stored in storage again let's check it out uh yeah sorry I will put some aggressive gas price next time come on okay so here we have it and right now we can call it like getter and we will get this number like can you see it here so it's here and so we will have our smart contract address actually it is here it's deployed on the network so you can see there's a contract so we have address and address and imagine you have an address and you know that there is some specific smart contract behind it and you know there is a function that you can call to to extract some data but you cannot do that because it's not validated and understand it's just like some strange bites all right uh we cannot send any transactions here and imagine like you don't have this interface we'll delete it and right now you just need to like you know there is a function and you want to extract the data so what's here what you can do you can create not even a contract but the interface it's it's really easy to do and we'll do some in some like test file for example it is some coding but it's some really simple coding and we're going to create an interface interface like something whatever it can be like anything all we need is that function that we know that's existing and for example like you need the function looks like this also we just take this function and we create the interface with this particular function boom okay it's compiled it's nice and what we're gonna do there is like a field which is called add contract so you can use an interface add some specific contract address and we will take this address exactly from chain I will put it here behind that behind that interface at address and we will have like not that smart contract we will have like something that is called something so the interface that we just write that we just wrote and if we call this function here imagine what happens we get the result that we actually put from from that smart contract so this way like we got data on chain uh Without Really knowing the full smart contract and without uh without it's been validated on chain and the data is the same like you can see our five that we put there and that's really easy like if you know any function for example it's really common that smart contract has a function that is called owner because a lot of a lot of smart contracts they're ownable they have some owner and you can just put here like the function that is called owner function owner and it should be like external View make sure it turns address so and this way we will will be able to extract any owner from from chain if if it has an owner of course uh so yeah here we are and also I have the third case for you which is like not Which is less common and so I don't think I really have enough time to show it uh but I'll at least tell about that so like I tested it a few days ago and it worked um there is a possibility you know like right now we have a lot of UAM chains actually and uh all of them are kind of the same so we get like the same ethereum addresses we get like the same accounts the same smart contracts and so on and sometimes like I remember that's that's actually um that's actually a case from my practice so some some of my some of the company clients they came to me and said like uh look we have an address of our smart contract in ethereum network and then uh like somebody from our like users they sent a lot of money to the same ad respond but on vstc and I was like uh because this address it's like it's not existent there is no private key for this address because it was not deployed to BSC but the thing is it's partially possible to extract this if we deploy the right smart construct with the right data there so actually uh this contract address that we deploy doesn't really depend on the byte code of the smart contract so you can write there like anything you want it actually depends only on your address that you are deploying the smart contract from and the nons again that none's from like my first case um and if the nodes and your address are the same then the smart contracts address gonna be the same and yeah actually for example I prepared a contract it's called withdrawer so basically what it does it's also really tiny what it does it can withdraw from its address and your C20 token and like any amount of native tokens so ethereum for example or B or BNB or whatever and for example let's say you have like an ounce on ethereum network that is like 30 like or 40 okay it's 40. and then your address and BC is empty so it's zero and then you just need to send like 39 transactions from your address so your notes becomes 40 and then you need to take these smart contracts it's going to be not the same smart contracts which we had on the previous Network like on ethereum uh but it's like it's my contract that can withdraw basically anything you can also adhere nfts so that's not really hard and then if there is some funds on that address in B in BSC Network um with like on this address without any contract without any private key under it we will deploy this withdrawal contract to that network with non's 40 and we will get exactly the same address that we have in ethereum address and yeah from my case like actually I remember in real life I performed that like I deployed the contract on BSC with the same address with the same notes and I was able to extract money from it and we return it to the user damn uh so yeah I think that's it unfortunately I didn't have enough time to show it in real life but it works so if you want to see it I can probably show you like afterwards so if you want the dog come to me and yeah we'll show you everything thank you foreign
