Choice Coin Smart Contracts

Legal Notice
Copyright Brian Haney 2022
License: CC BY-NC-ND
These views are wholly my own and do not necessarily reflect the views of the Choice Coin DAO or the Choice Coin development team.

This post is dedicated to Choice Coin, the Algorand Foundation, and the development of open source smart contracts on Algorand.

Fundamentally, all contracts have three components. First, the parties must intend to exchange something of value. Second, there must be a meeting of the minds as to the exchange of value. Third, there must be a physical representation for the value exchange.

Blockchains are decentralized databases maintained by global computer networks. In fact, the structure of most blockchain networks consists of several computers called nodes, which are connected via the Internet and record transactions on a public ledger. In the words of scholar Primavera De Filippi, “blockchain technology constitutes a new infrastructure for the storage of data and the management of software applications, decreasing the need for centralized middlemen.” [1] An active and dynamic architecture, a blockchain is a distributed ledger which records transactions between parties across the Internet.

Smart Contracts
A smart contract is a new type of technology at the confluence of contracts and blockchains. The term smart contract is defined in wide variance among blockchain developers and professionals. For example, the Founder of Ethereum, Vitalik Buterin defines smart contract as, “systems which automatically move digital assets according to arbitrary pre-specified rules.”[1] Another example, the former MIT professor and current Commissioner of the SEC Gary Gensler, adopts Nick Szabo’s definition of smart contract, “A set of promises, specified in digital form, including protocols within which the parties perform on these promises.”[2] According to the Algorand Developer Portal, “Algorand Smart Contracts (ASC1) are small programs that serve various functions on the blockchain and operate on layer-1.”[3] Generally and for the purposes of Choice Coin technology, a smart contract is a computer program which transfers data between addresses on the blockchain using a digital signature.

Award Winning Smart Contracts
I started reading and writing about smart contracts in the year 2018. It wasn’t until the year 2020 that I actually started building them. I started by studying the mathematics behind decentralized transactions and publishing about blockchain technology. I’m more of an inventor than a programmer, I only ever start hacking to solve actual problems. In the early winter of the year 2021, I found a problem I wanted to solve: how can you create a smart contract that is both a business contract and a tool to facilitate peer-to-peer transactions on the blockchain?

In April of that year, I had the chance to compete in the 2021 MIT Bitcoin Expo Hackathon. At the Hackathon, one part of our submission to the Algorand Challenge was a smart contract. During the hackathon, I spun up a prototype for a new type of smart contract software using Python and a basic Tkinter interface. I was really proud of the prototype because I worked hard to build it, it solved a real problem and I could finally see what a smart contract should look like. With over 500 participants, I was shocked my simple smart contract ended up being the Hackathon’s Top Prize Winner.

Algogeneous Smart Contracts
After the Hackathon, we won an Algo Grant from the Algorand Foundation to continue our work building DAO infrastructure, including smart contracts. We hit every milestone and deliverable on the grant. Last summer, during our smart contracts phase we produced a research paper, patent application, open source software stack, and a demo video. Our core product was the Algogeneous smart contract, a new type of smart contract that takes a business perspective on blockchain transactions.

As summer turned to fall, I spent a few months focusing on voting technology. I realized that the smart contract software we built during our first phase would help to simplify the architecture for a new voting technology. It worked and we put out another research paper, another software stack with an open source license, filed another patent application, and then a third patent application in the spring.

Smart Contract Code
For working with smart contracts on Algorand, in my experience, the best resources for developers are the Software Development Kits (SDKs), particularly the Python-SDK and the JavaScript-SDK. Here’s an example of a smart contract for voting with the Python-SDK from the Voting Tutorial I wrote pro bono for the Algorand community.

def vote():
    voter = input(str("Vote 0 for zero and vote 1 for one:"))
    params = algod_client.suggested_params()
    if voter is str('1'):
        amount = 100
        vote_address = ""
        transaction = AssetTransferTxn(sender=voter_address, sp=params, receiver=vote_address, amt=amount, index=asset_id)
        signature = transaction.sign(voter_phrase)
        final = transaction.get_txid()
        print ("Thanks for voting for one.")
        amount = 100
        vote_address = ""
        transaction = AssetTransferTxn(sender=voter_address, sp=params, receiver=vote_address, amt=amount, index=asset_id)
        signature = transaction.sign(voter_phrase)
        final = transaction.get_txid()
        print ("Thanks for voting for zero.")

The smart contract is simple and even if you’re not a programmer, you can see the elements of a smart contract are met. There is a transaction:

transaction = AssetTransferTxn(sender=voter_address, sp=params, receiver=vote_address, amt=amount, index=asset_id)

A digital signature:

signature = transaction.sign(voter_phrase)

And a TXID representing the transaction on the blockchain:

final = transaction.get_txid()

The if statement gives you a Boolean vote, signing the transaction, sending a Choice from the voter address to one of two addresses depending on a user’s choice, and records the transaction on the blockchain. It’s a smart contract that anyone can understand.

Algorand Smart Contracts
There are a lot of ways to think about smart contracts on Algorand and on blockchains more generally. The main way the division is described in the documentation on Algorand is between stateless smart contracts and and stateful smart contracts.

Stateless smart contracts validate transactions between parties, like an escrow. Stateful refers to the contract’s ability to store information in a specific state on the network. For example, one type of stateful smart contract is a request payment function, allowing a user to request payment from another user. Another example of Algorand smart contracts are TEAL smart contracts. TEAL smart contracts allow for more automation in the transactional process between parties. The reason we need to create new types of smart contracts for Choice Coin is because we need to build our own tools to solve the technical problems we’re facing in building DAO infrastructure.

Compliance and Ethics
In addition to my work in R&D, I have also been working very hard to ensure that Choice Coin has the leading compliance and ethics program on Algorand. And we do, it isn’t even close - we are building our own open source Compliance AI. I’m consistently up late working on our compliance software, writing memorandum, reading the latest reports and cases from the SEC and DOJ, and building new technologies to ensure we’re following the law to the best of our ability. We’re not just aiming to follow the law, we take real action to go above and beyond, excelling in organizational ethics. For example, our compliance repository on GitHub maintains an open source database of information relating to digital asset compliance.

Choice Coin
Algorand is a special place because it’s a place where opportunity is alive and entrepreneurs can thrive. Over the past year, Choice Coin has grown with great success to the largest open source software project on the Algorand blockchain. We have over 100 contributors around the world and our Voting Repo alone has 78 contributors.

Smarter Contracts Bash
Gold Badge | 150,000.00 Choice
Silver Badge | 105,000.00 Choice
Bronze Badge | 35,000.00 Choice

Smart Contract Demo | 2021 MIT Bitcoin Hackathon Winner
2021 Algogeneus Smart Contracts
How to do a Pull Request

Algogeneous Smart Contracts and Vote 2
Choice Coin Road Map

Algorand Forum
Choice Coin DAO R&D
Choice Coin: A Solution to the Decentralized Governance Problem

Choice Coin Security Audit
Choice Coin Voting dApp | Apache License
Choice Coin Smart Contracts | Apache License
Choice Coin Voting | Apache License
Choice Coin Compliance | Apache License
Choice Coin TEAL | Apache License
Voting Tutorial | Developer Portal Article | Apache License
Solidity Smart Contracts | Apache License
Algorand Autonomous | 2021 MIT Bitcoin Hackathon Winner | Apache License

Research Papers
Decentralized Decisions on Algorand with Choice Coin
Smart Contracts on Algorand
Applied Natural Language Processing for Law Practice
Cryptosecurity: An Analysis of Cryptocurrency Security and Securities
Algorand Autonomous | 2021 MIT Bitcoin Hackathon Winner
Choice Coin White Paper

Patent Applications
U.S. Patent No. 17,375,542, Algogeneous smart contracts (July 14, 2021).
U.S. Patent No. 17,410,676, Decentralized voting using quantum intelligence (August 24, 2021).
U.S. Patent No. 17,483,297, Deep intelligence for decentralized finance (September 23, 2021).
U.S. Patent No.17,559,519, Voting using Choice Coin on a Blockchain (December 22, 2021).

2020 Stanford Law School Transatlantic Technology Law Fellowship | Published Research
2021 MIT Bitcoin Hackathon Infrastructure Track Top Prize
2021 MIT Bitcoin Hackathon Algorand Challenge Winner
2021 MIT Bitcoin Hackathon Sia Skynet Challenge Winner
2021 Algorand Foundation Grant Winner: Algorand Autonomous
2021 Algorand Foundation Grant Winner: Choice Coin
2022 Algorand Foundation Grant Winner: Choice Coin v2

High Technology Patents | Chapter 8 Blockchain

Final Comments
Let’s build something great.

Additional Resources on Smart Contracts

Gary Gensler | MIT OpenCourseWare | Smart Contracts and dApps
Restatement (Second) of Contracts § 17 (1979).
Lawrence Lessig, Code is Law (January 1, 2000).
Massimo Bartoletti, A formal model of Algorand smart contracts (2021).
Silvio Micali, Efficient Smart Contracts at Scale: Algorand’s Stateful Teal Contracts 2 (2020).

Smart Contract Memes


Well, I haven’t seen anywhere they included a statement saying the voting software was a smart contract which they indicated that it was built using Algorand JavaScript SDK.

Choice Coin’s repository is home to varieties of projects, which “smart contract” includes…

I’d suggest you examine your statements and quit spreading false information.


Hi Brian,

Please read here Smart contract details - Algorand Developer Portal so you can get an understanding of what a smart contract is. I find it quite unusual how you aren’t using smart contracts for implementing your use case.

**Algorand smart contracts are pieces of logic that reside on the Algorand blockchain and are remotely callable. **


This is completely false. Choice Coin is not an investment and we do not have or accept investors. Choice is a governance asset for voting. No one should treat Choice Coin as an investment. Please read our Terms and Conditions.


At Vote Coin we also use algorand to store the voting data (as for example in algorand governance)… we have standard for this… We also do not use the smart contracts right now, but we are creating system like snapshot for DAO management… with difference to snapshot we store the data to the blockchain which is fully auditable forever

Choice Coin works the way that you issue ASA for each voting, and deliver this asa to each voting participant. He may vote by submitting this asa to specific address. The balance at some round is the result of the voting.

Vote Coin uses the note field as data storage. Vote coin DAO questions can run in parallel, user can change his vote in progress (the round when voting session ends is definitive for 1$=1vote results). Vote coin allows categorized partial delegation of voting power, which makes it quite efficient for DAOs to make a decisions with broader participation levels. Recently we have included in the specifications system for encrypted voting, and it has been implemented and used in production. Data are stored onchain, but real result calculation is done offchain, and submitted backed to the chain so that smart contracts or other apps can use that specific result message.
Btw, everything is open source, and free to use… See the specs.


New introductory video on smart contracts YouTube.

1 Like

The video is titled: Introduction to Smart Contracts

1 Like

Nope. Just a title for an introductory video about smart contracts. My apologies you are so offended by the content. Best of luck to you.

1 Like

Nope. I just made an introductory video about smart contracts.

1 Like

Dear @AngelsOfAres,

We encourage discussing technical aspects of solutions provided by community members and highlighting their strengths and potential weaknesses, since this allows to improve these solutions and this enables people to understand better the different technical trade-offs.

However, we want all discussion to stay professional and strongly condemn any ad-hominem attacks and inappropriate language.

We have removed the offending messages and ask you to stay courteous and professional in your subsequent messages.