Smart Contract PowerPoint Slides
BARTS
The Blockchain ART Simulation (BARTS) is used to illustrate the interrelationship of blockchain mining, cryptocurrency, and hashing concepts. The hash algorithm SHA3 is used in cryptocurrency mining to make sure that there is no cheating, double spending, and to eliminate denial of service attacks. A miners job in the blockchain is to find a nonce value that when appended with the other data comes up with a SHA3 hash that has a predetermined number of leading zeros.
BARTS Simulation:
Step 1: Identify Artists and Gallery Owners
We will be asking for volunteers to be artists and gallery owners. Don’t worry if you’re not a good artist. Each artist will be given a copy of the BARTS transaction paper along with a number 2 pencil. The BARTS transaction sheet is on the back of this sheet.
Step 2: The instructor will tell the artists to start drawing
Each artist will start drawing their artwork, and then the gallery owners will bid anywhere from 1 to 5 BARTS coins for each drawing. The first artist and gallery owner that agree on the amount will then fill out the BARTS transaction sheet and deliver to the instructor.
Step 3: Start the Mining Process
The instructor announces the information that needs to be mined. Each member of the class that is not an artist or gallery owner will use the BARTS Mining Program at https://tinyurl.com/BARTSMining to generate a hash with a leading zero. The individual that finds a hash with a leading zero yells out “EUREKA.”
Step 5: Instructor Adds Valid Transaction to the Ledger
The instructor asks the individual that yelled Eureka what nonce value generated the leading zero. If the transaction is validated by at least two other miner pools, the instructor will add the transaction to the blockchain at https://tinyurl.com/BARTSBlockchain.
What is a Smart Contract?
Smart contracts allow a transaction between a buyer and seller. The transaction can be for trading information or documents. All information transacted is immutable.
Smart Contract Layout
All smart contracts will begin with the following format.
- A header: pragma solidity 0.5.1;
- A body consisting of all the data and functions
Data Types
- Booleans
- true/false values
- Integers
- int/uint
- Address
- address
- Bytes
- byte
- arrays
- can consist of any of the above types. EX) byte[]
Other Documentation
Additional documentation on smart contract programming can be found at:
- Solidity Documentation (0.5.7) (Click to follow the link)
Smart Contract Template
Navigate to: Remix (Click on the word “Remix” to go to link)
Below is what the remix tool looks like.

pragma solidity 0.5.7;
pragma experimental ABIEncoderV2;
contract BARTS{
struct Painting{
string Sender;
uint Amount;
string Receiver;
uint Nonce;
}
mapping(uint => Painting) paintings;
uint index = 0;
function AddToLedger(string memory sender, uint amount, string memory receiver, uint nonce) public{
require(amount < 10);
Painting storage painting = paintings[index];
painting.Sender = sender;
painting.Amount=amount;
painting.Receiver = receiver;
painting.Nonce = nonce;
index = index+1;
}
function RetrieveFromLedger(uint indexval) public view returns(string memory, uint, string memory, uint){
}
function GetAllLedgerData()public view returns(string[] memory, uint[] memory, string[] memory, uint[] memory){
// string[] memory Senders = new string[](index);
string[] memory Senders = new string[](index);
uint[] memory Amount = new uint[](index);
string[] memory Receiver = new string[](index);
uint[] memory Nonce = new uint[](index);
for(uint i=0; i<index; i++){
Painting storage painting = paintings[i];
Senders[i]=painting.Sender;
Amount[i] = painting.Amount;
Receiver[i] = painting.Receiver;
Nonce[i] = painting.Nonce;
}
return (Senders, Amount, Receiver, Nonce);
}
}