Our Blog

Full-stack development and intelligence for blockchains

Crux 1.0

We’ve been busy at blk.io in the last couple of months since we announced Crux. We're happy to announce the availability of version 1.0.

This version an updated client and internal API making use of Google’s protocol buffers and gRPC technologies. TLS is also fully supported.

 
The Crux Constellation
The Crux Constellation (Eckhard Slawik)

We have a Docker image that spins up a 4 node Quorum network using Crux. Simply run:

git clone https://github.com/blk-io/crux.git
docker-compose -f docker/quorum-crux/docker-compose.yaml up

And get hacking using the node endpoints which are listed here.

Google’s protobuf library provides efficient binary encoding capabilities with code generators for all major languages, including Java, C++, C#, JavaScript, Python and Golang.

It is also complemented by the gRPC RPC framework which provides fast bi-directional streaming of protobuf data over HTTP/2, again which provides code generators for all major languages.

This combination enables you to have your API endpoints and messages defined in a .proto file, then code generators take care of the rest.

We’ve worked with protobuf and gRPC on a number of recent projects, and it greatly increases productivity given you no longer are concerned with hand-crafting API integration code.

For instance, to send a transaction into Crux, we have the following messages:

// Store a transaction payload
message SendRequest {
// The payload of the transaction to be sent
bytes payload = 1;

// The key of the Sender
string from = 2;


// The keys of all the Receipients who are privy to the transaction
repeated string to = 3;
}

// Response from the server for the SendRequest
message SendResponse {
// The transaction hash is returned
bytes key = 1;
}

Then to define an endpoint to use these messages we simply use the following:

service Client {

// Used to store a transaction in the Chimera node
rpc Send(SendRequest) returns (SendResponse);


// Other endpoint definitions...

}

The previous Constellation API is still fully supported, however, this transition to protobuf+gRPC drastically simplifies implementation to the API. The Quorum -> Constellation and Constellation to Constellation API was something of a mystery to many for some time. Now you can see the message definitions as protobufs and gRPC definitions.

You’ll see that the protobufs are in a separate repo — Chimera, more about that in the coming weeks.

We keen that other vendors working with enclave technologies will adopt similar well-defined APIs over protobuf+gRPC, which helps ensure better interop between projects.

We’ve also made available Docker images to make it really straightforward to work with Quorum and Crux.

As mentioned at the start of this post we have a sample 4 node Quorum network using Crux. This is using gRPC for all Quorum to Crux communication.

We also have a 2-node Crux only network to working with the Crux API.

Then finally for those of you who cannot use Docker, we also have an updated version of the Quorum 7-nodes example using Crux on a Vagrant VM.

We’re investing heavily in the development of Crux going forwards, as we believe that enterprises will continue to require off-chain private transaction storage solutions which is where Crux comes in.

If you’d like to have a chat about Crux or anything else that we’re doing, please feel free to get in touch via the Quorum Slack #crux channel, or email hi@blk.io.