CasperLabs Adds AssemblyScript Support and a Rust Contracts SDK

Medha Parlikar
Feb 14 · 4 min read
Big features for Builders

In this release, we are pleased to offer 2 large features to support dApp developers — AssemblyScript contracts and a Rust contract development kit that includes a runtime environment, documentation and test framework.

Most platforms don’t support native development workflows and many blockchain developers need to run full or light nodes in order to develop contracts. Custom IDE’s have been built for custom programming languages, requiring developers to use several tools to develop applications for businesses.

Our Contracts Development Kit not only leverages the existing Rust development toolchains and ecosystem, but also will work with any IDE that supports Rust development.

Introducing Cargo CasperLabs

Developers who want to use Rust (recommended for financial applications) can create a crates project for their smart contracts and run their contracts in a testing framework with the CasperLabs contract runtime environment. This enables developers to use a seamless workflow for authoring and testing their smart contracts. This environment can also be used for continuous integration, enabling Rust smart contracts to be managed using development best practices. Details are on Github and we’ve simplified the process into 5 easy steps:

  • Install cargo CasperLabs.
cargo install cargo-casperlabs
  • Create your project “my_project”
cargo casperlabs my_project
  • Set up your Rust environment for building
cd my_project/contract
rustup install $(cat rust-toolchain)
rustup target add --toolchain=$(cat rust-toolchain) wasm32-unknown-unknown
  • Now your project can be built using
cargo build --release
  • The SDK also sets up a test framework. Run tests by:
cd my_project/tests
cargo test

Rustdocs

As part of the Rust development environment enhancements, we also present Rustdocs for the contracts library. The Rustdocs are available at:

Smart Contracts in Assembly Script

For developers that would prefer to use a scripting type language, the W3C foundation has implemented AssemblyScript https://docs.assemblyscript.org/ for WebAssembly. We have created a contracts library that enables developers to create smart contracts for WebAssembly using AssemblyScript.

Quite often AssemblyScript is conflated with TypeScript, and while these 2 languages are both scripting languages, there are several differences which are documented and contract developers should be aware of these differences. To access the AssemblyScript contract library — you can search on: https://www.npmjs.com/search?q=casperlabs or install it in this fashion:

npm i @casperlabs/contract

GraphQL Enhancements:

We offer new relationships in GraphQL that support retrieving the child relationships given a block hash. Example query:

query {block(blockHashBase16Prefix: "a3016e93f101da2781eae0696064df8c1ca770058b1d1eae261cfd4034f47547") {
blockHash
parents {
children {
blockHash
}
}
}
}

The GraphQL interface is available on every node, and public DevNet interface is at http://devnet-graphql.casperlabs.io:40403/graphql

Building Highway- Paving a path to the Future

We are making great progress towards our first production implementation of Highway with eras, with rounds and leaders, proposal messages, confirmation responses, and witness messages. The Round exponents can be configured but there is no auto-adjustment. We expect that this will allow us to deploy the Alpha TestNet and to the test environment so that we can study the protocol under different conditions and identify opportunities to stabilize, harden and optimize it while we also build the additional security and rewards distribution features.

Getting Ready For Our Next Big Milestone…

We are preparing to embark on a round of performance testing, optimizing and tuning of the protocol as we integrate it into the node in the coming weeks. To support these efforts, the team has been working hard on preparing extensive test infrastructure.

Launching a blockchain network within a hostile permission-less setting is non-trivial. The elevated risk profile of such an undertaking requires a concomitant level of sophistication in respect of system testing. CasperLabs is currently building out the STests platform to enable teams to perform system testing both at scale and in detail. The platform is being designed in an extensible fashion and aims to square the circle between simulations at the dApp and game theoretical levels. Note that the platform is under heavy development for the next 2–3 weeks and may undergo non-trivial changes.

We will publish the specification for STests next week to our Github. Stay tuned!

Get Started with this release

At release, links to installation packages and relevant documentation is available on GitHub.

  • Packages available on GitHub
  • Docker images available via DockerHub
  • Debian package
  • RPM package
  • Brew package
  • tar.gz
  • Docs available on GitHub (Wiki)

Where will bugs be filed?

Report a bug on GitHub

Where do developers go for support?

Join our community on Discord https://discord.gg/Q38s3Vh.

About CasperLabs

CasperLabs is the blockchain platform purpose-built to scale opportunity for everyone. Building toward blockchain’s next frontier, CasperLabs is designed for real-world applications without sacrificing usability, cost, decentralization, or security. CasperLabs removes the barriers that prevent mainstream blockchain adoption by making blockchain friendly to use, open to the world, and future-proof to support innovations today and tomorrow. Guided by open-source principles and built from the ground up to empower individuals, the team seeks to provide an equitable foundation made for long-lasting impact.

Medha Parlikar

Written by

Building the decentralized future

CasperLabs

Blockchain for the Builders

More From Medium

More from CasperLabs

More on Blockchain from CasperLabs

More on Blockchain from CasperLabs

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade