Photo by Chris Ried on Unsplash

Technical Intro to Blockchain (Part 2)

Oxford Blockchain Society
Oxford Blockchain
Published in
3 min readNov 4, 2020

--

“Remember, Solidity is a typed language.”

— Laurence Kirk of Extropy.io

On the 3rd of November, the Oxford Blockchain Society hosted its third event of the year — an Intro to Blockchain (for technical folk) in collaboration with OxWEST. This event was led by Laurence Kirk, Founder of Extropy.io — a blockchain development consultancy based in Oxford, and is part of a four-part series on blockchain. Join us for a look into how blockchain works and how to start understanding and using the technology. We’ll go through everything from smart contracts to running nodes and building dapps (decentralised apps).

First steps in Solidity with Remix IDE

About the talk

Before we got into the nitty gritty blockchain stuff, Anthony Beaumont from Encode Club introduced an upcoming 10-week long hackathon. We greatly encourage you to take part as the prizes available are huge and last year’s winner came from Oxford! Remember to register by the 9th of November. Laurence delved deeper into the topics (cryptography, trust, and consensus) introduced in Part 1, with their application to smart contracts. We got our feet wet with a bit of coding in Solidity using the Remix Integrate Development Environment (IDE). Not before long, Laurence had taken us through Constructors to events and logging. Questions included: what role does identity play when taking part in a game of rock paper scissors on blockchain, how easy is it to setup your own token and what happens if your smart contract written is wrong. The session was rounded off with the “Do’s and Don’ts” of smart contract writing. The slides and video are below. There is more excellent educational material at http://extropy.foundation. We hope to see you at the next one!

Intro to Blockchain (technical) Part 2, with Laurence Kirk from Extropy.io

Slides

http://bit.ly/blockSoc2

Code

Some key code snippets pasted in the chat by Laurence which you can use in the Remix IDE:

uint256 score;function getScore()  view  public returns(uint256) {
return score;
}
function setScore(uint256 _score) public returns(uint256 ){
score = _score;
return score;
}
modifier onlyOwner {
if(msg.sender == owner){
_;
}
}
constructor () {
owner = msg.sender;
}
event ScoreSet(uint256 indexed);

The score.sol file:

pragma solidity ^0.7.0;
// SPDX-License-Identifier: MIT
contract Score {

uint256 score;
address owner;
string name;
struct UserDetails {
string name;
string age;
}
mapping (address => uint256) scoreForUser;
address [ ] leaderBoard;
modifier onlyOwner {
if(msg.sender == owner){
_;
}
}

event ScoreSet(uint256 indexed );


constructor () {
owner = msg.sender;
}
function getScore() view public returns(uint256) {
return score;
}

function setScore(uint256 _score) public onlyOwner {
score = _score;
emit ScoreSet(score);
}


}

As always remember to comment your code, here Nikki helped us all out with a tip using “///”:

18:24:44  From Nikki : /// allows you to make notes :) for anyone making note of what the code is doing

Here is the link to the Open Zeppelin library for blockchains:

https://github.com/OpenZeppelin?page=1

Free ETH

We gave out 0.1 ETH to one lucky attendee! We’ll do this at each event!

Future events

We have 3 more technical workshops on how to code with blockchain planned as well as a ‘how to buy/maintain/invest in crypto’ event. Stay tuned and visit our Eventbrite!

Join us!

This year’s President is Brandon Severin, a PhD student researching A.I. for Quantum Computing. We’re looking for keen beans to join the committee and help advance and educate about blockchain. If you’re interested, email president@oxfordblockchain.co.uk

Mailing List

Sign up via our new website (ooo) — www.oxfordblockchain.co.uk

Looking forward to seeing you at the next one. — Best, Brandon Severin

--

--

Oxford Blockchain Society
Oxford Blockchain

Fostering Oxford’s blockchain ecosystem by maintaining a distributed “Oxford Blockchain Network” of students, academics and industry actors since 2016.