Beginning Ethereum Smart Contracts Programming: With Examples in Python, Solidity, and JavaScript Lee - Get instant access to the full ebook content
Beginning Ethereum Smart Contracts Programming: With Examples in Python, Solidity, and JavaScript Lee - Get instant access to the full ebook content
com
https://textbookfull.com/product/beginning-ethereum-smart-
contracts-programming-with-examples-in-python-solidity-and-
javascript-lee/
OR CLICK HERE
DOWLOAD EBOOK
https://textbookfull.com/product/biota-grow-2c-gather-2c-cook-loucas/
textbookfull.com
https://textbookfull.com/product/ethereum-for-architects-and-
developers-with-case-studies-and-code-samples-in-solidity-
springerlink-online-service/
textbookfull.com
https://textbookfull.com/product/ethereum-for-architects-and-
developers-with-case-studies-and-code-samples-in-solidity-1st-edition-
debajani-mohanty/
textbookfull.com
https://textbookfull.com/product/good-habits-for-great-coding-
improving-programming-skills-with-examples-in-python-michael-stueben/
textbookfull.com
https://textbookfull.com/product/beginning-programming-with-python-
for-dummies-2nd-edition-john-paul-mueller/
textbookfull.com
Wei-Meng Lee
Beginning Ethereum Smart Contracts Programming:
With Examples in Python, Solidity and JavaScript
Wei-Meng Lee
Ang Mo Kio, Singapore
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub via the book’s product page, located at www.apress.com/9781484250853. For more
detailed information, please visit http://www.apress.com/source-code.
Contents
Introduction�����������������������������������������������������������������������������������������������������������xvii
Index��������������������������������������������������������������������������������������������������������������������� 289
Introduction
Welcome to Beginning Ethereum Smart Contracts Programming!
This book is a quick guide to getting started with Ethereum Smart Contracts
programming. It first starts off with a discussion on blockchain and the motivations
behind it. You will learn what is a blockchain, how blocks in a blockchain are chained
together, and how blocks get added to a blockchain. You will also understand how
mining works and discover the various types of nodes in a blockchain network.
Once that is out of the way, we will dive into the Ethereum blockchain. You will
learn how to use an Ethereum client (Geth) to connect to the Ethereum blockchain and
perform transactions such as sending ethers to another account. You will also learn how
to create private blockchain networks so that you can test them internally within your
own network.
The next part of this book will discuss Smart Contracts programming, a unique
feature of the Ethereum blockchain. Readers will be able to get jumpstarted on Smart
Contracts programming without needing to wade through tons of documentation. The
learn-by-doing approach of this book makes you productive in the shortest amount
of time. By the end of this book, you would be able to write smart contracts, test them,
deploy them, and create web applications to interact with them.
The last part of this book will touch on tokens, something that has taken the
cryptocurrency market by storm. You would be able to create your own tokens and
launch your own ICO and would be able to write token contracts that allow buyers to buy
tokens using Ethers.
This book is for those who want to get started quickly with Ethereum Smart
Contracts programming. Basic programming knowledge and an understanding of
Python or JavaScript are recommended.
I hope you will enjoy working on the sample projects as much as I have enjoyed
working on them!
CHAPTER 1
Understanding Blockchain
One of the hottest technologies of late is Blockchain. But what exactly is a blockchain?
And how does it actually work? In this chapter, we will explore the concept of blockchain,
how the concept was conceived, and what problems it aimed to solve. By the end of this
chapter, the idea and motivation behind blockchain would be crystal clear.
Hold on tight, as I’m going to discuss a lot of concepts in this chapter. But if you
follow along closely, you’ll understand the concepts of blockchain and be on your way to
creating some really creative applications on the Ethereum blockchain in the upcoming
chapters!
Placement of Trusts
All these boil down to one key concept – placement of trust. And that is, we place our
trust on a central body. Think about it, in our everyday life, we place our trusts on banks,
and we place our trusts on our governments.
Even for simple mundane day-to-day activities, we place our trusts in central bodies.
For example, when you go to the library to borrow a book, you trust that the library
would maintain a proper record of the books that you have borrowed and returned.
The key theme is that we trust institutions but don’t trust each other. We trust our
government, banks, even our library, but we just don’t trust each other. As an example,
consider the following scenario. Imagine you work at a cafe, and someone walks up
to you and offers you a US ten-dollar bill for two cups of coffee. And another person
who offers to pay you for the two cups of coffee using a handwritten note saying he
owes you ten dollars. Which one would you trust? The answer is pretty obvious, isn’t it?
Naturally you would trust the US ten-dollar bill, as opposed to the handwritten note.
This is because you understand that using the ten-dollar bill, you can use it elsewhere
to exchange for other goods or services, and that it is backed by the US government. In
contract, the handwritten note is not backed by anyone else (except perhaps the person
who wrote it), and hence it has literally no value.
2
Chapter 1 Understanding Blockchain
Now let’s take the discussion a bit further. Again, imagine you are trying to sell
something. Someone comes up to you and suggests paying for your goods using the
currencies as shown in Figure 1-1.
Would you accept the currencies as shown in the figure? Here, you have two different
currencies – one from Venezuela and one from Zimbabwe. In this case, the first thing
you consider is whether these currencies are widely accepted and also your trust in these
governments. You might have read from the news about the hyperinflation in these two
countries, and that these currencies might not retain its value over time.
And so, would you accept these currencies as payment?
T rust Issues
Earlier on, I mentioned that people trust institutions and don’t trust each other. But even
established economies can fail, such as in the case of the financial crisis of the United
States in 2007–2008. Investment bank Lehman Brothers collapsed in September 2008
because of the subprime mortgage market. So, if banks from established economies can
3
Chapter 1 Understanding Blockchain
collapse, how can people in less developed countries trust their banks and governments?
Even if the banks are trusted, your deposits may be monitored by the government, and
they could arrest you based on your transactions.
As we have seen in the example in the previous section, there are times when people
don’t trust institutions, especially if the political situation in that country is not stable.
All these discussions bring us to the next key issue – even though people trust
institutions, institutions can still fail. And when people lose trust in institutions, people
turn to cryptocurrencies. In the next section, we will discuss how we can solve the trust
issues using decentralization, a fundamental concept behind cryptocurrency.
E xample of Decentralization
To understand how decentralization solves the trust issue, let’s consider a real-life example.
Imagine a situation where you have three persons with DVDs that they want to share
with one another (see Figure 1-2).
4
Chapter 1 Understanding Blockchain
The first thing they need to do is to have someone keep track of the whereabouts
of each DVD. Of course, the easiest is for each person to keep track of what they have
borrowed and what they have lent, but since people inherently do not trust each other,
this approach is not very popular among the three persons.
To solve this issue, they decided to appoint one person, say B, to keep a ledger, to
hold a record of the whereabouts of each DVD (see Figure 1-3).
5
Chapter 1 Understanding Blockchain
This way, there is a central body to keep track of the whereabouts of each DVD. But
wait, isn’t this the problem with centralization? What happens if B is not trustworthy?
Turns out that B has the habit of stealing DVDs, and he in fact could easily modify the
ledger to erase the record of DVDs that he has borrowed. So, there must be a better way.
And then, someone has an idea! Why not let everyone keep a copy of the ledger
(see Figure 1-4)? Whenever someone borrows or lent a DVD, the record is broadcast to
everyone, and everyone records the transaction.
6
Chapter 1 Understanding Blockchain
We say that the record keeping is now decentralized! We now have three persons
holding the same ledger. But wait a minute. What if A and C conspire to change the
records together so that they can steal the DVDs from B? Since majority wins, as long
as there is more than 50% of the people with the same records, the others would have
to listen to the majority. And because there are only three persons in this scenario, it is
extremely easy to get more than 50% of the people to conspire.
The solution is to have a lot more people to hold the ledger, especially people who
are not related to the DVDs sharing business (see Figure 1-5).
7
Chapter 1 Understanding Blockchain
Figure 1-5. Getting a group of unrelated people to help keep the records
This way, it makes it more difficult for one party to alter the records on the ledger,
and that in order to alter a record, it would need to involve a number of people altering
the record all at the same time, which is a time-consuming affair. And this is the key idea
behind distributed ledger, or commonly known as blockchain.
8
Chapter 1 Understanding Blockchain
Figure 1-6. Transactions form a block, and then blocks are then chained
Based on what we have discussed, we can now summarize a few important points:
9
Chapter 1 Understanding Blockchain
Figure 1-7. Every blockchain has a beginning block known as the genesis block
The blocks are connected to each other cryptographically, the details in which we
will discuss in the sections ahead. The first block in a blockchain is known as the genesis
block.
So, the next important questions is – how do you chain the blocks together?
We are now ready to discuss how blocks in a blockchain are chained together. To
chain the blocks together, the content of each block is hashed and then stored in the next
block (see Figure 1-8). That way, if any transactions in a block is altered, that is going to
invalidate the hash of the current block, which is stored in the next block, which in turn
is going to invalidate the hash of the next block, and so on.
11
Chapter 1 Understanding Blockchain
Observe that when hashing the content of a block, the hash of the previous block is
hashed together with the transactions. However, do take note that this is a simplification
of what is in a block. Later on, we will dive into the details of a block and see exactly how
transactions are represented in a block.
Storing the hash of the previous block in the current block assures the integrity of the
transactions in the previous block. Any modifications to the transaction(s) within a block
causes the hash in the next block to be invalidated, and it also affects the subsequent
blocks in the blockchain. If a hacker wants to modify a transaction, not only must he
modify the transaction in a block but all other subsequent blocks in the blockchain. In
addition, he needs to synchronize the changes to all other computers on the network,
which is a computationally expensive task to do. Hence, data stored in the blockchain
is immutable, for they are hard to change once the block they are in is added to the
blockchain.
Up to this point, you have a high-level overview of what constitutes a blockchain and
how the blocks are chained together. In the next section, you will understand the next
important topic in blockchain – mining.
M
ining
Whenever you talk about blockchain or cryptocurrencies, there is always one term that
comes up – mining. In this section, you will learn what is mining, and what goes on
behind the scene.
Mining is the process of adding blocks to a blockchain. In a blockchain network,
such as the Bitcoin or Ethereum network, there are different types of computers known
as nodes. Computers on a blockchain that add blocks to the blockchain are known as
miner nodes (or mining nodes, or more simply miners).
We will talk about the different types of nodes later on in this course, but for now, we
want to talk about a particular type of node, known as the miner node. The role of the
miner node is to add blocks to the blockchain.
But how are blocks added?
B
roadcasting Transactions
When a transaction is performed, the transaction is broadcasted to the network (see
Figure 1-9).
12
Chapter 1 Understanding Blockchain
Figure 1-9. Transactions are broadcasted to mining nodes, which then assemble
them into blocks to be mined
Each mining node may receive them at different times. As a node receives
transactions, it will try to include them in a block. Observe that each node is free to
include whatever transactions they want in a block. In practice, which transactions get
included in a block depends on a number of factors, such as transaction fees, transaction
size, order of arrival, and so on.
At this point, transactions that are included in a block but which are not yet added
to the blockchain are known as unconfirmed transactions. Once a block is filled with
transactions, a node will attempt to add the block to the blockchain.
Now here comes the problem – with so many miners out there, who gets to add the
block to the blockchain first?
13
Chapter 1 Understanding Blockchain
Figure 1-10. Hashing the block to meet the network difficulty target
In order to successfully add a block to the blockchain, a miner would hash the
content of a block and check that the hash meets the criteria set by the difficulty target.
For example, the resultant hash must start with five zeros and so on.
As more miners join the network, the difficultly level increases, for example, the
hash must now start with six zeros and so on. This allows the blocks to be added to the
blockchain at a consistent rate.
But, wait a minute, the content of a block is fixed, and so no matter how you hash it,
the resultant hash is always the same. So how do you ensure that the resultant hash can
meet the difficulty target? To do that, miners add a nonce to the block, which stands for
number used once (see Figure 1-11).
14
Chapter 1 Understanding Blockchain
Figure 1-11. Adding a nonce to change the content of the block in order to meet
the network difficulty target
The first miner who meets the target gets to claim the rewards and adds the block to
the blockchain. It will broadcast the block to other nodes so that they can verify the claim
and stop working on their current work of mining their own blocks. The miners would
drop their current work, and the process of mining a new block starts all over again.
The transactions that were not included in the block that was successfully mined will be
added to the next block to be mined.
In the case of Bitcoin, the block reward initially was 50 BTC and will halve every 210,000
blocks. At the time of writing, the block reward is currently at 12.5 BTC, and it will eventually
be reduced to 0 after 64 halving events. For Ethereum, the reward for mining a block is
currently 2 ETH (Ether).
15
Chapter 1 Understanding Blockchain
For Bitcoin, the network adjusts the difficulty of the puzzles so that a new block is being mined
roughly every 10 minutes. For Ethereum, a block is mined approximately every 14 seconds.
Proof of Work
The process in which blocks are mined and added to the blockchain is known as the
Proof of Work (PoW). It is difficult to produce the proof but very easy to validate. A good
example of Proof of Work is cracking a combination lock – it takes a lot of time to find the
right combination, but it is easy to verify once the combination is found.
Proof of Work uses tremendous computing resources – GPUs are required, while
CPU speed is not important. It also uses a lot of electricity, because miners are doing the
same work repeatedly – find the nonce to meet the network difficulty for the block.
A common question is why you need to use a powerful GPU instead of CPU for
mining? Well, as a simple comparison, a CPU core can execute 4 32-bit instructions per
clock, whereas a GPU like the Radeon HD 5970 can execute 3200 32-bit instructions per
clock. In short, the CPU excels at doing complex manipulations to a small set of data,
whereas the GPU excels at doing simple manipulations to a large set of data. And since
mining is all about performing hashing and finding the nonce, it is a highly repetitive
task, something that GPU excels in.
Tip When a miner has successfully mined a block, he earns mining fees as well
as transaction fees. That’s what keeps miners motivated to invest in mining rigs
and keep them running 24/7, thereby incurring substantial electricity bills.
Immutability of Blockchains
In a blockchain, each block is chained to its previous block through the use of a
cryptographic hash. A block’s identity changes if the parent’s identity changes. This in
turn causes the current block’s children to change, which affects the grandchildren, and
so on. A change to a block forces a recalculation of all subsequent blocks, which requires
enormous computation power. This makes the blockchain immutable, a key feature of
cryptocurrencies like Bitcoin and Ethereum.
16
Chapter 1 Understanding Blockchain
Tip In general, once a block has six or more confirmations, it’s deemed infeasible
for it to be reversed. Therefore, the data stored in the blockchain is immutable.
• A block header
17
Chapter 1 Understanding Blockchain
• Timestamp
• Merkle root
• Nonce
Figure 1-13. A block contains the block header, which in turns contains the
Merkle root of the transactions
18
Chapter 1 Understanding Blockchain
T ypes of Nodes
Before we address the rationale for storing the Merkle root in the block header, we need
to talk about the types of nodes in a blockchain network. Figure 1-14 shows the different
types of nodes in a blockchain network.
Tip Note that full nodes are not necessarily mining nodes. However, mining
nodes need to be a full node.
The purpose of a full node is to ensure the integrity of the blockchain and people
running full nodes do not get rewards. On the other hand, mining nodes are rewarded
when they add a block to the blockchain.
19
Chapter 1 Understanding Blockchain
And so, we can summarize the types of nodes that we have discussed thus far:
• Full node
• Visit the following sites to see the current number of full nodes for
the following blockchains:
• Bitcoin – https://bitnodes.earn.com
• Ethereum – www.ethernodes.org/network/1
20
Another Random Scribd Document
with Unrelated Content
Was she glad or sorry that she had come?
She was glad!
It was one of the moments when good triumphed over evil in the
complex nature of Ethel Winans.
"It was Heaven that sent me here to rescue Precious," she thought
happily, and for awhile Lord Chester was forgotten while the sisters
made mutual explanations.
"So it was Lindsey Warwick, after all. The detectives suspected him
at first, but he hoodwinked them very cleverly," said Ethel.
"Oh, he is a fiend!" cried Precious shudderingly.
"Then you could never accept him as a lover?" Ethel asked curiously.
"Oh, never, never! He is very repulsive to me, with his keen little
eyes, and his thick lips, and his perpetual smirk. If I ever have a
lover I must have a grand, handsome one, as noble as papa, or
perhaps like your lover, Ethel—I do not know his name, but I saw
him at the ball with you, and I thought he was splendid. Well, when
I have a real lover he must be like that, Ethel!" cried Precious
innocently.
A shadow gleamed over Ethel's dusky beauty, and she thought:
"They are mutually attracted to each other. It is fate."
But she said carelessly:
"You are too young to dream of lovers yet, my dear, and when you
get safe home again you must devote yourself to your studies, and
not tease about going to balls. It was your willfulness about the
Inauguration Ball that brought you into this trouble."
"And papa will put that villain into prison for this, I know," cried
Precious, her voice a little stronger from the food and wine she had
taken. Then she hugged Kay around his neck and kissed the top of
his head.
"Darling old fellow, if it had not been for you Ethel would have come
and gone without finding me. Oh, how shall I ever pay you for this?
You shall have a golden collar with your name set in rubies—yes,
you shall. Papa will buy it for you, I know, to pay you for saving his
pet."
Kay showed as much boisterous delight as if he understood every
word, and kept licking her little hands with joy unutterable.
"And now, dear, we must get out of this place, and go home if you
think you are ready," smiled Ethel.
"Ready!" cried Precious gayly. "Well, I know I am very weak from my
long fast, but joy makes me feel like a new girl. I have nothing to
wear home but this blue wrapper over my ball dress, but no matter
—let us start at once. If I am too weak to walk I can crawl there, or
perhaps Kay will let me ride on his back," patting him tenderly.
Ethel turned the handle of the door, but it resisted her efforts, and
she recoiled with a low cry.
"Oh, Heaven, I had forgotten! I heard that old hag lock the door on
the outside as I entered. I am a prisoner too. What shall I do?"
The tears rushed into her sister's blue eyes.
"There is no use in screaming, for I cried that day and night until I
was hoarse as a raven, but no one ever seemed to hear me. And the
only window is nailed down, you see. But, oh, Ethel, they will miss
you at home and come here to look for you presently, won't they
dear?"
"I did not tell them I was coming here. I felt ashamed of going to
see a fortune-teller to find out about you. They would have laughed
at me. I let my maid think that I was going to see a friend. Oh, what
shall I do? Why did I ever come here?" wept Ethel, wringing her
hands in terror, and forgetting that she had told herself just now that
God himself had sent her to the aid of Precious.
She shrieked aloud; she tore at the door with frantic hands.
"It will soon be night, and they will wonder what has become of me.
This double sorrow will drive our poor mother mad. Oh, what shall I
do?" she cried again in agony.
"If we could only get that window open," cried Precious eagerly. "But
I have tried it every day, and my hands bled, but the nails would not
come out. But if we could only open it, Ethel, we could plait a rope
of the bedclothes, and get out."
Kay looked from one to the other, whining in unison with their grief.
Ethel turned a flashing glance on the window, then caught up a thick
wash pitcher of heavy iron-stone ware. She poured the water out,
and rushed at the window, dealing blow after blow on the panes.
Joy! the thin glass and slight framework gave way before her furious
onslaught. Then she attacked the shutters with the same signal
success. They tumbled from their fastenings down to the ground two
stories below. The sash was all gone, too, and the fresh outer air
rushed into their faces—fresh, but full of the fog and damp of early
twilight.
"Quick! now the bedclothes! We will sit at the window while we tear
them in strips, and if we see any one passing we will scream to
them for help," cried Ethel bravely, though her lovely hands were
torn and bleeding from fragments of flying glass. They set to work,
but Precious was so weak from her long fast that she could not help
much. The little hands were strengthless and nerveless.
"She must have heard you breaking in the window, and she will
come up here presently and kill us," she shuddered, with terrified
eyes.
"Don't be a coward, Precious. I think the old wretch has very likely
run off to tell her son what has happened, and we must get away
before they come back, for, of course, he will be very angry, and, as
you suggested, he may kill us," answered Ethel, working away in a
perfect frenzy of fear and excitement.
But Precious was very weak and nervous; she could not bear the
strain of this horrible dread, following on the hope of a few minutes
ago. She dropped back quietly in her chair and fainted.
Ethel would not relax her frantic labor to resuscitate her, but Kay fell
to licking the white face with such a rough, energetic tongue that
presently Precious sighed and revived, pushing him down with feeble
hands.
"Down, sir! down! You must not be so impudent," she sighed faintly.
"Come, Precious, our rope is done. Can you help me to fasten it to
the leg of the bed? Then we will throw it from the window. I will
slide down first, and you will follow. I will catch you at the bottom if
you fall. And Kay can jump out after us. Oh, Heaven, what is that?"
She might well exclaim, for at that moment the wall at the opposite
side of the room was suddenly divided by a burst of smoke and
flame that lighted up the gloom with a lurid glare.
They had thought it was the wind, the strange, crackling noises they
had faintly heard for some time, but now they understood the full
horror of their situation.
The old house was in flames—fired doubtless by the fiendish old hag
who had thus wreaked her vengeance and fled, leaving them to their
fate.
It was a moment of the most sublime horror, the most deadly peril.
The two girls gazed at each other with horror-stricken faces, and the
mastiff lifted up his voice in a prolonged and dismal howl like a
banshee.
"We are trapped," cried Ethel wildly. "She has fired the house and
gone. But we shall escape. Come, dear." She drew Precious to the
window, and climbed upon the sill. "I will go first; you follow."
She grasped the rope, and swung outward, her heart beating wildly,
her eyes watching the face of Precious as it leaned forward against
the awful background of smoke and flame. The small pale face, like
a snowdrop, the luminous blue eyes, the aureole of golden hair,
made Precious look angelic.
Ethel felt herself rushing through the cold March air, and—suddenly
she shot down wildly, and fell on the wet ground where the thick
spongy turf broke the severity of the fall. Safe!
But an awful cry escaped her lips.
The plaited rope had proved treacherous, and broken off midway,
dangling its useless length about a yard below the window sill,
above which that beautiful white face looked down in a frenzy of
despair.
Ethel staggered to her feet; she flung out her arms, she shrieked:
"Come, darling, climb out upon the rope, and drop. I will catch you—
I will break the fall."
But Precious scarcely heard. Her senses had deserted her at sight of
the broken rope. Ethel saw the dilated blue eyes close again, saw
her sister fall backward into the blinding smoke, heard the frenzied
yelp of Kay as he sprang upon the window sill, and felt that no
earthly power could save her doomed sister now.
She held out her arms to Kay, and shrieked wildly:
"Come to me, Kay, come!"
But the poor beast gave a desolate howl, and sprang back into the
room where Precious lay unconscious. Then a great black volume of
smoke poured through the window, and from the front of the house
Ethel saw the red glaring flame shoot quickly.
"The front of the house is all in flames. No one can save my sister
now," she thought. Then something seemed to say in her heart:
"You are to blame. You should have sent her down the rope first.
She was so light and small it would have carried her safely, and both
would have been saved."
It made her angry, that still small voice of conscience, for she knew
that it was a selfish anxiety over her own safety that made her
descend first. Moving away she muttered:
"Why should I run the risk of my life for her? I tried to save her, and
if she had not been so cowardly I would have succeeded. She will
perish, but it is not my fault."
Why did she not run and spread the alarm? Some man might be
found who would be brave enough to scale the window and bring
out the unconscious girl.
But Ethel moved away, going backward, watching with fascinated
eyes the burning building, her sister's funeral pyre.
Shrieks began to fill the air from the occupants of the shanties
around, just discovering the fire. A crowd began to gather. Why did
not the retreating girl pray the people to rescue her sister?
A tempting devil had recalled to her mind her sister's words of
admiration for Lord Chester a little while ago—her longing for just
such a splendid lover.
"Precious dead he would be yours; living she would win him from
you," whispered the tempter, and she turned away muttering, "It is
too late. No one could save her now."
CHAPTER IX.
A FAITHFUL FRIEND.
"I am mad!
The torture of unnumbered hours is o'er,
The strong cord is broken, and my heart
Riots in free delirium! Oh, Heaven!
I struggled with it, but it mastered me!
I fought against it, but it beat me down!
I prayed, I wept, but Heaven was deaf to me,
And every tear rolled backward on my heart,
To blast and poison!"—George Henry Boker.
A crowd soon collected and the fire engines quickly came upon the
scene.
Streams of water began to play on the burning house, but to no
avail. The fire had made too much headway to be checked now. The
old ramshackle building was doomed. In the large crowd that had
collected were two very elegant-looking young men—Earle Winans
and Lord Chester.
The two young men, although acquainted but a few days, had
become fast friends.
It was the nobleman's deep solicitude over the fate of Precious that
had first drawn Earle toward him. Lord Chester's services were
always ready in any new plan for finding Precious; he was as eager
as Earle himself in the search.
The Winans family believed that all this zeal was for the sake of
Ethel, whom the nobleman had seemed to admire so much that
gossip said he would certainly make her Lady Chester at no distant
date.
So Earle had taken the handsome young nobleman warmly into his
heart and confidence.
They had been walking together that chilly afternoon, several blocks
away from the place, when the light of the burning building drew
them to follow the crowd to the spot.
They arrived but a few moments after Ethel had turned away from
the dreadful scene, hardening her jealous heart against the voice of
accusing conscience, and answering to its reproaches: "I tried to
save her, and it was through her own cowardice she perished."
When her brother and Lord Chester came on the scene they heard
some one saying:
"There is a dog shut up in that house. Hear his frightful baying!"
They could hear it distinctly, the prolonged mournful howls, and it
seemed as if the sounds came from an open window.
"The window is open. Why don't the foolish animal come out?" cried
Earle Winans, and just then the streams of water playing on the side
of the wall cleared away the smoke a little, and the animal was seen
a moment dimly, then with another howl he fell back into the room.
"He is bewildered and afraid to jump," cried a fireman, as poor Kay's
dismal wails came distinctly to the ears of the crowd.
"Perhaps there is some person in the room, and he is too faithful to
desert his post. Dogs are often more faithful than friends. Put up a
ladder, and I will go and see," exclaimed Lord Chester suddenly.
"No, no! you must not risk your life for a dog, even a faithful one,"
cried Earle, trying to hold his friend back, for the situation was very
perilous.
"No, no! I must save that poor dog!" Lord Chester cried, breaking
loose and ascending the ladder, while the shouts of the tumultuous
crowd rang to heaven.
Slowly, carefully, through the blinding smoke and heat and
threatening flame he went, and presently his head rose above the
sill of the open window and he peered into the room, which seemed
full of black smoke and leaping flames.
He put out his hand and it touched a big tawny head.
"Come, good fellow, come," he cried, and tried to drag him out.
Then he made a startling discovery.
The faithful mastiff had dragged an unconscious human being to the
window with his teeth, and was holding her up by a mass of golden
hair in a vain effort to get her up to the sill, where she might be
seen and rescued by the crowd.
CHAPTER X.
"HIS HEART WILL TURN BACK TO ME."
Through the falling twilight of the bleak March day Ethel Winans
sped away like a guilty creature, nor paused until she reached her
home.
Entering by a private door she gained her own room unobserved and
hastened to bathe her face and hands and rearrange her disordered
tresses.
Then she summoned Hetty, and the maid stared in surprise at her
corpse-like pallor and heavy eyes.
"Oh, Miss Ethel, you look awful! Are you sick?"
"I am tired to death," sighed Ethel. "I have had such a long, weary
chase after Kay! Oh, Hetty, I have lost him, but you must never,
never tell, for papa would never forgive me if he knew. He ran off
with some other dogs in a park, and though I ran and ran I could
not get him back."
"You ought not to worry so about the dog, Miss Ethel. Lordy, he'll be
sure to find his way back home," declared the maid cheerfully.
Ethel looked on the verge of tears. She half sobbed:
"Do you think so? I hope he will, for Precious loved him so dearly,
and papa will be so sorry to find him gone, and he will be so angry
with me for taking him out. Please don't say anything about it to any
one, Hetty, and you may have that coral bracelet of mine."
"Thank you kindly, Miss Ethel, and of course it's not my business to
find out that Kay is missing. So now it's time to dress for dinner, if
you please. What dress will you wear, Miss Ethel? That new gold-
colored silk with the black lace draperies, or something plainer?
There's no one to dinner but the two gentlemen of the family. Your
mamma is not well enough to dine."
"Poor mamma! But, Hetty, I am too tired to dress and dine to-night.
I think I will send down excuses and retire. My head is throbbing
with pain. I believe I should like a sedative."
Hetty brought the sedative and helped her to bed, saying as she
tucked in the silken coverlet:
"Miss Miller called for you this afternoon, and I told her you had
gone to keep an engagement with her. She said there must be some
mistake; she hadn't seen you. I thought to myself that maybe you
changed your mind and went to the old clairvoyant after all."
"I didn't have time to go anywhere after I lost Kay and had that long
chase after him, so I hurried home," Ethel answered evasively. Then
she nestled her head in the pillow and closed her eyes.
"Now, Hetty, I don't need you any longer. You can go and tell
mamma I was so weary from my long walk that I retired."
Hetty dimmed the light and went out, but she thought sagely:
"Miss Ethel fibbed when she said she hadn't been anywhere. I'll bet
a dime she's been to the old fortune-teller, and she told her
something she didn't like and she's gone to bed to cry over it."
Ah, Hetty, your young mistress had more to grieve over than you
guessed, and the pillow of down might have been full of thorns for
all the rest she found that night.
For, shut her eyes as she might, there was one vision always before
them—a wan little face like a snowdrop, luminous blue eyes, golden
hair like an aureole of light; then it would fade and fall away into a
cloud of smoke and flame, only to reappear again, until Ethel
writhed in anguish and sobbed:
"It was not my fault. I could have saved her if she had not fainted.
But no one must ever know I was there. They would blame me for
her awful death."
She sat up in bed staring with gloomy eyes and writhing hands,
trying to put from her the horror of her sister's death and to think
what life would be like now when there was no pretty, willful
Precious any more to envy for her fatal power of winning hearts.
"They must learn to love me now, papa, mamma, Earle and—Lord
Chester, for his heart will turn back to me when there is no witching
Precious to distract his thoughts. They loved her too well and fate
has punished them by taking their idol away. It is my turn now," she
thought with a bitter triumph.
Ah, Ethel, could the straining gaze of those somber eyes have
pierced the shadows of the gloomy twilight they would have beheld
a sight to blast them with its surprise.
Down the ladder came Lord Chester bearing the unconscious form of
golden-haired Precious, whom Ethel had forsaken, and who never
would have been saved but for the devotion of the faithful mastiff,
noble Kay.
The shouts that rose from the crowd, as Lord Chester came down
with the girl in his arms and the brave mastiff leaped from the
window might almost have reached Ethel's ears, they were so loud
and ringing.
Lord Chester was so blind and dizzy from the heat and smoke that
as soon as his burden was drawn from his arms he sank exhausted
to the ground.
The next instant the roof of the building fell in, leaving only the
outer walls standing. Lord Chester had saved a life that but for his
bravery must have perished in the raging flames.
Earle Winans pressed forward to his friend's assistance with a pang
of keen remorse as he remembered how he had tried to restrain his
friend from that perilous undertaking.
"How little I dreamed that a human being was in deadly peril within
the house," he thought as he gazed curiously at the girl his friend
had rescued from such an awful fate.
His dark eyes noted the golden hair all tossed and tangled in a curly
mass, the closed eyes, the waxen fair face in its pallid beauty. Then
a loud cry burst from his lips:
"Oh, Heaven! it is my missing sister—little Precious!"
And he reeled and would have fallen but for the restraining arm of a
stranger.
Water was poured on his face and he quickly revived from his
momentary faintness.
He knelt by the silent form of the unconscious girl, crying in anguish:
"It is Precious! my little sister! Oh, do not tell me she is dead."
A physician pushed through the crowd and made a hasty
examination. His face was very grave.
"She is not dead, but her unconsciousness is very deep," he said. "If
it is a simple swoon she may revive, but if asphyxiated by the smoke
and heat, as I greatly fear, she will very likely soon expire."
Lord Chester, recovering from his momentary exhaustion, heard their
words and looked with a bitter heart-pang at the face of Precious.
Never before had he gazed at that face, yet there came a swift
despair at thought of her death—a swift despair that blotted out all
memory of Ethel's sparkling beauty that such a little while ago had
charmed him so.
"We must have a carriage and take her home," cried Earle huskily,
then wrung his friend's hand and thanked him for the rescue of his
sister.
"From this hour you are dear to me as a brother," he cried with deep
emotion.
So it happened that while Ethel sat up in bed staring with wild eyes
into a possible future that held no lovely sister for a rival, a carriage
was pausing at the door that held Earle Winans, his unconscious
sister, and a physician, and presently there came ringing to Ethel's
ear the long cry of anguish wrung from a mother's heart while
bending over her dead.
Ethel started and listened in terror. What did it mean, that long, low
cry of grief in her mother's voice?
Then Hetty Wilkins rushed in, pale and tearful, crying out:
"Oh, Miss Ethel, such dreadful news! They have bought Miss
Precious home dead."
But from behind her came Earle Winans, and he exclaimed angrily:
"Hetty, you are a cruel girl to frighten Ethel so. You had no business
to come to her with such news. My mother sent me to break it to
her gently. Ethel, dear, do not sob so bitterly. We have brought
Precious home, but a little life lingers still and we hope she may not
die."
Ethel had dropped her face in her hands. When her brother lifted it
he was startled at its expression, the ghastly face, the eyes wide and
dark with horror.
He scolded Hetty roundly for her rashness in blurting out the news
to his sister, and the girl stood aside sulkily at his reproof.
"Never mind Hetty; she meant no harm, Earle; but tell me all about
it. Where did you find Precious?" gasped Ethel, clinging to him in
wild excitement.
And holding her head against his arm and smoothing the dark waves
of her hair with a loving hand Earle told the story as far as he knew
it—the story of his young sister's rescue by Arthur, Lord Chester.
Kay, the splendid mastiff, came in for a share of praise too, and
Hetty, the maid, listened intently to it all and nodded excitedly when
Earle said:
"The greatest wonder of all is how Kay came to be there; but of
course if Precious revives she can explain all that."
He felt Ethel shuddering against his arm, and Hetty saw how she
trembled, and said to herself:
"I think Miss Ethel could explain it too, if she would, and if she don't
speak I shall begin to think she has some strange secret worth more
than the gift of a bracelet."
"I must go back to my mother now, for our father is too wretched
himself to comfort her. Ethel, try to come down if you can," he said,
as he left the room.
Ethel dragged herself out of bed, moaning:
"You must dress me, Hetty, and let me go to my poor sister."
Hetty brought her slippers and a pretty wrapper, and while she was
putting them on she exclaimed:
"What a brave young man Lord Chester must be!"
Ethel's heart gave a fierce throb of mingled pride and pain.
"And," pursued the loquacious maid, "he is the rich lord that they all
say you are going to marry, isn't he, Miss Ethel?"
"Yes," answered Ethel carelessly, then added:
"But I don't think I shall accept him."
She turned away from the maid as she spoke and went from her
own apartments toward those of Precious, nearer to her mother.
She opened the door very softly and glided in.
They were all there, her father, mother, brother, and the physician.
Precious lay on her bed, white as a lily, but breathing faintly. She
had revived from her swoon, but she had not yet spoken. Her half-
open blue eyes seemed to know that they were all there, but she
was too exhausted to utter a word.
Ethel bent down and pressed her lips on the wasted little hand, and
when she met the gaze of the half-conscious blue eyes she
whispered, too low for any one to hear:
"Please don't tell any one I was there with you, Precious, until you
get well enough for me to explain."
The little hand she was holding gave hers a weak pressure that
showed her that Precious understood and would not speak.
The others, looking on at the little by-play, thought that Ethel was
only whispering to Precious of her joy at her return.
A week passed and the sick girl slowly gained strength enough to
tell the story of her persecutions at the hands of Lindsey Warwick
and his mother, but the pair of plotters had made good their escape
and were now beyond the senator's vengeance.
There was one thing that always seemed strange to them, and that
was how Kay had found the way to his mistress. The girl always
explained it in an embarrassed, halting fashion.
"The old woman just unlocked the door, pushed Kay in, and went
away again," she said. "And just a little later the flames burst
through the side of the wall. I—I—looked out of the window and saw
that I could not escape, then I fainted."
"Lindsey Warwick probably stole Kay and took him there, thinking to
please you," said the senator, and his black eyes flashed as he
thought of the vengeance he would take on the kidnaper if he ever
found him.
They did not dream of the dark secret that lay behind the reluctance
of Precious to talk of the mastiff's presence in her prison. They could
not guess of the twilight hour when Ethel, sitting alone by her sister
for a little while, had knelt down by Precious and begged her not to
tell of her presence the day of the fire.
"When I saw you fall back in the smoke, Precious, I thought you
were dead, and I ran away in a frenzy of despair and came home,
afraid to tell mamma because I believed the awful news would kill
her. I thought a merciful silence would be best, so I kept the awful
secret. And if you told them now, dear, perhaps they would blame
me. They would say I ought to have sent you down the rope first,
but you know how that was, dear. I wanted to be at the bottom to
catch you if you should fall."
"Yes, I know, dear sister, and I don't think they would blame you if
we told them," sighed Precious; but because Ethel insisted on it she
gave the promise of silence.
CHAPTER XI.
TO FORGET THE LURING BLUE EYES.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com