Developing TypeScript/Javascript on EOS!

in #eosio6 years ago (edited)

As a Block Producer, our main objective is the adoption of EOS in our community, and we know that one of the first barriers of entry is the programming language. It is our vision that any programmer will be able to code and deploy smart contracts on EOS on their prefered language.

In some cases, not knowing a complex language like c++ prevents developers from deploying contracts on EOS, and is not due to lack of capacity or motivation, in general this is due to lack of time that exists in this industry, where people consume large part of their hours going through libraries and frameworks that they require for their daily work, and can not often afford to learn other things.

So, how can we help developers that don't currently know c++ ?

There is huge potential in EOS, and in the use of WebAssembly to decrease this barrier, and we want to take advantage of it, we want the community to benefit from this opportunity.

In this sense, we have taken the time to modify the Game of Life and recreate it in Typescript using Assembly Script. For those of you that dont know Typescript, it is in short terms: “a typed superset of Javascript”. Assembly Script allows us to compile Typescript in WebAssembly, Once compiled we can upload this contract in the EOS Blockchain. In other words, the use of Typescript / Javascript in EOS will allow incorporating the entire web community. It's that great or not?

Our version of Game of Life in Typscript can be found in our github: https://github.com/EOSArgentina/eostypescript/tree/master/example. There you can find a step by step guide on how to execute our first TypeScript proof of concept.

You will be able to see the implementations in TypeScript of:

  • Use of apply and execution of actions
  • Deserialization of contract entry parameters
  • Use of require_auth
  • Read and Inserts in tables
  • Same abi file between c ++ and TypeScript

All these features that we have implemented are achieved through calls to EOSIO intrinsics, as a proof of concept they have been grouped in a library / folder that we call eoslib, which can be found in the github code, please remember that this It's a first draft and it requires a lot of work and optimization. We hope everyone will join us!

Example of Typescript execution on EOS.

Captura de pantalla 2018-05-23 a la(s) 10.20.44.png

Captura de pantalla 2018-05-23 a la(s) 10.20.53.png

Checkout our EOS Type Script repository on Github: https://github.com/eosargentina/eostypescript

Links and References

Social Media

eosargentina.io
steemit: @eosargentina
Twitter
MEETUP Group
Telegram
Youtube

Sort:  

Really nice, if this is feasible, it will make things a lot easier.

How's the resulting webassembly size when compiled from typescript/assemblyscript compared to the compiled webassembly size from the C++ version of the game?

We still haven't made the performance comparison and the use of resources amongst the c++ version and the typescript. Never the less, the TS version can still be optimized further so it wouldn't be fair to do the comparison at this moment.

Wow this could move eos forward massively. Many js devs can easily jump across to ts. We need more work and devs and so more dapps. With js being the number one language on github.

This is what we think too :)

This sounds like a really positive development in this space. I have been interested in EOS and was contemplating learning c+++, but as you so aptly put it, its hard to find the time when your busy working.
I appreciate this article.
Thank you
@shortsegments

I live in Argentina. Nice to meet you. I follow developers. I live in Chubut.

Bienvenido y gracias por seguirnos, te invito a que te unas a nuestro canal de Telegram: https://t.me/joinchat/AUBfjQwHHMFPvshLX-kuRA

Awesome, I mainly work with Typescript and Javascript. I would love to see how it compares with C++ as with crypto, you kinda want to be extra careful.

Smart Contracts en TS, qué grande chicos! 👏

wow. awesome

You got a 52.36% upvote from @dailyupvotes courtesy of @eosargentina!

Please upvote this comment to support the service.

Cool, typescript is much more convenient to write apps with less bugs! Thanks for sharing