CoZ dApp Comp #1
7th place

Turing Complete Smart Contract

A Turing complete smart contract on NEO

A computationally universal and programmable decentralized application along with a decentralized persistent program library on the NEO blockchain.

person
Developer

Nikolaj-K

YouTube
View channel

Developer Q&A

Can you describe the Turing Complete Smart Contract?

Nikolaj-K: My contest entry doesn't represent a business model but an innovation. This is why it's a bit hard to pitch it to a general audience. So let me try something else:

Say you don't own a toaster but you visited your friends for brunch and realized how good toast can be. What you want in your life is a kitchen with your own toaster. So you open a wall in your house, make room for another kitchen, and buy a kitchen that includes a toaster. Wait, what? No, of course you'd just buy a toaster and place it in your already existing kitchen!

But as things are today, people really buy new kitchens to update their kitchen. A smart contract has no moving parts. People code them and deploy the script to the blockchain. The idea of having a Turing complete dApp is to be able to code a program within a framework that is already deployed. You can write a smart contract without deploying one.

When you want to get a program from your computer in pre-blockchain world, you either download it and eventually execute a file (e.g. "tetris.exe") or you run it in your browser, in which case you actually run it on someone else's computer (server). With decentralized apps that you can invoke from your computer or an app, you run a program by running on an unspecified computer - a node in the blockchain protocol network. As it's a new technology, the range of existing such programs is quite limited as of yet. From a technical perspective, my contribution was a somewhat obvious extension. It was bound to be done, but here's a caveat: The contract I wrote is extremely inefficient - but the idea can and should be taken seriously and will be picked up eventually.

Continued...

Can you outline the basic functionality of your Turing complete smart contract?

Nikolaj-K: So more concretely, you upload a sort of machine code to the storage of the blockchain in the context of the Turing dApp. I showcase the upload and execution in the video, where I do stuff like adding two numbers of computing whether a string is of length 2^n for some n. But in principle you can do anything, really.

Who will use your Turing complete smart contract and how will they benefit?

Nikolaj-K: My contract: nobody. The concept: everybody. It will be a way of programming, but I'm not sure if current platforms are best suited for that.

What are some of the obstacles that need to be overcome from technology point of view before Turing complete smart contracts are a practical option for building applications?

Nikolaj-K: Like with any language, you want your words fine tuned to your needs. If "you", "and" as well as "to" were 12 letter words in English, writing English would be unpractical. In an object oriented language like Java, often "." denotes you want to use a method of an object instance. In a functional language like Haskell, they use "." for function concatenation. Meanwhile, those two operations don't even have a simple standard implementation in the other language,respectively. For blockchain purposes as we see now, you'd also want to "hotkey" operations, but even beyond that, tune the flow of programming. This holds for programming smart contracts in general, and in particular ones which would allow general purpose programming. Using Turing machines to exectue tasks is exactly what you should not do, and it is a big task to find out what the best thing to do (which language to use) is.

What do you think is the low hanging fruit for programmers who’ll start using Turing complete smart contracts? What would you envisions would be the most obvious early applications?

Nikolaj-K: For the scope of my current implementation here, finite state machines are easy to implement and those could be changed on the fly and this can have usecases, such as computing properties of data strings and making decisions based on them. Sorry if that's again quite abstract. Assuming we'd have a catering application, I'd like to see more computational/numerical functions being programmed and reprogrammed in such a framework. You'd use it to change algorithms. Given the broad scope of computation, this is hard for me to say. Realistically, as long as people continue to make disproportionate money from crypto, blockchain technology will not reach its true potential. Ideas need time to develop and need the chance to be replaced. I see both sides being blocked by the nature of capital investment.
.

In there any reason NEO might be more suitable for this type of programming than other smart contract platforms, or could you accomplish this on any of them?

Nikolaj-K: As demonstrated in my code, it's not hard to spin the Turing completness of the virtual machine into the Turing completness of a contract. That being said, there are not too many Turing complete blockchains to choose from and NEO is the best.

This idea is pretty out of the box. Did you know this would work before you started the project, and what led you to explore this concept?

Nikolaj-K: My initial plans were much more ambitious. I wanted to use the blockchain itself as the tape, the funds encoding the symbols, and the change of data be realized by funds moving around on NEO. To make this possible in a straight forward way, I'd want a NEP5 token, but then to do it all in one call, I might have to do recordings and computations inside the contract again and it would get out of hand.

What are your plans for ongoing development and adoption?

Nikolaj-K: Sadly, I'm already on to new projects. I'm coding a decentralized, trustless, open source, free, manifold voting app - https://github.com/Nikolaj-K/votingblock

What language did you use for development?

Nikolaj-K: C#

What SDKs, APIs or frameworks did you use to develop the Turing Complete Smart Contract?

Nikolaj-K: I used the NEO debugger and the NEO GUI-developer.

How would you describe your experience developing on the NEO platform?

Nikolaj-K: I'm not a programmer, so it was thrilling to feel this kind of working environment and I really like the people.

“Nikolaj's dApp submission presents not only a technically intriguing concept, but also an unlimited amount of potential. It is the first example of a computationally universal and programmable dApp on the NEO Blockchain, or any blockchain that I personally know of. Although not necessarily computationally efficient, this project sets the stage for a number of interesting implementations to follow in its footsteps.”

afong
City of Zion Council
city of zion

dApp comp #2

Pioneer the new smart economy.

LEArn more

Join the NEO Stack Exchange

The NEO Blockchain Stack Exchange site was proposed in order to give developers a place to ask questions, get answers, and discuss the NEO blockchain with each other. We're about halfway to getting the site to Beta status, and every commit to the proposal helps.

Commit to the proposal here!