Skip to main content

πŸ”­ Welcome to Venin! 🌌

NodeJS/JsDOM/Browser tests codecov Discord support channel contributions license node version npm version

NPM

... because it's time we start writing Hedera smart-contract dApps1 frictionless and with ease, without having to deal with the hustle and bustle of Hedera's verbose, underlying services.

Disclaimer

This project is an independent, community driven, effort to bring clarity and joy towards developing smart-contract applications on the Hedera network-chain ecosystem.

Having said that, we have been featured on Hedera's blog and, hopefully, will continue to be so as Venin draws closer to a more stable-badge status.

caution

Please keep in mind that, although core features are extensively tested and appear to be working, this is still currently under heavy-active development and, as such, we don't recommend this just yet for production use. The API is also very likely to change before we reach there! We strive to document all the changes, including braking ones, in the appropriate docs section.

We will continue to use it "as is" in production even in this initial stage just because we are really familiar with the library and are quick to solve any issues that we might encounter.

The drive​

As any good-striving, long-lasting, endeavour, we are using Venin to hopefully fuel everything that we, here at Buidler Labs, build on Hedera. Our Hedera portfolio currently consists of:

We're basically eating our own dog food. That way, we can hopefully prove that it's something delicious or, if not, we have a good incentive to make it so. This also makes it a good reason to not have it as a "shot and forget" kind of effort.

We will support this for as long as we're going to build on Hedera and, depending on general community interest, even beyond that.

The gist​

Suppose you want to upload, execute and print the resulting greet message for the following contract:

./hello_world.sol
// SPDX-License-Identifier: MIT
// compiler version must be greater than or equal to 0.8.9 and less than 0.9.0
pragma solidity ^0.8.9;

contract HelloWorld {
string public greet = "Hello World!";
}

Here's how you would do it in Venin:

Live Editor
Loading...

(click on the "Hedera" tab to find out what would be the equivalent of this snippet written solely using the official Hedera SDK JS library)

Oh, by the way, if you haven't done it already, click Run on the Venin tab. See what happens.

It should run the code targeting the unknown account id on the unknown network. We strive to keep a working balance on it, but if we can't keep up with the usage, you can also use your own hedera account instead. Hedera's Portal is the best and easiest way to start in this sense.

Once ready, just edit the above code to use it in your own session like so:

const { session } = await ApiSession.default({
wallet: {
sdk: {
operatorId: <Your operator account id>
operatorKey: <Your operator private key>
}
},
network: {
name: "testnet" / "previewnet" / "customnet"
}
});

Head over to our configuration page for more info on other available options.

A note on log-ing

As you might have noticed, the above example contains a log call for which there is no function definition provided. This is intentional and has been provided as a behind-the-scene convenience function replacing the previously-used, console.log variant and freeing it up to target the good-ol'-fashion browser console that we all love-and-dread.

This tends to make the code a little bit non-portable (aka: you can't copy paste it directly from browser and expect it to work), but this can be easily solved by virtually replacing all logs with console.logs.

In both cases, we've left out the error handling part for brevity. Besides that, the Hedera code assumes that the developer has precompiled the contract and that its bytecode is provided to it via the ./hello_world.json file. Venin does not enforce such an assumption. It takes care of the underlying compilation so that the developer does not have to.

Speaking of that, here's a more self-contained code snippet version that basically does the same thing, but gives even more in-browser control to play around with:

Live Editor
Loading...

... you get the idea. It's that simple!

Give it a spin​

If you want to quickly get your hands dirty, we prepared a quick-start demo repo for you to play with. You'll first need to setup an .env file, but don't worry, there are a few mandatory entries and everything is explained in configuration section.

You can also start from the .env.sample file which is meant to be a minimal-config template. This also means that not all the config options are directly available there so you might as well cross-reference them with the online config values.

Another option would be to just code in-browser using our playground.

Features​

Venin already is packed with a lot of stuff:
βœ”οΈ Compile a Solidity contract to obtain its Hedera accepted ABI directly from within the library (no external compiler required)
βœ”οΈ Deploy a contract to the network
βœ”οΈ Use a fluent API to interact with deployed, live entities such as contracts
βœ”οΈ Pubsub for contract emitted events
βœ”οΈ Pubsub for transaction receipts
βœ”οΈ Fine grained cost-control
βœ”οΈ Browser bundle-able via a custom made Rollup plugin (webpack pending)
βœ”οΈ Using Hedera File Storage as a place to store generic files and JSONs
βœ”οΈ Create token via the Hedera Token Service (HTS)
βœ”οΈ Create a Hedera account
βœ”οΈ Ready to be plugged into a web3 wallet (aka HIP-338 supported)
βœ”οΈ End to end tested, high coverage (targeting a minimum of 85%) sourcing multiple contracts for the test-base from places such as solidity-by-example and the hedera-sdk-js repo

... with more planned for development:​

πŸ”² Better integration of entities across the code-base
πŸ”² Pubsub mechanics for Hedera's Consensus Service
πŸ”² Other account operations
πŸ”² Better error reporting
πŸ”² Increase logging support
... AND more.

Contributions​

Do you think we missed anything? Want some important feature prioritized? Do you have an idea of something that we might improve? Head over to our issues page and let us know! We want Venin to be a community-lead initiative. This means that any opinion or critic is encouraged (and even welcomed)!

Of course, if you're eager to write it yourself, that's also fine and dandy! Just fork us, add your changes and open a pull request. We'll take it from there ...

Oh! And if you ever feel like talking to us, you can reach us on discord. We're ΓΌber friendly! πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦

License​

This work has been published under the MIT License.


  1. decentralized application↩