I Deployed a Smart Contract to The Tron Blockchain. This is What I Learned.

in #hive4 years ago

So, for those of you who do not know, I have been actively involving myself in learning blockchain development and also... trying like hell to figure out F*CKING BOOTSTRAP. GAH! THAT IS ANNOYING BUT ALSO USEFUL. I have a use case for which I am ready to start building my own token, and honestly, I intend to get this done on the Ethereum blockchain, not Tron. However, I recently came across a great opportunity to learn exactly how to deploy a smart contract to the Tron Blockchain, so I went ahead and did it. Props to my buddy Walkonwayvs on Publish0x (FOLLOW THAT GUY HE IS AWESOME) for providing me with a motivation. What motivation, you ask?


GOOD POINT

You heard it here, folks. One does not simply make a spurious claim about Justin "Pantywaist From The East" Sun. It has to be submitted TO THE BLOCKCHAIN! Only then do the words that spew forth become Gospel. So, I had a challenge and I had to meet it. But how do I get a message to the Tron blockchain?

Learning about the Tron Blockchain.

So, I knew a thing or two about how the Tron Blockchain worked already. I know that at one time, TRX was just another token on the Ethereum blockchain. I know that in order to write a smart contract on the Tron Blockchain, you need Solidity. Okay, I got two things down. I figured that just like its big Brother Ether, TRX must also run similarly. Sure enough, I was correct. I went to the Developers page on the Tron Foundation website, and found a quick and simple "Hello World" contract which suited my antics perfectly:

Hard to See? This is the Smart Contract I need. HERE'S A LINK

Great. Now I know for Ethereum, I need a proper wallet that can interact with my browser, and an IDE. Fortunately for me, the dev docs goes over this; I went ahead and put the Tronlink browser extension into my BRAVE BROWSER (I love my brave browser. There are many like it, but this one is mine. PBUH). I created a wallet, named it and put about 300 TRX in there for my (current and future) shenanigans:

No TestNet Horse Shit This Time. This is Going TronGrid Baby.

And then of course, after this was set up, I went to the TRON-IDE and set to work:

It's ALL COMING TOGETHER.

This Is Some Cool Stuff Ginger Man, But I'm no Goddamn Developer. WHAT DOES THIS ALL MEAN!??

Good question. So basically, in order to put a smart contract to the blockchain (meaning, to send a message and make it part of the blockchain), I need to:

1.) Make the Contract.

2.) Set and Bankroll the Deploying Wallet Address.

3.) input my code into the IDE (Integrated Development Environment).

4.) Compile the code.

5.) Deploy an instance of the code (contract).

6.) Run a function (in this case) on the contract.

Okay so if you're still with me, I just showed you and gave some links for steps 1 - 3. Here's the next shit:

After I got my IDE open, code written in, I needed to compile it. Basically, in order for the underlying "computer stuff" to understand what I'm trying to tell it, it needs to take this Solidity code and translate it into something called ByteCode. That's all Compiling a program is; translating the thing that's easy for YOU to read into something that's easy for the COMPUTER/NETWORK/WHATEVER to read:

Now with that out of the way, It's time to deploy the contract, so we go over to the little deploy plugin here:

We Deploy the contract, call out the function that posts a message (which becomes a transaction), burn a little TRX for the trouble, and BOOM. Whatever I say is Gospel on the Trongrid MainChain. And I did just that. Don't believe me? CHECK THIS OUT:

https://tronscan.org/#/transaction/c0f16ce99e241e8224047d871a96788298d9e0beaf1d14ea696ce45825bc08e6

Or, if you're lazy (that's okay, me too):

Did You Miss It??

Awesome.

SO, Why All of This?
There's a couple reasons.

1.) For the Lulz

2.) Because I knew I'd learn something useful/related to it.

3.) Lol, because the LULZ.

I figure that in this time and age, we need to check ourselves at the door every so often. Things suck ass out there, guys. I'm not gonna lie about it. What keeps me going? Pushing the envelope when I can. Finding something stupid and hilarious. Doing something that keeps me from ruminating on the bad things in my life. It's an easy medicine to take, trying to find the punchlines in life. The hardest part is getting the prescription. It takes some serious practice to get there, I think. But really, anyone can do it. Just turn off your Give a Fuck for a minute one day and see where it leads you. And wash your hands afterwards, I'm not responsible for the consequences. Unless they're awesome, then I'll TOTALLY take the credit.

Thank you SO SO much for reading, I REALLY appreciate it. If you like my stuff, follow me! You can also see more of my antics on Publish0x, where I originally posted this particular article.

No shills beside that today. Just my love for all of you.

Until next time, keep your eye on the markets, and find ways to WTF every day.

Sort:  

haha I like the first picture

Lmao thanks i realized i made Justin look a little bit like a possessed Dwayne Johnson. GIMP is one hell of a tool.

Anyone who can wear a turtleneck without falling into a mess of twisted emo is usually possessed anyway i thought :/
download (2).jfif

Now try EOS and give me your feedback ;)

Lol hell yeah I'll look into it. I'll see if my Copypasta Code Monkey Novice skills are up to the task!

Wow that was great, let me try that also creating smart contract.

This is a fun peek at writing a TRX contract - Makes me want to download Solidity and give it a go!