mirror of
https://github.com/billbuchanan/appliedcrypto.git
synced 2026-02-21 11:18:02 +00:00
Update README.md
This commit is contained in:
@@ -96,18 +96,96 @@ Now run the Python file, and compare the results in L.1.2.
|
||||
* Hash rate:
|
||||
* Balance for 1GbVUSW5WJmRCpaCJ4hanUny77oDaWW4to:
|
||||
|
||||
## Setting up your Ethereum wallet on Ropsten
|
||||
The Ropsten network allows a user to test an Ethereum application, and using free Ether. Initially setup your MetaMask wallet. A document to outline how you set this up is [here](https://github.com/billbuchanan/appliedcrypto/blob/main/unit08_blockchain/lab/Metamask.pdf). Once you have set it up, answer the following:
|
||||
## Introduction
|
||||
This provides an outline of cryptocurrencies and blockchain:
|
||||
|
||||
* Lab (PDF): [here](https://asecuritysite.com/public/blockchain_lab.pdf)
|
||||
|
||||
## Part A
|
||||
|
||||
**Using blockchain.info, find the details of the genesis block:**
|
||||
|
||||
Date created:
|
||||
|
||||
Reward:
|
||||
|
||||
Number of transactions:
|
||||
|
||||
Size of block:
|
||||
|
||||
Which account received the mining reward for the genesis block (last four digits):
|
||||
|
||||
How many USD does the original miner have in the account they used for the first genesis record:
|
||||
|
||||
When did the genesis block creator stop trading?
|
||||
|
||||
|
||||
**L1.2 Using blockchain.info, determine the following:**
|
||||
|
||||
Total bitcoins in circulation:
|
||||
|
||||
Most recent hash block (last four hex digits):
|
||||
|
||||
Block reward per block:
|
||||
|
||||
Difficulty:
|
||||
|
||||
Average time between blocks:
|
||||
|
||||
Market capitalisation (USD):
|
||||
|
||||
24 hr price (USD):
|
||||
|
||||
24hr transactions (USD):
|
||||
|
||||
Hash rate:
|
||||
|
||||
Last successful miner:
|
||||
|
||||
Maximum block size:
|
||||
|
||||
Balance for 1GbVUSW5WJmRCpaCJ4hanUny77oDaWW4to:
|
||||
|
||||
|
||||
**L1.3 Download and created the Python file defined on this page:**
|
||||
|
||||
https://asecuritysite.com/encryption/bit
|
||||
|
||||
Now run the Python file, and compare the results in L.1.2.
|
||||
|
||||
Total bitcoins in circulation:
|
||||
|
||||
Most recent hash block (last four hex digits):
|
||||
|
||||
Block reward per block:
|
||||
|
||||
Difficulty:
|
||||
|
||||
Average time between blocks:
|
||||
|
||||
Market capitalisation (USD):
|
||||
|
||||
24 hr price (USD):
|
||||
|
||||
24hr transactions (USD):
|
||||
|
||||
Hash rate:
|
||||
|
||||
|
||||
|
||||
## B Ethereum
|
||||
## Setting up your Ethereum wallet on Sepolia
|
||||
The Sepolia network allows a user to test an Ethereum application, and using free Ether. Initially setup your MetaMask wallet. A document to outline how you set this up is [here](https://github.com/billbuchanan/appliedcrypto/blob/main/unit08_blockchain/lab/Metamask.pdf). Once you have set it up, answer the following:
|
||||
|
||||
* What is your public ID (just define the first four hex values)?
|
||||
* Find out someone else's public ID, and send them 0.001 Ether. If you are doing the lab on your own, send it to Bill (ID: 0xbB15B38e4ef6aF154b89A2E57E03Cd5cbD752233).
|
||||
* Can you see the transaction on the Ethereum network? An example of a wallet is [here](https://ropsten.etherscan.io/address/0xbb15b38e4ef6af154b89a2e57e03cd5cbd752233).
|
||||
* Can you see the transaction on the Ethereum network? An example of a wallet is [here](https://sepolia.etherscan.io/address/0xbb15b38e4ef6af154b89a2e57e03cd5cbd752233).
|
||||
* Can you see your transaction on the Ethereum network for the person you send it to?
|
||||
* What was the transaction fee for the transfer? If you were using the main Ethereum network, how much would the transaction cost in Dollars?
|
||||
* Ask someone to send you 0.001 Ether. Did you receive it? If you are doing the lab on your own, ask your lab tutor to send you 0.001 Ether.
|
||||
|
||||
## Creating a Smart Contract in Ethereum
|
||||
So, let’s write a bit of code that does some simple maths. In the following we will implement sqrt(), sqr(), mul(), sub(), and add():
|
||||
So, let’s write a bit of code that does some simple maths. In the following we will implement sqrt(), sqr(), mul(), sub(), and add(). First, we open up https://remix.ethereum.org/. and enter the following Solidy contract:
|
||||
|
||||
```solidity
|
||||
pragma solidity ^0.8.0;
|
||||
@@ -145,7 +223,7 @@ Once entered, we can then compile it with the Solidity compiler. It is important
|
||||
|
||||

|
||||
|
||||
Once compiled we can then deploy the smart contract to a test network (Ropsten). For this , we need to connect our Metamask wallet:
|
||||
Once compiled we can then deploy the smart contract to a test network (Sepolia). For this , we need to connect our Metamask wallet:
|
||||
|
||||

|
||||
|
||||
@@ -159,7 +237,13 @@ And clicking through gives us the address of the contract, and then viewing it o
|
||||

|
||||
|
||||
|
||||
The address here is “0x0895..”, so we can view the smart contract from: [here](https://ropsten.etherscan.io/address/0x0895a540cff8e7829284f1d9c55daf624d6e2df9). We now need to verify and publish the contact, with click on “Verify and Publish”:
|
||||
The address in the screenshot above is “0x0895..”, so you can click on your own address and view the smart contract in Etherscan.
|
||||
|
||||
In another example:
|
||||
|
||||

|
||||
|
||||
The address of the contract is "0x3a40..", so you can visit it from from: [here](https://sepolia.etherscan.io/address/0x3a407068a13bfef0db1e319c364c153391b158cf). We now need to verify and publish the contact, with click on “Verify and Publish”:
|
||||
|
||||

|
||||
|
||||
@@ -177,7 +261,7 @@ We then need to add your code for it to be checked:
|
||||

|
||||
|
||||
|
||||
We now have the contract published to the Ropsten test network:
|
||||
We now have the contract published to the Sepolia test network:
|
||||
|
||||

|
||||
|
||||
@@ -455,7 +539,7 @@ The wallet ID is the public ID of your wallet in Metamask. Now we compile:
|
||||
|
||||

|
||||
|
||||
Next, we will deploy to the Ropsten test network:
|
||||
Next, we will deploy to the Sepolia test network:
|
||||
|
||||

|
||||
|
||||
@@ -471,11 +555,13 @@ Once deployed, we can view the contract details:
|
||||
|
||||

|
||||
|
||||
And can then view the transaction for the contact [<a href="https://ropsten.etherscan.io/tx/0x70604b7c25c12eea5210c75afaa89879f383dc94b894d570f06925d0d95b7fdb" target="_blank">here</a>]:
|
||||
And can then view the transaction for the contract:
|
||||
<!-- [<a href="https://ropsten.etherscan.io/tx/0x70604b7c25c12eea5210c75afaa89879f383dc94b894d570f06925d0d95b7fdb" target="_blank">here</a>] -->
|
||||
|
||||

|
||||
|
||||
And then view the contact [here](https://ropsten.etherscan.io/address/0x7db2f938e1037a13dde315634a71a91625542a52")]:
|
||||
And then view the contact:
|
||||
<!-- [here](https://ropsten.etherscan.io/address/0x7db2f938e1037a13dde315634a71a91625542a52")] -->
|
||||
|
||||

|
||||
|
||||
@@ -515,7 +601,8 @@ We can now transfer the cryptocurrency to another wallet:
|
||||
|
||||

|
||||
|
||||
We can view the ENUToken: [here](https://ropsten.etherscan.io/token/0x7db2f938e1037a13dde315634a71a91625542a52)]:
|
||||
We can view the ENUToken:
|
||||
<!-- [here](https://ropsten.etherscan.io/token/0x7db2f938e1037a13dde315634a71a91625542a52)] -->
|
||||
|
||||

|
||||
|
||||
@@ -525,6 +612,8 @@ Now answer the following:
|
||||
* Now send 0.1 of your token to someone else's wallet. If you want, you can send to your tutor's wallet. Bill's wallet is 0xbb15b38e4ef6af154b89a2e57e03cd5cbd752233
|
||||
* Did they receive the token?
|
||||
|
||||
|
||||
|
||||
## Saving the state
|
||||
|
||||
Smart contracts give us the opportunity to store data in a stateful way, and where we can add and delete data within the smart contact, and then view a current state. So let’s do a simple contact of adding cities to a string array. Overall it will cost us some gas to add and delete strings, but not to view the state. The contract we will use is:
|
||||
|
||||
Reference in New Issue
Block a user