How to deploy your first VSC Hive Smart Contract

in Threespeak24 days ago

▶️ Watch on 3Speak


What to know:

  • VSC Contracts are open and permissionless
  • Code in any language; Starting with Assemblyscript with more in the future.
  • Contract code is fully deterministic and can be tested easily in the local environment.

Useful Resources:

Prerequisites

Steps:

  1. git clone https://github.com/vsc-eco/contract-template
  2. yarn install

<fill out .env file>

  1. yarn asbuild:debug
  2. yarn test
  3. yarn deploy

▶️ 3Speak

Sort:  

Exciting to see the progress...

My head is spinning... :-) I'm starting to understand but I have a long way to go before I'll actually understand the capabilities of real smart contracts on Hive.

Are there a list of Opcodes similar to the EVM?

VSC uses Webassembly. It does have an instruction set like EVM, but it is much more involved and supports multiple programming languages.

I'm just trying to wrap my head around it. I didn't have much time (or brainpower at the moment) to absorb the video.

So, distributed computation with an instruction set.

  • Is that instruction set available?
  • What are gas fees looking like?
  • If there are no gas fees, what is the sustainability model?
  • Is there "revert" functionality when things go awry?
  • What is most different than say, a solidity(ish) setup?

Is that instruction set available?

Yes, it's the standard Webassembly instruction set

What are gas fees looking like?

No gas fees, but there will be an RC system in the future for lite accounts using staked HBD

Is there "revert" functionality when things go awry?

Yes, contracts can revert execution and fail the transaction if required conditions are not met. We are still working on this functionality and the exact specifics but it will be available in the near future.

What is most different than say, a solidity(ish) setup?

VSC smart contracts can written in any webassembly compatible programming language. Starting with Assemblyscript to Rust/golang in the future. A lot is similar in terms of expectations and semantics. If you have any specific questions that would be a more helpful comparison and breakdown of the two technologies.

This is exciting. A lot of authors have been saying that Hive badly needs Smart Contracts. Now that it's here, I hope we see a lot of improvement in the different apps, as well as get new ones.

Well done!

Now all that was missing, was an actual Smart Contract :D

Great to see the progress on this!

You mentioned something that I was thinking about. 2 people want to swap tokens. Both have to show the other what they are giving, and then both have to signify they are Ready, after seeing what each is giving the other. Then a Trade button, which each has to click on their side, does the actual swap. The smart contract is the "broker" or "escrow account" and allows both parties to know in advance what they are giving and getting.

Currently if I do this, one person has to "go first" and send their tokens to the other. Then the other person will hopefully send their tokens when they receive what they expected from the first person. I have no problem going first with people I know, but that limits the set of people you can swap with! Doing it via smart contract makes it trustless. But I guess you still have to trust the smart contract. :)

I'll take a look at your documentation and maybe try to make such a smart contract. I imagine others might also make the same, as it seems like a common thing t want to do, and hopefully pretty easy to code up.

Thanks for all your work and this informative video!

Feel free to reach out to us on discord if you have any questions!

!discovery 35


This post was shared and voted inside the discord by the curators team of discovery-it
Join our Community and follow our Curation Trail
Discovery-it is also a Witness, vote for us here
Delegate to us for passive income. Check our 80% fee-back Program

Congrats guys amazing job👏

I already commented here about a token swap smart contract. How about a HBD Bond smart contract! Is it possible? Could ETH staking be the way to get the extra interest needed to entice someone to lock up their HBD longer for a higher interest rate? Could one smart contract on Hive do all that would be needed or would it have to interact with other smart contracts on ETH?

I was thinking about this, here:
https://peakd.com/lido/@dalz/a-look-at-the-lido-protocol-or-the-number-one-protocol-for-staking-ethereum-sbtvlf#@kenny-crane/re-dalz-sbugh6

HBD bond is entirely possible and in the near future we will support holding staked hbd directly within a smart contract. The problem is the L1 would offer the same return and only a 3.5 day lock period. The contract could theoretically set a very long lockup period, but it would make more sense for a user to still go to the L1 instead. As for ETH staking, that's not possible as Eth staking is heavily tied with running a validator and thus an inherent risk that the network cannot take on or maintain.

Thanks for this valuable information, I greatly appreciate your reply!

Hello vsc.network!

It's nice to let you know that your article won 🥇 place.
Your post is among the best articles voted 7 days ago by the @hive-lu | King Lucoin Curator by deepresearch

You and your curator receive 0.0260 Lu (Lucoin) investment token and a 14.91% share of the reward from Daily Report 263. Additionally, you can also receive a unique LUGOLD token for taking 1st place. All you need to do is reblog this report of the day with your winnings.

2.png


Invest in the Lu token (Lucoin) and get paid. With 50 Lu in your wallet, you also become the curator of the @hive-lu which follows your upvote.
Buy Lu on the Hive-Engine exchange | World of Lu created by @szejq

If you no longer want to receive notifications, reply to this comment with the word STOP or to resume write a word START