100% found this document useful (4 votes)
161 views

Instant ebooks textbook Hands On Smart Contract Development with Solidity and Ethereum From Fundamentals to Deployment 1st Edition Kevin Solorio download all chapters

Fundamentals

Uploaded by

bongahkique
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
161 views

Instant ebooks textbook Hands On Smart Contract Development with Solidity and Ethereum From Fundamentals to Deployment 1st Edition Kevin Solorio download all chapters

Fundamentals

Uploaded by

bongahkique
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Get ebook downloads in full at ebookmeta.

com

Hands On Smart Contract Development with Solidity


and Ethereum From Fundamentals to Deployment 1st
Edition Kevin Solorio

https://ebookmeta.com/product/hands-on-smart-contract-
development-with-solidity-and-ethereum-from-fundamentals-to-
deployment-1st-edition-kevin-solorio/

OR CLICK BUTTON

DOWNLOAD NOW

Explore and download more ebook at https://ebookmeta.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Blockchain and Ethereum Smart Contract Solution


Development: Dapp Programming with Solidity 1st Edition
Weijia Zhang
https://ebookmeta.com/product/blockchain-and-ethereum-smart-contract-
solution-development-dapp-programming-with-solidity-1st-edition-
weijia-zhang/
ebookmeta.com

Hands-On Smart Contract Development with Hyperledger


Fabric V2: Building Enterprise Blockchain Applications 1st
Edition Matt Zand
https://ebookmeta.com/product/hands-on-smart-contract-development-
with-hyperledger-fabric-v2-building-enterprise-blockchain-
applications-1st-edition-matt-zand/
ebookmeta.com

Building Games with Ethereum Smart Contracts: Intermediate


Projects for Solidity Developers Kedar Iyer

https://ebookmeta.com/product/building-games-with-ethereum-smart-
contracts-intermediate-projects-for-solidity-developers-kedar-iyer/

ebookmeta.com

Axisymmetry in Mechanical Engineering 1st Edition Emanuel


Willert

https://ebookmeta.com/product/axisymmetry-in-mechanical-
engineering-1st-edition-emanuel-willert/

ebookmeta.com
Metal Nano 3D Superlattices Synthesis Properties and
Applications 1st Edition Marie-Paule Pileni

https://ebookmeta.com/product/metal-nano-3d-superlattices-synthesis-
properties-and-applications-1st-edition-marie-paule-pileni/

ebookmeta.com

Digital Research Methods for Translation Studies Julie


Mcdonough Dolmaya

https://ebookmeta.com/product/digital-research-methods-for-
translation-studies-julie-mcdonough-dolmaya/

ebookmeta.com

Physics of Biological Action and Perception 1st Edition


Mark L. Latash

https://ebookmeta.com/product/physics-of-biological-action-and-
perception-1st-edition-mark-l-latash/

ebookmeta.com

Dragon s Tears 1st Edition Eva Chase

https://ebookmeta.com/product/dragon-s-tears-1st-edition-eva-chase/

ebookmeta.com

Stroke Pathophysiology Diagnosis and Management 5th


Edition J P Mohr MS MD Stroke Pathophysiology Diagnosis
And Management 5Th Edition J P Mohr Ms Md
https://ebookmeta.com/product/stroke-pathophysiology-diagnosis-and-
management-5th-edition-j-p-mohr-ms-md-stroke-pathophysiology-
diagnosis-and-management-5th-edition-j-p-mohr-ms-md/
ebookmeta.com
Paving the Way: The First American Women Law Professors
(Law in the Public Square Book 1) 1st Edition Kay

https://ebookmeta.com/product/paving-the-way-the-first-american-women-
law-professors-law-in-the-public-square-book-1-1st-edition-kay/

ebookmeta.com
Hands-On
Smart Contract
Development
with Solidity & Ethereum
From Fundamentals to Deployment

Kevin Solorio,
Randall Kanna
& David H. Hoover
Hands-On Smart Contract
Development with Solidity and
Ethereum
From Fundamentals to Deployment

Kevin Solorio, Randall Kanna, and David H. Hoover

Beijing Boston Farnham Sebastopol Tokyo


Hands-On Smart Contract Development with Solidity and Ethereum
by Kevin Solorio, Randall Kanna, and David H. Hoover
Copyright © 2020 Kevin Solorio, Randall Kanna, and David H. Hoover. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://oreilly.com). For more information, contact our corporate/institutional
sales department: 800-998-9938 or [email protected].

Editor: Michelle Smith Indexer: Ellen Troutman-Zaig


Production Editor: Kristen Brown Interior Designer: David Futato
Copyeditor: nSight, Inc. Cover Designer: Karen Montgomery
Proofreader: Charles Roumeliotis Illustrator: Rebecca Demarest

December 2019: First Edition

Revision History for the First Edition


2019-11-25: First Release

See http://oreilly.com/catalog/errata.csp?isbn=9781492045267 for release details.

The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Hands-On Smart Contract Development
with Solidity and Ethereum, the cover image, and related trade dress are trademarks of O’Reilly Media,
Inc.
The views expressed in this work are those of the authors, and do not represent the publisher’s views.
While the publisher and the authors have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions contained in this work is at your own
risk. If any code samples or other technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.

978-1-492-04526-7
[LSI]
Table of Contents

Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

Part I. Intro to the Ethereum Blockchain


1. Blockchain Concepts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
A Brief History 4
The Character of a Blockchain 5
Decentralized Networks 5
Consensus Protocols 6
Transaction Processing 9
Transaction Finality 11
Hard Forks 13
Ethereum Fundamentals 14
Ether and Gas 14
Accounts 17
Contracts 17
Blocks and Transactions 18
What Time Is It? 19
Signing Transactions 21
Summary 22

2. Decentralized Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Tokens 23
ERC-20 23
Non-Fungible Token (ERC-721) 25
Supply Chain 26
Permanent Records 28

iii
Evaluating Blockchain for Your Application 29
Verifiable 29
Transparent 29
Resilient 29
Summary 30

3. Before We Get Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31


Ethereum Clients 31
Installing Parity 32
Installing MetaMask 33
Installing Node.js 42
Ubuntu Installation (Including Windows WSL Ubuntu) 42
Mac Installation 43
Installing the Truffle Suite 44
Truffle 44
Ganache 45
Summary 46

Part II. Developing Smart Contracts


4. Our First Smart Contract. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Setup 49
Our First Test 50
Saying Hello 54
Making Our Contract Dynamic 56
Making the Greeter Ownable 62
Summary 69

5. Deploying and Interacting with Contracts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71


Contract Compilation and Deployment 71
Deployment Process 72
Setting Up the UI 73
Deploying to Ganache 74
Deploying to Goerli with Parity 80
Deploying to Rinkeby with Infura 84
Summary 86

6. The Fundraiser Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87


Application Overview 87
Creating the Project 91
Initializing Fundraisers 93

iv | Table of Contents
Setting the Beneficiary and Custodian 101
Editing the Beneficiary 104
Making Donations 109
Structs 111
Mappings 112
Donation Tests 112
myDonations 116
Fundraiser Totals 119
Events 124
Withdrawing Funds 126
Fallback Functions 131
Summary 134

7. FundraiserFactory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Migrating Our FundraiserFactory 135
Creating Fundraisers 137
Viewing Available Fundraisers 142
Testing Pagination When Empty 142
Testing the Limit 144
Testing the Offset 147
Setting Up the UI 151
Summary 152

Part III. Interacting with Our Smart Contracts Through Web3


8. What Is Web3?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
The Frontend, Web3, and the Blockchain 155
Web3 Methods 156
getAccounts() 156
getBlockNumber() 156
getBalance() 156
sendTransaction() 157
Providers 158
Promises with Web3 158
MetaMask for Web3 Injection 160
Send (State Updates/Write) 160
Call (Reads) 160
Summary 161

9. Connecting the UI to Our Contracts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163


Why React? 163

Table of Contents | v
Dev Setup 164
Truffle 165
React Truffle Box Setup 166
Importing our Greeter Contracts 172
Adding Our Greeter Contract Functionality 173
Setting Our Greeting Through React 175
Summary 176

10. Our Larger DApp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179


Starting with React Truffle Box 179
Fundraiser Setup 182
React Routing 185
React and Material UI 189
Creating Our New Fundraiser Page View 191
Displaying the Current Fundraisers List 195
Summary 201

11. Finishing Our Fundraiser UI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203


Adding Detailed Information About Each Fundraiser 203
Implementing a Material UI Dialog 205
Accepting a Donation with React 208
Testing a Donation 212
Displaying the Current ETH Exchange Rate 214
Generating a Donation Receipt for Our User 218
Handling a Withdrawal from Our Contract 224
Adding Edit Beneficiary to the Contract 230
Summary 231

Part IV. Securing Your Smart Contracts


12. Smart Contract Security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Why Do We Need to Worry About Security? 235
Types of Smart Contract Vulnerabilities 236
Unprotected Function 236
Transaction Ordering Dependence 236
Integer Overflow and Underflow 237
Reentrancy 237
Block Gas Limit 238
Timestamp Dependence 238
And Many More 239
Preparing Your Contract for an External Audit 239

vi | Table of Contents
External Auditing 240
Auditing Companies 240
Solidified 240
Free Auditing Resources 240
Growing Your Auditing Skills 241
Summary 241

Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

Table of Contents | vii


Preface

We wrote this book to make smart contract development more accessible and easy to
understand for beginners looking to explore developing on the blockchain.
It can be daunting when you have terms such as networks, nodes, and forks being
thrown around. This book will help you learn how to create and test your own smart
contract, create a frontend for users to interact with, and more. We wrote this book
because we want to provide a resource for people who want to break into the field but
don’t know where to start. We’ve had so many people ask us how they can get started
and tell us how overwhelmed they feel about diving into the blockchain. Even engi‐
neers with years of experience don’t know where to start when trying to dive into
smart contract development.
This book will guide you through the entire process of building a smart contract like
you would in the real world, and deploying it to help users interact with it through an
application.
This book is for anyone who wants to dive into blockchain development and get
hands-on experience writing smart contracts. You should have an editor as well as
some basic engineering knowledge like how to start a terminal.
There are various ways you can get involved in the community and learn more about
smart contract development beyond this book. Here are a few to check out.

Mastering Ethereum
O’Reilly has another book, Mastering Ethereum by Andreas Antonopoulos and Gavin
Wood, which is a deep dive on Ethereum. While this book focuses on getting hands-
on experience with smart contract development, Mastering Ethereum will provide you
with a deeper dive into topics like cryptography, wallets, transactions, and more.

ix
ConsenSys Academy
ConsenSys, the global blockchain company, offers a course on Ethereum develop‐
ment. The course is available twice a year and the company hires from within the
program. The 11-week course offers active support from instructors and a connec‐
tion with the rest of the cohort.
The nice thing about the ConsenSys course is that it offers a certification upon com‐
pletion of the quizzes and the final project. The top students in the cohort are also
considered for employment inside ConsenSys.

B9 Academy
If you’re just starting out with Ethereum and want to learn more, B9 Academy offers
a free Ethereum course available to anyone. Introduction to Ethereum for Developers
gives you an overview of the basics of Ethereum. The course will walk through an
introduction to Ethereum development such as how private keys work, what a merkle
tree is, what the differences are between the types of networks, and more. While no
certification is offered for the free course, this is a great way to dip your toes into
Ethereum development and determine if a paid course might be for you.
Another option is the paid course from B9, which is one of the best online courses on
Ethereum currently available. The course has extensive content and offers a certificate
upon completion. You’ll build three projects and have access to the B9 Slack, which is
a great resource for connecting with other people in the community and getting help
with Ethereum questions or projects. The course also offers instructors for tutoring
and mentorship throughout the duration of the course. If you do well on the final
exam, you’ll receive the B9 certification.

Conventions Used in This Book


The following typographical conventions are used in this book:
Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program ele‐
ments such as variable or function names, databases, data types, environment
variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.

x | Preface
Constant width italic
Shows text that should be replaced with user-supplied values or by values deter‐
mined by context.

This element signifies a tip or suggestion.

This element signifies a general note.

This element indicates a warning or caution.

Using Code Examples


Supplemental material (code examples, exercises, etc.) is available for download at
https://github.com/RedSquirrelTech/hoscdev.
If you have a technical question or a problem using the code examples, please send an
email to [email protected].
This book is here to help you get your job done. In general, if example code is offered
with this book, you may use it in your programs and documentation. You do not
need to contact us for permission unless you’re reproducing a significant portion of
the code. For example, writing a program that uses several chunks of code from this
book does not require permission. Selling or distributing examples from O’Reilly
books does require permission. Answering a question by citing this book and quoting
example code does not require permission. Incorporating a significant amount of
example code from this book into your product’s documentation does require per‐
mission.
We appreciate, but generally do not require, attribution. An attribution usually
includes the title, author, publisher, and ISBN. For example: “Hands-On Smart Con‐
tract Development with Solidity and Ethereum by Kevin Solorio, Randall Kanna, and
David H. Hoover (O’Reilly). Copyright 2020 Kevin Solorio, Randall Kanna, and
David H. Hoover, 978-1-492-04526-7.”

Preface | xi
If you feel your use of code examples falls outside fair use or the permission given
above, feel free to contact us at [email protected].

O’Reilly Online Learning


For more than 40 years, O’Reilly Media has provided technol‐
ogy and business training, knowledge, and insight to help
companies succeed.

Our unique network of experts and innovators share their knowledge and expertise
through books, articles, conferences, and our online learning platform. O’Reilly’s
online learning platform gives you on-demand access to live training courses, in-
depth learning paths, interactive coding environments, and a vast collection of text
and video from O’Reilly and 200+ other publishers. For more information, please
visit http://oreilly.com.

How to Contact Us
Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.


1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at https://oreil.ly/handsOn-smart-contract-dev-
solidity-ethereum.
Email [email protected] to comment or ask technical questions about this
book.
For more information about our books, courses, conferences, and news, see our web‐
site at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia

xii | Preface
Acknowledgments
We would like to thank our editor, Melissa Potter from O’Reilly, for all the feedback
and guidance as we were writing this book. We would also like to thank our tech
reviewers, Brian Wu, John Mardlin, and Destry Saul, for their detailed feedback and
recommendations on how to improve our examples. Thanks also go to our earlier
reviewers Alina Chu, Phillip Birtcher, and Corey Haines for their insights as we were
just getting started in our writing journey.
Kevin would like to thank his partner Alyssa for all the support and encouragement
during crunch time. He would also like to thank his mother Peggy and brother Luis
for always encouraging him to take chances and pursue his dreams.
Randall would like to thank her partner Jack for supporting her in everything she
does. Always. And her family of authors who inspired her to write this book and
always have grit. And her Aunt Kat, who always gives encouragement and support at
any hour of the day and any day of the week.
Dave would like to thank Kevin and Randall for working valiantly to finish this book!
Also thanks to Brian Forde for nudging him down the blockchain rabbit hole, and
Conrad Barski for his mentoring, leadership, and camaraderie. Finally, he would like
to thank his partner Heather Corallo for her encouragement and insights.

Preface | xiii
Other documents randomly have
different content
Bram stared at the farmhouse, the windows of which were shining
like jewels in the setting sun. He felt sick and cold.
What was the meaning of this secret visit of Chris Cornthwaite to
Claire on his wedding day?
CHAPTER XIII.
AN ILL-MATCHED PAIR.

Nobody but simple-hearted Bram Elshaw, perhaps, would have been


able to doubt any longer after what he had seen that there was
something stronger than cousinly affection between Christian
Cornthwaite and Claire. But even this wild visit of Chris to his cousin
on his very wedding day did not create more than a momentary
doubt, a flying suspicion, in the heart of the devoted Bram.
Had he not looked into her dark eyes not many days before, and
read there every virtue and every quality which can make
womanhood sweet and noble and dear?
Unluckily, Chris had been seen on this mysterious visit by others
besides Bram.
It was not long after the wedding day that Josiah Cornthwaite found
occasion, when Bram was alone with him in his office, to break out
into invective against the girl who, so he said, was trying to destroy
every chance of happiness for his son. Bram, who could not help
knowing to what girl he referred, made no comment, but waited
stolidly for the information which he saw that Mr. Cornthwaite was
anxious to impart.
“I think even you, Elshaw, who advocated this young woman so
warmly a little while ago, will have to alter your opinion now.” As
Bram still looked blank, he went on impatiently—“Don’t pretend to
misunderstand. You know very well whom I mean—Claire Biron, of
Duke’s Farm.
“It has come to my ears that my son had a meeting with her on his
wedding day——”
Bram’s countenance looked more blank than ever. Mr. Cornthwaite
went on—
“I know what I am talking about, and I speak from the fullest
information. She sent him a note that very morning; everybody
knows about it; my daughter heard her say it was to be given to Mr.
Christian at once, and that it was from his cousin Miss Biron. Is that
evidence enough for you?”
Bram trembled.
“There must be some other explanation than the one you have put
upon it, sir,” said he quietly but decidedly. “Miss Biron often had to
write notes on behalf of her father,” he suggested respectfully.
“Pshaw! Would any message of that sort, a mere begging letter, an
attempt to borrow money, have induced my son to take the singular,
the unprecedented action that he did? Surprising, nay, insulting, his
wife before she had been his wife two hours.”
Bram heard the story with tingling ears and downcast eyes. That
there was some truth in it no one knew better than he. Had he not
the confirmatory evidence of his own eyes? Yet still he persisted in
doggedly doubting the inference Mr. Cornthwaite would have forced
upon him. His employer was waiting in stony silence for some
answer, some comment. So at last he looked up, and spoke out
bravely the thoughts that were in his mind.
“Sir,” said he steadily, “the one thing this visit of Mr. Christian’s
proves beyond any doubt is that he was in love with her at the time
you made him marry another woman. It doesn’t prove anything
against Miss Biron, until you have heard a great deal more than you
have done so far, at least. You must excuse me, sir, for speaking so
frankly, but you insisted on my telling you what I thought.”
Mr. Cornthwaite was displeased. But as he had, indeed, forced the
young man to speak, he could not very well reproach him for
obeying. Besides, he was used to Bram’s uncompromising
bluntness, and was prepared to hear what he really thought from his
lips.
“I can’t understand the young men of the present generation,” he
said crossly, with a wave of the hand to intimate to Bram that he had
done with him. “When I was between twenty and thirty, I looked for
good looks in a girl, for a pair of fine eyes, for a fine figure, for a pair
of rosy cheeks. Now it seems that women can dispense with all
those attributes, and bowl the men over like ninepins with nothing
but a little thread of a lisping voice and a trick of casting down a pair
of eyes which are anything but what I should call fine. But I suppose
I am old-fashioned.”
Bram retired respectfully without offering any suggestion as to the
reason of this surprising change of taste.
He was in a tumult of secret anxiety. He felt that he could no longer
keep away from the farm, that he must risk everything to try to get an
explanation from Claire. If she would trust him with the truth, and he
believed her confidence in himself to be great enough for this, he
could, he thought, clear her name in the eyes of the angry Josiah. It
was intolerable to him that the girl he worshipped as devotedly as
ever should lie under a foul suspicion.
So that very evening, as soon as he had left the office, he went
straight to the farm. It was his last day before starting on the mission
with which he was to be intrusted in the place of Chris, who was on
his honeymoon. This was an excellent excuse for a visit, which might
not, he feared, be well received.
He was more struck than ever as he approached the farmyard gate
with a fact which had been patent to all eyes of late. The tenants of
Duke’s Farm had fallen on evil days. Everything about the place
betrayed the fact that a guiding hand was wanting; while Bram had
kept an eye on the farm bailiff things had gone pretty smoothly,
fences had been repaired, the stock had been well looked after. Now
there were signs of neglect upon everything. The wheat was still
unstacked; the thatch at one end of the big barn was broken and
defective; a couple of pigs had strayed from the farmyard into the
garden, and were rooting up whatever took their fancy.
Bram leaned on the gate, and looked sorrowfully around.
Was it by chance that the back door opened, and Joan, the good-
humored Yorkshire servant, peeped out? She looked at him for a few
minutes very steadily, and then she beckoned him with a brawny
arm. He came across the yard at once.
“Look here, mister,” said she in her broadly familiar manner, “what
have ye been away so long for? Do ye think there’s nought to be
done here now? Or have ye grown too grand for us poor folks?”
He laughed rather bitterly.
“No, Joan, I’ve only kept away because I’m not wanted.”
“Hark to him!” she cried ironically, as she planted her hands on her
hips, and glanced up at him with a shrewd look in her gray-green
clever eyes. “He wants to be pressed now, when he used to be glad
enoof to sneak in and take his chance of a welcome! Well, Ah could
tell a tale if Ah liked, and put the poor, modest fellow at his ease, that
Ah could!”
Bram’s face flushed.
“Do you mean she wants me?” he asked so simply that Joan burst
into a good-humored laugh.
“Go ye in and see,” said she with a stupendous nod. “And if ye get
the chuck aht, blame it on to me!”
Bram took the hint, and went in. Joan followed, and pointed to a
chair by the table, where Claire sat bending over some work by the
light of a candle. The evening was a gray one, and the light was
already dim in the big farm kitchen.
“Here’s a friend coom to see ye who doan’t coom so often as he
might,” cried Joan, following close on the visitor’s heels. Claire was
looking up with eyes in which Bram, with a pang, noted a new look of
fear and dismay. For the first time within his recent memory she did
not seem glad to see him. He stopped.
“I’ve only come, Miss Claire,” said he in a very modest voice, “to tell
you I’m going to London to-morrow on business for the firm. I shall
be away ten days or a fortnight; and I came to know whether there
was anything I could do for you, either before I go or while I’m there.
But if there’s nothing, or if I’m in the way——”
“You’re never in anybody’s way, Mr. Elshaw,” said she quite cordially,
but without the hearty ring there used to be in her welcome. “Please,
sit down.”
She offered him a chair, and he took it, while Joan, round about
whose wide mouth a malicious smile was playing, disappeared into
her own precincts of scullery and back-kitchen.
For some minutes there was dead silence, not the happy silence of
two friends so secure in their friendship that they need not talk—the
old-time silence which they had both loved, but a constrained,
uncomfortable taciturnity, a leaden, speechless pause, during which
Bram watched with feverish eyes the little face as it bent over her
work, and noted that the outline of her cheek had grown sharper.
He tried to speak, to break the horrid silence which weighed upon
them both. But he could not. It seemed to him that there was
something different about this meeting from any they had ever had,
that the air was heavy with impending disaster.
He spoke suddenly at last in a husky voice.
“Miss Claire, I want you to tell me something.”
She looked up quickly, with anxiety in her eyes. But she said nothing.
“I want you to tell me,” he went on, assuming a tone which was
almost bullying in his excitement, “why Mr. Christian came to see you
the day he was married?”
To his horror she stood up, pushing back her chair, moving as if with
no other object than to hide the frantic emotion she was seized with
at these words. There passed over her face a look of anguish which
he never forgot as she answered in a low, breathless voice.
“Hush, I cannot tell you. You must not ask. You must never ask. And
you must never speak about it again, never, never!”
Bram leaned over the table, and looked straight into her eyes. In
every line of her face he read the truth.
“He asked you to—to go away with him!” he growled, hardly above
his breath.
“Hush!” cried she. “Hush! I don’t know how you know; I hope, oh, I
pray that nobody else knows. I want to forget it! I will forget it! If I had
to go through it again it would kill me!”
And, dry-eyed, she fell into a violent fit of shuddering, and sank down
in her chair with her head in her hands.
“The scoundrel!” said Bram in a terrible whisper.
And there came into his face that look, that fierce peep out of the
primitive north country savage, which had startled Chris himself one
memorable night.
Claire saw it, and she grew white as the dead.
“Bram,” cried she hoarsely, “don’t look like that; don’t speak like that.
You frighten me!”
But he looked at her with eyes which did not see. This fulfilment of
his fears, of his doubts of Chris, was a shock she could not
understand.
There was a pause before he was able to speak. Then he repeated
vaguely—
“Frightened you, Miss Claire! I didn’t mean to do that!”
But the look on his face had not changed. Claire leaned across the
table, touched his sleeve impatiently, timidly.
“Bram,” said she in a shrill voice, sharpened by alarm, “you are to
forget it too! Do you hear?”
He turned upon her suddenly.
“No,” said he, “you can’t make me do that!”
“But I say you must, you shall. Oh, Bram, if you had been here, if you
had heard him, you would have been sorry for him, you would have
pitied him, as I did!”
Bram leaped up from his chair. All the fury in his eyes seemed now
to be concentrated upon her.
“You pitied him! You were sorry for him! For a black-hearted rascal
like that!”
“Oh, Bram, Bram, don’t you know that those are only words! When
you see a man you’ve always liked, been fond of, who has always
been happy and bright, and full of fun and liveliness, quite suddenly
changed, and broken down, and wretched, you don’t stop to ask
yourself whether he’s a good man or a bad one. Now, do you,
Bram?”
“You ought to!” rejoined Bram in fierce Puritanism militant. “You
ought to have used your chance of showing him what a wicked thing
he was doing to his poor wife as well as you!”
“Oh, Bram, I did. I said what I could!”
“Not half enough, I’ll warrant!” retorted he, clenching his fist. “You
didn’t tell him he was a blackguard who ought to be kicked from one
end of the county to the other! And that you’d never speak to him
again as long as you lived!”
“No, I certainly didn’t.”
“Then,” almost shouted Bram, bringing his fist down on the table with
a threatening, sounding thump, “you ought to be ashamed of
yourself! You good women do as much harm as the bad ones, for
you are just as tender and sweet to men when they do wrong as
when they do right. You encourage them in their wicked ways, when
you should be stand-off and proud. I do believe, God forgive me for
saying so, you care more for Mr. Chris now than you did before!”
Claire, who was very white, waited a moment when he had come to
the end of his accusation. Then she said in a weak, timid, little voice,
but with steadiness—
“It is true, I believe, that I like him better than I did before. You are
too hard, Bram; you make no allowance for anything.”
“There are some things no allowance should be made for.”
“Well, there’s one thing you forget, and that is that I’ve not been used
to good people, so that I am not so hard as you are. I’ve never
known a good man except you, Bram, but then I’ve never known one
so severe upon others either.”
“You shouldn’t say that, Miss Claire; I’m not hard.”
“Oh!”
“Or if I am, it’s only so as I shouldn’t be too soft!” cried he, suddenly
breaking down into gentleness, and forgetting his grammar at the
same time. “It’s only because you’ve got nobody to take care of you,
nobody to keep harm away from you, that I want you to be harder
yourself!”
There was a pause. Claire was evidently touched by his solicitude.
Presently she spoke, persuasively, affectionately, but with caution.
“Bram, if I promise to be hard, very hard, will you give me a promise
back?”
“What’s that?”
“Will you promise me that you will forget”—Bram shook his head,
and at once began a fierce, angry protest—“well, that you will say
nothing about this. Come, you are bound in honor, because I told
you in confidence——”
“No, you didn’t; I found out!”
“You can’t deny that I have told you some things in confidence. Now,
listen. You can do no good, and you may do harm by speaking about
this. You must behave to Christian as if you knew nothing. It is of no
use for you to shake your head. I insist. And remember, it is the only
way you have of proving to me that you are not hard. Why, what
about the poor wife you pretended to be so anxious about just now?
Isn’t it for her advantage as well as mine that this awful, dreadful
mistake should be forgotten?”
There was no denying this. Bram hung his head. At last he looked
up, and said shortly—
“If I promise to behave as if I hadn’t heard will you promise me not to
see Mr. Christian again?”
Claire flushed proudly. But when she answered it was in a gentle,
kind voice.
“You won’t trust me, Bram?”
“I think it will be better for the wife, for you, for him, for everybody, if
you promise.”
“Very well. I promise to do my best not to see him again.”
She was looking very grave. Bram stared at her anxiously. She got
up suddenly, and looked at him as if in dismissal. He held out his
hand.
“Good-bye, Miss Claire. You forgive my rough manners, don’t you? If
only you had somebody better than me to take care of you, I
wouldn’t be so meddlesome. Good-bye. God bless you!”
He wanted to say a great deal more; he wanted to know a great deal
more; but he dared not risk another word. Giving her hand a quick,
firm pressure, which she returned without looking up, and with a
restraint and reserve which warned him to be careful, he hurried out
of the house.
CHAPTER XIV.
THE DELUGE.

Bram was away much longer than the ten days he had expected.
Difficulties arose in the transaction of the affair which had called him
to London; he had to take a trip to Brussels, to return to London, and
then to visit Brussels again. It was two months after his departure
from Sheffield before he came back.
In the meantime old Abraham Elshaw, his namesake, had died. A
letter was forwarded to Bram informing him of the fact, and also that
by the direction of the deceased the precious box in which the old
man had kept his property had been sent to Bram’s address at
Hessel.
Bram acknowledged the letter, and sent directions to his landlady for
the safe keeping of the box containing his legacy.
When he got back home to his lodging, one cold night at the end of
November, Bram received the box, and set about examining its
contents. It was a strong oak miniature chest, hinged and padlocked.
As there was no key, Bram had to force the padlock. The contents
were varied and curious. On the top was a Post Office Savings Bank
book, proving the depositor to have had two hundred and thirty-five
pounds to his credit. Next came a packet of papers relating to old
Elshaw’s transactions with a building society, by the failure of which
he appeared to have lost some ninety-six pounds. Then there were
some gas shares and some deeds which proved him to have been
the owner of certain small house property in the village where he had
lived. Next came a silver teapot, containing nothing but some scraps
of tissue paper and a button. And at the bottom of the box was a
very old-fashioned man’s gold watch, with a chased case, a large
oval brooch containing a woman’s hair arranged in a pattern on a
white ground, and a broken gold sleeve-link.
Bram, who, from inquiries he had made, considered himself at liberty
to apply all the money to his own uses, the other relations of old
Abraham not being near enough or dear enough to have a right to a
share, looked thoughtfully at the papers, and then put them carefully
away. He knew what the old man had apparently not known, that
there were formalities to be gone through before he could claim the
house property. He should have to consult a solicitor. There was no
doubt that his windfall would prove more valuable than he had
expected, and again his thoughts flew to Claire, and he asked
himself whether there was a chance that he might be able to devote
his little fortune to the building of that palace which his love had
already planned—in the air.
He told himself that he was a fool to be so diffident, but he could not
drive the feeling away. The truth was that there was still at the
bottom of his heart some jealousy left of the lively Chris, some proud
doubt whether Claire’s heart was as free as she had declared it to
be.
But if, on the one hand, she had spoken compassionately of her
erring cousin, there was to be remembered, as a set-off against that,
the delicious moment when she had stood contented in the shelter of
Bram’s own arms on that memorable evening when he had, for the
second time, protected her from the violence of her father.
On the whole, Bram felt that it was time to make the plunge; now,
when he had money at his command, when he was in a position to
take her right out of her dangers and her difficulties. With Theodore,
who was not without intelligence, a bargain could be made, and
Bram could not doubt that this moment, when the supplies had been
cut off at Holme Park, and the farm was going to ruin, would be a
favorable one for his purpose.
He resolved to go boldly to Claire the very next day.
When the morning broke, a bright, clear morning, with a touch of
frost in the air, Bram sprung out of bed with the feeling that there
were great things to be done. The sun was bright on the hill when he
started, though down far below his feet the town lay buried in a
smoky mist. Just before he reached the farmyard gate he paused,
looking eagerly for the figure which was generally to be seen busily
engaged about the place at this hour of the morning.
But he was disappointed. Claire was nowhere to be seen.
Reluctantly Bram went on his way down the hill, when the chirpy,
light voice of Theodore Biron, calling to him from the front of the
house, made him stop and turn round. Mr. Biron was in riding
costume, with a hunting crop in his hand. He was very neat, very
smart, and far more prosperous-looking than he had been for some
time. He played with his moustache with one hand, while with the
other he jauntily beckoned Bram to come back.
“Hallo!” said Bram, returning readily enough on the chance of seeing
Claire. “Where are you off to so early, Mr. Biron? I didn’t think you
ever tried to pick up the worm.”
“Going to have a day with the hounds,” replied Theodore cheerfully.
“They meet at Clinker’s Cross to-day. I picked up a clever little mare
the other day—bought her for a mere song, and I am going to try her
at a fence or two. Come round and see her. Do you know anything
about hunters, Elshaw?”
“No,” replied the astonished Bram, who knew that Mr. Biron’s purse
had not lately allowed him to know much about hunters either.
“Ah!” said Theodore, as he opened the garden gate for Bram to
enter, and led him into the house. “All the better for you. When
you’ve once got to think you know something about horse-flesh, you
can’t sit down quietly without a decent nag or two in your stable.”
And Mr. Biron, whose every word caused Bram fresh astonishment,
flung back the door of the kitchen with a jaunty hand.
Bram followed him, but stopped short at the sight which met his
eyes.
Springing up with a low cry from a stool by the fire on Bram’s
entrance, Claire, with a face so white, so drawn that he hardly knew
her, stared at him with a fixed look of horror which seemed to freeze
his blood.
“Miss Claire!” he said hoarsely.
She said nothing. With her arms held tightly down by her sides, she
continued to stare at him as if at some creature the sight of whom
had seized her with unspeakable terror. He came forward, much
disturbed, holding out his hand.
“Come, come, Claire, what’s the matter with you? Aren’t you glad to
see Bram Elshaw back among us?” said Theodore impatiently.
Still she did not move. Bram, chilled, frightened, did not know what to
do. Mr. Biron left the outer door, by which he stood, and advanced
petulantly towards his daughter. But before he could reach her she
staggered, drew away from him, and with a frightened glance from
Bram to him, fled across the room and disappeared.
Bram was thrown into the utmost consternation by this behavior. He
had turned to watch the door by which she had made her escape,
when Theodore seized him by the arm, and dragged him impatiently
towards the outer door.
“Come, come,” said he, “don’t trouble your head about her. She’s not
been well lately; she’s been out of sorts. I’ve talked of leaving the
place, and she doesn’t like the idea. She’ll soon be herself again.
Her cousin Chris has been round two or three times since his return
from his honeymoon trying to cheer her up. But she won’t be
cheered; I suppose she enjoys being miserable sometimes. Most
ladies do.”
Bram, who had followed Mr. Biron with leaden feet across the
farmyard towards the stables, felt that a black cloud had suddenly
fallen upon his horizon. The mention of Chris filled him with poignant
mistrust, with cruel alarm. He felt that calamity was hanging over
them all, and that the terrible look he had seen in Claire’s eyes was
prophetic of coming evil. He hardly saw the mare of which Theodore
was so proud; hardly heard the babble, airily ostentatious, cheerily
condescending, which Claire’s father dinned into his dull ears. He
was filled with one thought. These new extravagances of
Theodore’s, the look in Claire’s face, were all connected with Chris,
and with his renewed visits. Bram felt as if he should go mad.
When he reached the office he watched for an opportunity to get
speech alone with Christian. But he was unsuccessful. Bram did not
even see him until late in the day.
Long before that Bram had had an interview with the elder Mr.
Cornthwaite, which only confirmed his fears. He had to give an
account to the head of the firm of the business he had transacted
while away. He had carried it through with great ability, and Mr.
Cornthwaite complimented him highly upon the promptitude,
judgment, and energy he had shown in a rather difficult matter.
“My son Christian was perfectly right,” Mr. Cornthwaite went on, “in
recommending me to send you away on this affair, Elshaw. You
seem to have an old head upon young shoulders. I only hope he
may do half as well on the mission with which he himself is to be
entrusted.”
Bram looked curious.
“Is Mr. Christian going away again so soon, sir?” asked he.
Mr. Cornthwaite, whose face bore traces of some unaccustomed
anxiety, frowned.
“Yes,” he answered shortly. “I am sorry to say that he and his wife
don’t yet rub on so well as one could wish together. You see I tell you
frankly what the matter is, and you can take what credit you please
to yourself for having predicted it. No doubt they will shake down in
time, but on all accounts I think it is as well, as there happens to be
some business to be done down south, to send him away upon it. He
will only be absent a few weeks, and in the meantime any little
irritation there may be on both sides will have had time to rub off.”
Bram looked blank indeed.
He was more anxious than ever for a few words alone with Chris, but
he was unable to obtain them. When his employer’s son appeared at
the office, which was not till late in the day, he carefully avoided the
opportunity Bram sought. After shaking hands with him with a dash
and an effusion which made it impossible for the other to draw back,
even if he had been so inclined, Chris, with a promise of “seeing him
presently,” went straight into his father’s private office, and did not
reappear in the clerks’ office at all.
In spite of the boisterous warmth of his greeting, Bram had noticed in
Christian two things. The first was a certain underlying coldness and
reserve, which put off, under an assumption of affectionate
familiarity, the confidences which had been the rule between them.
The other was the fact that Christian looked thin and worried.
Bram lingered about the office till long after his usual hour of leaving
in the hope of catching Christian. And it was at last only by chance
that he learnt that Chris had gone some two hours before, and,
further, that he was to start for London that very evening.
Now, this discovery worried Bram, and set him thinking. The
intercourse between him and Christian had been of so familiar a kind
that this abrupt departure, without any sort of leave-taking, could
only be the result of some great change in Christian’s feeling
towards himself. So strong, although vague, were his fears that
Bram when he left the office went straight to the new house in a
pretty suburb some distance out of Sheffield, where Christian had
settled with his bride. Here, however, he was met with the
information that Mr. Christian had already started on his journey, and
that he had gone, not from his own, but from his father’s house.
As Bram left the house he saw the face of young Mrs. Christian
Cornthwaite at one of the windows. She looked pale, drawn,
unhappy, and seemed altogether to have lost the smug look of self-
satisfaction which he had disliked in her face on his first meeting with
her.
Much disturbed, Bram went away, and returned to his lodging,
passing by the farm, where there was no sign of life to induce him to
pause. It was nine o’clock, and as there was no light in any of the
windows, he concluded that Mr. Biron had gone to bed, tired out with
his day’s hunting, and that Claire had followed his example.
He felt so restless, so uneasy, however, that instead of passing on
he lingered about, walking up and down, watching the blank, dark
windows, almost praying for a flicker of light in any one of them for a
sign of the life inside.
After an hour of this unprofitable occupation, he took himself to task
for his folly, and went home to bed.
On the following morning, before he was up, there was a loud
knocking at the outer door of the cottage where he lived. Bram, with
a sense of something wrong, something which concerned himself,
ran down himself to open it.
In the middle of the little path stood Theodore Biron, with the same
clothes that he had worn on the morning of the previous day, but
without the hunting-crop.
He was white, with livid lips, and his limbs trembled.
“What’s the matter?” asked Bram in a muffled voice.
“Claire, my daughter Claire!” stammered Theodore in a voice which
sounded shrill with real feeling. All the jauntiness, all the vivacity, had
gone out of him. He shivered with something which was keener than
cold.
“Well?” said Bram, with a horrible chill at his heart.
“She’s—she’s gone, gone!” said Theodore, reeling back against the
fence of the little garden. “She’s run away. She’s run right away.
She’s left me, left her poor old father! Don’t you understand? She is
gone, man, gone!”
And Mr. Biron, for once roused to genuine emotion, broke into sobs.
Bram stood like a stone.
CHAPTER XV.
PARENT AND LOVER.

For some minutes after he had made the announcement of his


daughter’s flight Mr. Biron gave himself up openly and without
restraint to the expression of a sorrow which, while it might be
selfish, was certainly profound.
“My daughter! My daughter!” he sobbed. “My little Claire! My little,
bright-faced darling! Oh, I can’t believe it! It must be a dream, a
nightmare! Do you think, Elshaw,” and he suddenly drew himself up,
with a quick change to bright hope, in the midst of his distress, “that
she can have gone up to the Park to stay at her uncle’s for the
night?”
But Bram shook his head.
“I don’t think it’s likely,” he said in a hollow voice. “They were none so
kind to her that she should do that.” A pause. “When did you miss
her?”
“This morning when I got back,” replied Theodore, who looked blue
with cold and misery. “I went out with the hounds yesterday as you
know. And we got such a long way out that I couldn’t get back, and I
put up at an inn for the night. Don’t you think,” and again his face
brightened with one of those volatile changes from misery to hope
which made him seem so womanish, “that she may have been afraid
to spend a night in the house by herself, and that she may have
gone down to Joan’s place to sleep? I’ll go there and see. Will you
come? Yes, yes, you’d better come. I don’t care for Joan; she’s a
rough, unfeeling sort of person. I should like you to come with me.”
“I’ll come—in a minute,” said Bram shortly.
He knew very well that there was nothing in Mr. Biron’s idea. He
spoke as if this were the first time that Claire had been left to spend
the night alone in the farmhouse; but, as a matter of fact, Bram knew
very well that it had been Theodore’s frequent custom to spend the
night away from home, and that his daughter was too much used to
his vagaries to trouble herself seriously about his absence.
He went upstairs, finished dressing, came out of the house, and
rejoined Mr. Biron; and that gentleman noticed no change in him,
thought, indeed, that he was taking the matter with heartless
coolness. Certainly, if behavior which contrasted strongly with that of
the injured father gave proof of heartlessness, then Bram was a very
stone.
All the way down the hill Mr. Biron lamented and moaned, sobbed,
and even snivelled, loudly cursed the wretches at Holme Park who
had made an outcast of his daughter, and, above all, Chris himself,
who had stolen and ruined his daughter.
But Bram cut him short.
“Hush, Mr. Biron,” said he sternly. “Don’t say words like that till you
are sure. For her sake hold your tongue. It’s not for you to cast the
first stone at her, or even at him.”
Even in his most sincere grief Mr. Biron resented being taken to task
like this; and by Bram, of all people, whom he secretly disliked, as
well as feared, although the young man’s strong character attracted
him instinctively when he was in want of help. He drew himself up
with all his old airy arrogance.
“Do you think I would doubt her for a single moment if I were not
cruelly sure?” cried he indignantly. “My own child, my own darling
little Claire! But I understand it all now. I see how thoroughly I was
deceived in Chris. But he shall smart for it! I’ll thrash him within an
inch of his life! I won’t leave a whole bone in his body! I’ll strangle
him! I’ll tear him limb from limb!”
And Mr. Biron made a gesture more violent with every threat, until at
last it seemed as if his frantic gesticulations must dislocate the bones

You might also like