Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Blockchain Quick Start Guide

You're reading from   Blockchain Quick Start Guide A beginner's guide to developing enterprise-grade decentralized applications

Arrow left icon
Product type Paperback
Published in Dec 2018
Publisher Packt
ISBN-13 9781789807974
Length 222 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Xun (Brian) Wu Xun (Brian) Wu
Author Profile Icon Xun (Brian) Wu
Xun (Brian) Wu
Weimin Sun Weimin Sun
Author Profile Icon Weimin Sun
Weimin Sun
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Introduction to Blockchain Technology FREE CHAPTER 2. Ethereum Fundamentals 3. Overview of Solidity Programming 4. Building an Ethereum Blockchain Application 5. Exploring an Enterprise Blockchain Application Using Hyperledger Fabric 6. Implementing Business Networks Using Hyperledger Composer 7. Blockchain Use Cases 8. Other Books You May Enjoy

Common smart contract patterns

In this section, we will discuss some common design and programming patterns for the smart contract programming language.

Access restriction

Access restriction is a solidity security pattern.  It only allows authorized parties to access certain functions. Due to the public nature of the blockchain, all data on the blockchain is visible to anyone. It is critical to declare your contract function, state with restricted access control, and provide security against unauthorized access to smart contract functionality.

pragma solidity ^0.4.24;
contract Ownable {
address owner;
uint public initTime = now;
constructor() public {
owner = msg.sender;
}
//check if the caller is the owner of the contract...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime