Blog
The Beauty of EOSLIME – EOS Development Tool and Unit Testing Framework

The Beauty of EOSLIME – EOS Development Tool and Unit Testing Framework

Tech Talks

By

Lyubomir Kiprov

February 6, 2020

4 Min Read

But wait, What is EOS?

If you are not familiar with what EOS is and what capabilities it has, you can check here. EOSIO is a next-generation, open-source blockchain protocol with industry-leading transaction speed and flexible utility. Introduced in May 2017, it has since been widely recognized as the first performant blockchain platform for businesses across the world.

The purpose of this article is to walk you through EOSLIME, a development tool for EOS blockchain protocol and give you a high-level overview of its capabilities.

Why did you open the article?

First of all, I am happy for you to be here!

I assume there are three possible answers to the question above:

  1. You found an interesting label while searching for EOS blockchain stuff.
  2. You need a JS framework for the development, testing, and deployment of the EOS smart contracts in an easy and intuitive way.
  3. You are looking for Truffle alternative for EOS.

If your answer is one of the last two, you are reading the right article.

The beauty of EOSLIME, an EOS development tool, and unit testing framework, and its purpose

You are not very attracted by doing your smart contract tests on C++. Are you? You prefer an easier and more intuitive way of doing testing, right? So did I…

Most of the tutorials show you how to compile and deploy a smart contract manually with CLEOS or in the best case with a bash script. I can bet you found it a bit annoying… I had the same feeling…

If we could have our contracts, tests, deployments in one consistent place, we would be more effective and have more time for the fun parts of the blockchain development. If only we could…

EOSLIME is trying to be the framework that gives you an easier and more programmatic way of doing the EOS smart contracts development. With this idea in mind, EOSLIME skips a lot of mess while letting you focus on the logic of the tests.

EOSLIME is a Javascript npm package. It was developed with the idea to be able to write Javascript tests. Eosjs tests are time-consuming due to the lack of documentation. Eosjs also has a way too much flexibility in my view and this makes it non-intuitive.

EOSLIME started as a simple testing library with few helper utilities and became an EOS development tool and unit testing framework. It makes the process of unit testing, deployment, and compilation much simpler and much easier.‌ All of this is possible with the help of the lovely community. Thank you, guys!

Speach Bubble IllustrationGlow Blog Banner

EOSLIME framework

EOSLIME could be mentally divided into 2 pieces:

  1. Library for writing test and deployment scripts
  2. CLI application

Writing Javascript unit tests

EOSLIME provides awesome features and a flexible way of writing Javascript unit tests. The unit tests part of the framework are based on mocha. Yes, you have all of the mocha power integrated.

Accounts support

EOSLIME provides several ways of creating a new account:

  • create from a name
  • create a random one
  • create encrypted one
  • load encrypted one

Have you heard about the power that EOS account-model gives? Have you heard about authorities or the Multisignature possibilities? Did you try out these features? If so, I can bet, you had a hard time trying to get these concepts up and running on the first shot.

EOSLIME takes away all that pain and enables full management with just simple functions.

Authorities management

  • sub authorities
  • authority threshold
  • on behalf accounts
  • custom permissions

Multisignature account management

  • propose transaction
  • approve transaction
  • reject transaction
  • process proposal
Speach Bubble Illustration
Contact Us
Glow Blog Banner

Smart contracts support

Yes, you can instantiate contracts or deploy them directly from the code. You have the flexibility to choose how to instantiate or deploy your contract so it will suit your needs in the best way. You can instantiate an already existing contract from ABI and WASM files or you can do it directly with the contract name.

Do you have an existing account to deploy on your contract? Nooo … You should create your account manually and hard code it in the tests. But what happens if you need this contract to be empty for your second test suit, the logic won’t work in this case. So, let’s use EOSLIME to create a fresh account for you and let it deploy contracts any time you need it. A new contract per test suit for testing the logic in a flexible way. I personally found this approach as a solution to write independent unit tests and keep the best practices.

How would you call contract functions? Just like that:

Enough easy, right?

Have you ever needed to get the raw transaction of contract action or the signed one without broadcasting it to the network? You could do it in an easy way just like that:

Alright… I can instantiate contracts and call their actions.

How to broadcast action from another account?

How to force a transaction to be unique like cleos -f option?

I have an action which should be paid for

Now, when you have the full power of contract actions in your hands you are able to … WAIT!

I can write, but how to read?

Do you really think EOSLIME will leave you with this annoying and long syntax 😉

There is a Query Chain Style. Yes, you can construct your queries almost the same way you will with SQL. However, SELECT(contract table) and FROM(contract account) clauses are preset

Utils

The utils are there for your facilitation.

Do you want a random name for your account? Let EOSLIME generate one for you

You have a private key but don’t have a name for your account yet? Let EOSLIME generate one based on your private key

Do you need a private/public keys pair? Let EOSLIME generate this for you

EOSLIME CLI

At the moment there are 4 CLI commands supported and you may find them very useful

Init ( eoslime init )
This command sets up for you a ready to use files structure. If you are new to EOSLIME, there is always a possibility to init an exampled template.

Compile ( eoslime compile )
Use this command to compile your contracts

Deploy ( eoslime deploy )
Write some deployment scripts and let EOSLIME execute them on the blockchain.

Test ( eoslime test )
Write some Javascript unit tests and let EOSLIME run them.

Have you ever wondered how much resources your contract actions use on the chain? If so, I can bet that you are running action by action and search in the transaction receipt the resource usage. Give a chance to EOSLIME do it for you from now on

EOSLIME as it is

First of all, thank you very much for being here and reading my work. I am so thankful because YOU and the community are the reason why EOSLIME exists.

If you find EOSLIME an interesting EOS development tool and unit testing framework, but you still need a reason to give it a try, that means I should have probably written this article a way better. Please tell me if I failed to convince you.

But in the end, I am just a developer. Give a chance to the voice of the community to impress you. Read the comparison of the current EOS development tools here

EOSLIME aims to help EOS developers. That is why we are always open for ideas and feedback on the framework and how we can make it even better:

  • Desired functionality
    Functionality improvements
    Found bugs

I would like to invite you to become part of the EOSLIME community and help us improve the framework:

Telegram https://t.me/eoslime

Useful Links

NPM package – https://www.npmjs.com/package/eoslime
Documentation – https://docs.eoslime.limechain.tech
Github – https://github.com/LimeChain/eoslime

About the author

Hello my dear reader, I am Lyubo. Thank you again for being here and reading my article. Here are some details about my personality.

How I am related to EOSLIME – I am the main developer behind the framework.
What experience I have in the blockchain world – I am a blockchain developer for 2.5 years. The first year I was working with Ethereum blockchain. After that, I moved to EOS one.
Where I am working – I am working at LimeChain as a blockchain developer. The company provides DLT and blockchain solutions to clients worldwide, with a focus on public and private blockchain development, as well as smart contract development. We help startups and corporate clients build secure, trusted and decentralized environments and products using Blockchain and DLT. Learn more on LimeChain’s Twitter and on our website limechain.tech

Have a project in mind?
Drop us a line.

Or just shoot us a message on Telegram

Select Contact Method
Looking for

Thank you! Your submission has been received!

Oops! Something went wrong while submitting the form.
Mail Box IllustrationCube Illustration 2