Docker Smart Contracts

In addition to contracts implemented on the basis of RIDE scripts for smart accounts and smart-assets, the Waves Enterprise platform provides the option to develop and use Turing-complete smart contracts. To implement Turing-complete contracts, applications are launched within an isolated Docker container environment. Inside this isolated environment, applications can be developed using any programming language. Each application is launched in a Docker container to ensure isolation and manage resources available to any particular application. To store smart contracts, a Docker Registry with read-only access (Docker images) to contracts is used for machines with nodes. The node state can be accessed through a REST API or gRPC framework.


Users must run the Docker-engine and the Docker-daemon simultaneously on the node which is processing the Docker smart-contracts.


Creating a contract

Creating a smart contract starts with the preparation of a Docker image, which consists of the contract program code, the required environment, and the special scenario Dockerfile. A prepared Docker image is then assembled and sent to Docker Registry.

Dockerfile sample for REST API usage:

FROM python:alpine3.8
RUN chmod +x
RUN apk add --no-cache --update iptables
CMD exec /bin/sh -c "trap : TERM INT; (while true; do sleep 1000; done) & wait"

Dockerfile sample for gRPC usage:

FROM python:3.9-rc-buster
RUN pip3 install grpcio-tools
ADD src/ /
ADD src/protobuf/ /protobuf/
ADD src/protobuf/ /protobuf/
ADD src/protobuf/ /protobuf/
RUN chmod +x

The contract is created by publishing a special (CreateContractTransaction) transaction containing a link to the image in Docker Registry. To use the REST API or gRPC, please, specify the transaction version 103. After the transaction is received, the node downloads the image using the link specified in the “image” field, the image is checked and launched as a Docker container.

Executing a Contract

Smart contract execution is initiated by a special (CallContractTransaction) transaction containing the contract ID and call parameters. The transaction ID defines the Docker container. The container is executed unless it has been launched before. The contract launch parameters are transferred to the container. | Smart contracts change their state by updating the key-value pairs.

Updating Contract

Only the developer of the Docker smart contract can update this contract. The developer should keep the contract_developer role during the contract update and should be the 103 transaction creator. 107 transaction is using for the contract update. And it is necessary that the contract is active.

All the mining nodes download the contract image and run it for the checking after the 107 transaction includes into the block. Then the 105 transaction is issued within the 107 transaction inside it.

Contract Call Disabling

If necessary, the contract developer can disable calling the contract. To do this, a special (DisableContractTransaction) transaction is published specifying the Contract ID. The contract becomes unavailable after its disconnection, but you can get information about the contract from the the blockchain later.

Description of Transactions

The following transactions are implemented to ensure the interaction between the blockchain and the Docker Contract:


Transaction type




Initiates the Contract. Transaction is signed by a user with the role “contract_developer”



Calls the Contract. Transaction is signed by the initiator of contract execution



Records the contract execution result in the contract state.
Transaction is signed by the block generating node



Disables calling a contract.
Transaction is signed by a user with the role “contract_developer”



Updates a contract.
Transaction is signed by a user with the role “contract_developer”
Only the contract developer and 103 transaction issuer can update the contract

Node configuration

Downloading and execution of Docker Contracts initiated by transactions with codes 103-107 are performed on nodes with enabled option docker-engine.enable = yes (for details see module “Node configuration” > “Docker configuration”).


The REST API methods description for the Docker contract usage is represented on the API methods available to smart contract page.


The gRPC methods description for the Docker contract usage is represented on the gRPC services available to smart contract page.

Implementation examples