Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Ethereum Smart Contract Development

You're reading from   Ethereum Smart Contract Development Build blockchain-based decentralized applications using solidity

Arrow left icon
Product type Paperback
Published in Feb 2018
Publisher Packt
ISBN-13 9781788473040
Length 288 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Mayukh Mukhopadhyay Mayukh Mukhopadhyay
Author Profile Icon Mayukh Mukhopadhyay
Mayukh Mukhopadhyay
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Title Page
Dedication
Packt Upsell
Contributors
Preface
1. Blockchain Basics 2. Grokking Ethereum FREE CHAPTER 3. Hello World of Smart Contracts 4. A Noob's Guide to DApps and DAO 5. Deep-Diving into Smart Contracts 6. Solidity in Depth 7. Primer on Web3.js 8. Developing a Cryptocurrency from Scratch 9. Enterprise Use Cases 10. BaaS and the Dark Web Market 11. Advanced Topics and the Road Ahead 1. Other Books You May Enjoy Index

Designing an ownership contract


Ownership contracts have a wide number of real-life applications. But what is an ownership contract? Basically, these are smart contracts that can prove the ownership of a file without revealing the content of the file. As the contracts run on a blockchain, they can prove that a contract existed at a particular timestamp and check the document's integrity.

The integrity of a file is achieved by storing a hash of the file along with the file owner's name in the form of a key-value pair. The hash helps us to prevent fraud of ownership because any tampering with the file's content will give rise to a completely new hash value. Figure 7.11 shows a solidity implementation of the ownership contract:

Figure 7.11: Ownership smart contract

The corresponding web3.js file shown in Figure 7.12 can be embedded inside a JavaScript file:

Figure 7.12: Web3.js equivalent of a solidity contract

As you can see, we have not gone into the details of implementing this Web3.js equivalent...

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 $15.99/month. Cancel anytime
Visually different images