Signum Smart Contracts
What is a Smart Contract?
A smart contract is a computer protocol that facilitates, verifies, and enforces the negotiation and performance of an agreement, a concept first proposed by Nick Szabo in 1996.
This technology involves presetting terms that both parties to a contract must meet. It procedurally eliminates certain roles that might otherwise require the services of legal representatives, notaries, or executors. For this reason, smart contracts are a disruptive technology for the future digital economy.
Smart contracts preset terms that both parties to a contract must meet. They procedurally eliminate certain roles that legal representatives, notaries, or executors might otherwise need to fill. For this reason, smart contracts are a disruptive technology for future digital economies.
In 2018, a US Senate report said: “. . . the concept is rooted in basic contract law. Usually, the judicial system adjudicates contractual disputes and enforces terms, but it is also common to have another arbitration method, especially for international transactions. With smart contracts, a program enforces the contract terms that are built into the code.
|Per 100 Executions||5.145||10.29||1,470|
.000735 Signa per contract
.000735 Signa per page of complied code (up to 20 pages per contract). Each page can contain up to 256 bytes.
.000735 Signa for each operation up to a maximum of 1,000,000 per contract per block. For excess steps, the state is stored and execution resumes in the next block.
Signum Smart Contracts
Signum added Turing-complete smart contracts to its blockchain 2014 in the form of Automated Transactions (AT) as proposed and implemented by CIYAM. Signum’s blockchain is a distributed database (public ledger) whose consistency and validity is secured by miners and verified by a majority of the participating network nodes. These nodes run the contract code, and the results are subject to the same verification process as any other transaction on the network.
As a Turing-complete formalism, ATs are both powerful (expressiveness) and dangerous (verifiability). Because of the expressiveness, the potential for advanced applications is unlimited. However, they must be designed carefully to avoid situations like the DAO debacle that led to the split between Ethereum and Ethereum Classic.
Signum was the first cryptocurrency to implement a Turing-complete blockchain-based smart contract system in a live environment. In January 2015, it initiated the world’s first decentralized lottery, the first program to run on a blockchain in a trustless and decentralized manner. In this early implementation, creating (or programming) smart contracts required writing (assembler-like) bytecode and testing on-chain, making development cumbersome.
Signum smart contracts have the unique features of being able to self-execute and to run at set times. Most smart contract implementations can only react to transactions that they receive.
In 2019, BlockTalk was created to make smart contracts on the Signum blockchain more accessible for developers. It allowed writing, debugging, and deploying smart contracts using Java and a simple text editor or preferred IDE. Since 2019, development of this platform has continued resulting in an advanced product referred to as Signum SmartJ. This smart contracts platform, and others being developed for additional programming languages, are complemented by Signum’s permanent TestNet.
Signum Smart Contract Basics
Signum’s autonomous smart contracts execute the terms of a contract based on if-then-else statements. The programming is always followed and the execution is unstoppable. A task is executed if certain conditions are met and not executed if the conditions are not met. They provide a conflict-free transparent way to exchange money, property, shares, or anything of value while avoiding the need for 3rd party services.
Smart Contracts allow negotiation of and agreement to a contract’s code in advance and confidence that it will be completed as requested if it is summited to the network. After it is submitted to the network, it cannot be changed. The execution of the code is public and verifiable.
Properly implemented, Signum smart contracts can provide a high degree of individual autonomy as well as efficiency. There is no need to rely on 3rd parties which can introduce the risk of manipulation to the process. Because contract execution is managed automatically, there is also a significant time saving for most business processes.
Many risks are mitigated when using Signum smart contracts. For example, documents become immutable when they are duplicated many times over on a shared ledger. This also eliminated the risk that documents can be lost.
To learn more about Signum smart contracts, review the documentation provided by CIYAM.
Signum Smart Contract Example
There are many use cases for blockchain-based smart contracts. This example sets a starting price in a smart contract programmed to operate as a decentralized auction.
- The smart contract accepts bids in the form of fully funded transactions.
- Each time the smart contract receives a larger bid, the previous transaction is automatically refunded.
- At the block height specified, the winner of the auction is finalized.
- Depending on the property type, the property’s distribution can also be automated by the smart contract.
This example illustrates several ways that an auction-based on smart contracts has an advantage over a traditional auction. In a standard auction, the highest bidder may not be able to complete the purchase. This a significant risk to the auction operation as the second-highest bidder may no longer be available, and another auction might be necessary.
The smart contract eliminates this risk by accepting only fully funded transactions rather than bids that may or may not be funded after a traditionally held auction is complete.
The bidder can be confident that non-winning bids will be returned because the code for the smart contract is publicly available for verification.
Additional use case examples for decentralized smart contracts include atomic cross-chain transactions, crowdfunding, decentralized gaming, and many other applications. Many examples are already running on the Signum network such as:
- BTDEX – A decentralized cryptocurrency that is based on Signum’s smart contracts.
- Cryptoball – A fun game developed to showcase autonomous smart contracts at work on the Signum Network.
- dAPPOSITORY – An online storefront for applications that operates using Signum’s smart contracts.
Signum SmartJ is a platform for writing java based smart contracts to run on the Signum blockchain. It consists of the following key components:
- Contract.java: a Java abstract class defining the basic API available for contracts
- Emulator: an emulated blockchain and respective UI
- Compiler: a system to convert Java bytecode into Signum AT bytecode that can run on the Signum blockchain
Samples can be found in the samples source folder.
The SODIUM hard-fork (Signum Node version 2.5 and above) allowed much more powerful smart contracts to run on the Signum blockchain, for more information, see CIP20.
The internal AT (automated transaction) and escrow account executes automated transactions and escrow payments. As an internal intermediary, it cannot be the sender or recipient of a transaction. The account has the numeric ID 0 and a Signum address S-2222-2222-2222-22222.
Note: If this account’s balance is shown in a block explorer, it is only the block explorer’s interpretation of the intermediary state. The balances shown do not affect the total supply of Signum.