Run your own Bitcoin Node with Umbrel

Bitcoin adoption is occurring five times faster than Internet adoption in the mid nineties. For most who buy, store, spend and trade their Sats, they use a custodial service such as Coinbase, Binance, Crypto.com or Celsius etc.

The thing is, those custodians are not actually looking after your bitcoins at all, since the bitcoins are simply UTXOs on a decentralised, distributed blockchain. No bitcoins enter the blockchain from outside and no bitcoins leave it. The blockchain is a closed system, albeit open, permissionless, censorship resistant, and all that good stuff.

So what are they looking after? Well, the private key that accesses the bitcoins that you have purchased. The likelihood is, that your balance is simply a query of a centralised database, sat in a cloud service providers data centre and the private key to the exchanges balance is theirs, not yours. So other than a way of having exposure to the bitcoin digital assets price movement, it’s kind of missing the whole point of bitcoin being a peer to peer digital currency with no intermediaries since you’re not custodian of the private keys to your own bitcoin balance on the blockchain.

Also, in order to transact, you need an intermediary validator node. That maybe the crypto wallet custodian service provider or maybe they themselves use another third party node service provider. The point is, you don’t know and all of a sudden we’ve gone from being “self sovereign bitcoiners” to just being clients of a crypto bank with an unknown number of intermediaries confirming and validating and tracking and approving (or not), our “peer to peer” bitcoin transactions. And bitcoins open and permissionless design just got regulated to require KYC. So you’re handing over all kinds of documentation, most likely to an unregulated foreign corporate who in return lets you query their centralised database of customers bitcoin balances based on how much bitcoin they sold to you. It’s not ideal is it?

The first step in upping ones game (and massively upping the level of responsibility) is to host your own private keys to your non-KYC bitcoin address using a hardware wallet, and very very very securely storing the recovery phrase to the private key such that every kind of natural disaster is accounted for. With bitcoin, its easy to store your wealth in a seizure resistant way, but its also easy to put yourself on the other side of bitcoins security if you lose the ability to access your own wallet over 5, 10, 15 or 50 years. So bear that in mind too.

Even hosting your own private keys still requires you to use software client from a company such as Ledger, Trezor etc to provide the full node needed to validate and confirm your transactions, even though you now verify the transactions yourself using the hardware wallet device.

So the next level of self sovereignty means running your own node. There are two easy ways to do this.

  1. Run bitcoin core software on a linux machine or a windows machine and wait until the full blockchain has been synchronised to your local storage.
  2. Run Umbrel – a comprehensive suite of “apps” running on a raspberry pi or a linux host, including a bitcoin core node and lightning node (by default).

In order to get umbrel up and running the quickest and easiest way (and lowest power way), I’d recommend a raspberry pi with very fast and large microSD card, at least 4GB RAM (8GB better if you intend to run many of the other apps available in the Umbrel App Store) and a 1TB minimum NVME external storage device to house the 600GB bitcoin blockchain.

I use a raspberry pi 400 with 4GB RAM and run Bitcoin Core and Lightning nodes, Samourai Dojo Server, Tailscale VPN, Pi-Hole and Bitfeed. And it runs very nicely indeed.

Getting up and running was a five minute job – no, it really was I swear, which makes it all the more tragic that people aren’t running their own bitcoin nodes. Plenty of people run their own media centres and nas storage at home, and running your own bitcoin node is no more difficult. Umbrel have made this super easy to do.

  1. Download the sd card image from Umbrel

Follow the wizard all the way through. I used Raspberry Pi Imager to write the image file to the sc card, same as I would with any other Pi image, but Umbrel recommend a different one. You do you, but I’d recommend one or the other since I know they both work.

Then plug in your 1TB NVME Storage device, pop the sd card in the Pi, connect it to your network with a cable rather than wifi and power it up (use a proper pi power supply).

After a short while, you’ll be able to access http://umbrel.local from a laptop or desktop on your network and watch umbrel getting itself ready, then you can go through the motions of creating the bitcoin core wallet etc using the easy to use GUI. Make a note of all the bitcoin recovery phrase words just as you would with your hardware wallet.

The bitcoin blockchain will start to sync and will take a few days probably since its not just the download of lots of little files, but also the verification that they’re all present and correct (cryptographically verified accordingly).

While the bitcoin blockchain is syncing though, you can enable 2FA in the Setting and Install the other apps available in the app store.

Be sure to enable 2FA in Umbrel’s admin console, just as you would with a custodian cryptocurrency wallet provider!

I’d definitely recommend Tailscale VPN so that you can get to your node using your phone or laptop from anywhere in the world as if its on your local lan. Once installed, log on using a google account (other options available too) and see all the devices on your network and the IP addresses you need to access them by logging into https://login.tailscale.com/admin/machines

You can still run this at the same time as connecting to ExpressVPN if you’re using public Wi-Fi too. It’s “as well as” rather than “instead of”.

I’d also recommend pihole. It replaces the DHCP server and thus your primary DNS server on your LAN so provide Ad protection to your entire network.

Check out the Umbrel App Store from your Umbrel Node’s admin page for the other apps available, such as BTCPay Server to send invoices and receive bitcoin payments and also Samourai Dojo Server so that you can connect your Samourai BTC wallet app on your mobile device to your own bitcoin node if you use Bitcoin’s CoinJoin privacy feature that the Samourai wallet provides.

It’s really quick and easy to get all this up and running. I did it in a couple hours and everything just worked. I have to say, I’m very impressed.

Be sure to take a good solid set of notes as you go along, because you need to know how to recover all of this in the event your Pi or NVME block storage device goes pop!

You should only store enough bitcoin on your Umbrel wallet that you’d be prepared to loose. Your main stack should be kept in cold storage and moved to Umbrel and and when you need to open a lightning channel or make a transaction. Umbrel is considered Beta software, but it’s a very well polished offering already and will only get bigger and better as more products are included in the app store.

Welcome to the new era of the decentralised internet!

Upgrade to version 0.5.0

A new upgrade and the biggest Umbrel upgrade yet has just been released today (7/6/2022). I’ve logged on to my Umbrel node using the Tailscale address, backed up my channels as prompted and clicked on Upgrade…

New containers are initially downloaded
Old containers are then removed
A new welcome screen welcomes me back to my newly upgraded Node
A new desktop replaces the previous dashboard
Bitcoin Node app

Everythings running fine.

Update: I discovered this excellent tutorial on setting up Lightning. I highly recommend it, although setting an alias for your lightning node isn’t easy like it once was. I managed to crash my Umbrel node trying to change it -and from 2.5 hours away. D’oh! I Have No Idea What I’m Doing: Lightning on Umbrel⚡️ | Stonly

Facebooktwitterredditpinterestlinkedinmail

Installing Tailscale VPN client on Linux

Tailscale is a very slick, free VPN solution that places all your devices inside your home LAN, even when you’re out and about.

Each device is assigned an IPv4 address so you can communicate with all the devices and services in your home network from anywhere.

The client for Android is available in the Play Store.

The commands below get you up and running on your Linux Mint 20.3 and/or Ubuntu 20.4.5.

curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyr
ing.gpg >/dev/null
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailsca
le.list
sudo apt-get update
sudo apt-get install tailscale
sudo tailscale up
tailscale ip -4

Tailscale is free to use for personal use and is available in the Umbrel App Store, if you’re running your own Umbrel Bitcoin and Lightning Validator Node and want to connect your wallet to it from anywhere.

Once installed, log in here to see all your tailscale connected devices.

The Umbrel app store also contains Samourai Dojo Server so you can connect your Bitcoin Samourai wallet to your own Dojo Server and perform transactions privately using Bitcoin’s CoinJoin privacy feature.

Facebooktwitterredditpinterestlinkedinmail

PowerShell and the Windows Event Log

What was once easy, is now exceptionally convoluted and difficult. There is some chance that your automated script is already logging to the event log (PowerShell Core/Operational) but there’s every chance that log is full of Warnings too. Good luck. LOL

New-WinEvent

The New-WinEvent cmdlet creates an Event Tracing for Windows (ETW) event for an event provider. You can use this cmdlet to add events to ETW channels from PowerShell.

New-WinEvent [-ProviderName] <String> [-Id] <Int32> [-Version <Byte>] [[-Payload] <Object[]>] [<CommonParameters>]

Examples:

New-WinEvent -ProviderName Microsoft-Windows-PowerShell -Id 45090 -Payload @("Workflow", "Running")

More on New-WinEvent here.

Get-WinEvent

The Get-WinEvent cmdlet gets events from event logs, including classic logs, such as the System and Application logs. The cmdlet gets data from event logs that are generated by the Windows Event Log technology introduced in Windows Vista and events in log files generated by Event Tracing for Windows (ETW). By default, Get-WinEvent returns event information in the order of newest to oldest.

Get-WinEvent [[-LogName] <String[]>] [-MaxEvents <Int64>] [-ComputerName <String>] [-Credential <PSCredential>] [-FilterXPath <String>] [-Force] [-Oldest] [<CommonParameters>]

More on Get-WinEvent here.

The post below is the deprecated way of interacting with the Event Log from PowerShell. In Powershell 7 onwards, use New-WinEvent and Get-WinEvent cmdlets.

The command Get-Command -Name *Event will still list the deprecated commands shown below but they will not work and will error with “The term ‘New-EventLog’ is not recognised as a name of a cmdlet…”

The command Get-Command -Name *WinEvent will list the supported cmdlets, namely New-WinEvent and Get-WinEvent

PowerShell Commands to interact with Windows Event Log

New-EventLog
Get-EventLog
Show-EventLog
Clear-EventLog
Write-EventLog
Limit-EventLog
Remove-EventLog

New-EventLog

Creates a new event log and a new event source on a local or remote computer.
This cmdlet creates a new classic event log on a local or remote computer. It can also register an event source that writes to the new log or to an existing log.


New-EventLog
[-LogName]
[-Source]
[[-ComputerName] ]
[-CategoryResourceFile ]
[-MessageResourceFile ]
[-ParameterResourceFile ]
[]

Get-EventLog

Gets the events in an event log, or a list of the event logs, on the local computer or remote computers.


Get-EventLog
[-LogName]
[-ComputerName ]
[-Newest ]
[-After ]
[-Before ]
[-UserName ]
[[-InstanceId] ]
[-Index ]
[-EntryType ]
[-Source ]
[-Message ]
[-AsBaseObject]
[]

Show-EventLog

Displays the event logs of the local or a remote computer in Event Viewer.
The Show-EventLog cmdlet opens Event Viewer on the local computer and displays in it all of the classic event logs on the local computer or a remote computer.


Show-EventLog
[[-ComputerName] ]
[]

Clear-EventLog

Clears all entries from specified event logs on the local or remote computers.
The Clear-EventLog cmdlet deletes all of the entries from the specified event logs on the local computer or on remote computers. To use Clear-EventLog, you must be a member of the Administrators group on the affected computer.


Clear-EventLog
[-LogName]
[[-ComputerName] ]
[-WhatIf]
[-Confirm]
[]

Write-EventLog

Writes an event to an event log.
To write an event to an event log, the event log must exist on the computer and the source must be registered for the event log.


Write-EventLog
[-LogName]
[-Source]
[[-EntryType] ]
[-Category ]
[-EventId]
[-Message]
[-RawData ]
[-ComputerName ]
[]

Limit-EventLog

Sets the event log properties that limit the size of the event log and the age of its entries.
The Limit-EventLog cmdlet sets the maximum size of a classic event log, how long each event must be retained, and what happens when the log reaches its maximum size. You can use it to limit the event logs on local or remote computers.


Limit-EventLog
[-LogName]
[-ComputerName ]
[-RetentionDays ]
[-OverflowAction ]
[-MaximumSize ]
[-WhatIf]
[-Confirm]
[]

Remove-EventLog

Deletes an event log or unregisters an event source.
The Remove-EventLogcmdlet deletes an event log file from a local or remote computer and unregisters all its event sources for the log. You can also use this cmdlet to unregister event sources without deleting any event logs.


Remove-EventLog
[[-ComputerName] ]
[-LogName]
[-WhatIf]
[-Confirm]
[]

Example: Write events from a powershell script to the Windows Event Viewer Application Log.

First register a new Application EventLog source.

New-EventLog -LogName Application -Source 'MyScript.ps1'

The Event Log itself requires five pieces of information before an event can be written to it.

  • LogName (Application)
  • Source (Script Name)
  • EventID
  • EntryType (Information, Error or Warning)
  • Message

The following code demonstrates how you might gather these pieces of information inside a statement and how you’d then write the event itself.

$filePath = 'C:\MyFile.txt'

$parameters = @
{

  'LogName'  = 'Application'

  'Source'  = 'MyScript.ps1'

}

if (Test-Path –Path $filePath) 
{

  $parameters  += @{

  'EventId'  = 1111 

  'EntryType'  = 'Information'

  'Message'  = 'The file already exists'

  }

  Write-EventLog  @parameters

} 
else 
{

  $parameters  += @{

  'EventId'  = 1112

  'EntryType'  = 'Error'

  'Message'  = 'The file does not exist'

  }

  Write-EventLog @parameters

  }

Top Tip: You may already have a Function in your script to perform Logging to a file. You could augment it to include some code to add an event to the Windows event log depending on the outcome of the script or code loop.

Facebooktwitterredditpinterestlinkedinmail

Automated FTP Operations from PowerShell 7 using WinSCP .NET Assembly and WinSCP PowerShell Module.

This is the simplest method of automating ftp operations from PowerShell that I can come up with, having explored MANY incredibly convoluted alternatives.

It is an absolute minimum viable product that can be built upon, consisting of two downloadables that compliment one another and eight commands that probably do everything you need, and do it in a single command.

A link to the wiki for all the cmdlets is given in step 10 below.

Once the WinSCP module is installed, interfacing with an FTP server is as easy as this…
CerberusFTP Server displaying the inbound session from PowerShell using WinSCP cmdlets that call WinSCP .NET Assembly winSCPnet.dll
Don’t forget to close the ftp session when you’re done….
….and the session disappears from Cerberus FTP Server.

0. Download Software

Download matching versions of the Assembly and Cmdlets (5.17.10.0). The most recent version of the Automation .NET Assembly is 5.19.6.0 but you may have issues talking to WinSCP 5.19.6.0 using version 5.17.10.0 Cmdlets such as New-WinSCPSession where it complains about the winscp.exe version not matching the winscpnet.dll version.

WinSCP Automation .NET Assembly

https://sourceforge.net/projects/winscp/files/WinSCP/5.17.10/

WinSCP PowerShell Cmdlets (PowerShell Module)

https://github.com/dotps1/WinSCP/releases/download/WinSCP-PowerShell-v5.17.10.0/WinSCP.zip

1. Install WinSCP FTP Module in PowerShell 7

Install-Module -Name WinSCP
Import-Module -Name WinSCP
Add-Type -Path "WinSCPnet.dll"

2. Create encrypted credentials .xml file for use when connecting to ftp server automatically

$credential = Get-Credential
$credential | Export-Clixml ftpcredentials.xml
$ftpcredentials = Import-Clixml ftpcredentials.xml

3. Establish a session with an FTP Server

$ftpsessionoptions = New-WinSCPSessionOption -Credential $ftpcredentials -HostName "ftp.cyberfella.co.uk" -Protocol ftp

New-WinSCPSession -SessionOption $ftpsessionoptions

4. See if a file exists on the ftp server

Test-WinSCPPath -Path "/*.done"         


                False

5. Receive a file

Receive-WinSCPItem -RemotePath /ftptest.txt


                   Destination: C:\Users\matt\Documents\WindowsPowerShell\My Code

                IsSuccess FileName
                --------- --------
                True      ftptest.txt

6. Send a file

 Send-WinSCPItem -LocalPath "ftptest.txt"


                   Destination: \

                IsSuccess FileName
                --------- --------
                True      ftptest.txt

7. Send a folder and its entire contents (recursive by default)

Send-WinSCPItem -LocalPath "FTPTest"


                   Destination: \FTPTest

                IsSuccess FileName
                --------- --------
                True      {FTP-Functions-MB.ps1, ftptest.txt, ListFTP-MB.ps1}

8. Receive a folder and its entire contents (recursive by default)

Receive-WinSCPItem -RemotePath /FTPTest


                   Destination: C:\Users\matt\Documents\WindowsPowerShell\My Code\FTPTest

                IsSuccess FileName
                --------- --------
                True      {FTP-Functions-MB.ps1, ListFTP-MB.ps1, ftptest.txt}

9. Close Session to FTP Server

Remove-WinSCPSession

10. Wiki doc for all cmdlets here

https://github.com/dotps1/WinSCP/wiki

Additional commands required for Secure FTP (SSH Hostkey Fingerprint)

The example above was kept as simple as possible to demonstrate the minimum number of steps in order to “get things working”. Now we can build upon those steps and establish an sftp connection to the FTP Server.

Additional commands to set up an sftp session

Import-Module -Name WinSCP
Add-Type -Path "WinSCPnet.dll"

$ftpcredentials = Import-Clixml ftpcredentials.xml

$ftpsessionoptions = New-WinSCPSessionOption -Credential $ftpcredentials -HostName "10.0.2.15" -Protocol sftp

$sshHostKeyFingerprint = Get-WinSCPHostKeyFingerprint -SessionOption $ftpsessionoptions -Algorithm SHA-256

$ftpsessionoptions.SshHostKeyFingerprint = $sshHostKeyFingerprint

New-WinSCPSession -SessionOption $ftpsessionoptions

Cerberus FTP Server showing the sftp connection

Send-WinSCPItem -LocalPath "FTPTest"

Cerberus FTP Server Log entries showing the connection and the recursive transfer of a folder containing multiple files.

Receive-WinSCPItem -RemotePath /FTPTest

Recursively downloading a folder containing multiple files over sftp

Remove-WinSCPSession

The session disappears from Cerberus

My Powershell Code

# Pre-requisites
# EXECUTION POLICY SET TO BYPASS (TEST ENV)
# https://docs.microsoft.com/en-gb/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.2
# Set-ExecutionPolicy -ExecutionPolicy ByPass

# WinSCP Automation .NET Assembly
# https://winscp.net/download/WinSCP-5.19.6-Automation.zip    #WINSCP AUTOMATION .NET LIBRARY DLL
# https://winscp.net/eng/docs/library_powershell#example      #NOTES ON INSTALLATION OF DLL
# https://dotps1.github.io/WinSCP/                            #WINSCP CMDLETS MODULE

# Install (Run PowerShell as Administrator)
# Install-Module -Name WinSCP

# Import Module
Import-Module -Name WinSCP

# Cmdlets
# Get-Command -Module WinSCP

# Load WinSCP .NET assembly
Add-Type -Path "WinSCPnet.dll"

#Create Credential
#Set credentials to a PSCredential Object.
#$credential = Get-Credential
#Export credential to xml file
#$credential | Export-Clixml ftpcredentials.xml
#Import credential from xml file
$ftpcredentials = Import-Clixml ftpcredentials.xml

#VARIABLES SECTION
$ftphost="10.0.2.15"
$ftproot="/"
$ftpdirectory="FTPTest/"
$SendItem = $ftpdirectory + ""
$ReceiveItem = $ftpdirectory + ""
$FileFilter = "*"
#END OF VARIABLES SECTION

#FUNCTIONS SECTION
function Connect-FTP {
    #Connects using sftp to ftp server
    Write-Host "Connecting to FTP Server $ftphost..."
    $ftpsessionoptions = New-WinSCPSessionOption -Credential $ftpcredentials -HostName $ftphost -Protocol sftp
    $sshHostKeyFingerprint = Get-WinSCPHostKeyFingerprint -SessionOption $ftpsessionoptions -Algorithm SHA-256
    $ftpsessionoptions.SshHostKeyFingerprint = $sshHostKeyFingerprint
    New-WinSCPSession -SessionOption $ftpsessionoptions
    Write-Host "Connected Successfully to FTP Server $ftphost."
}
function Disconnect-FTP {
    #Disconnects session to ftp server
    Write-Host "Disconnecting from FTP Server $ftphost..."
    Remove-WinSCPSession
    Write-Host "Disconnected."
}
function List-FTP {
    #Gets a list of the files matching the filter in the specified ftp directory only (1 level)
    Connect-FTP
    Write-Host "Listing files in $ftpdirectory..."
    $fileitems = Get-WinSCPChildItem -Path $ftproot$ftpdirectory -Depth 1 -File -Filter $FileFilter
    Disconnect-FTP
}   
function Send-FTP {
    #Sends a specified local file or recursive directory's contents to ftp server
    Connect-FTP
    Write-Host "Sending everything in $SendItem to $ftphost..."
    Send-WinSCPItem -LocalPath $SendItem
    Write-Host "Finished sending."
    Disconnect-FTP
}
function Receive-FTP {
    #Receives a specified remote file or directory on the ftp server recursively by default
    Connect-FTP
    Write-Host "Receiving file(s) in $ReceiveItem from $ftphost..."
    $fileitems = Receive-WinSCPItem -RemotePath $ReceiveItem
    Write-Host "Finished receiving."
    Disconnect-FTP
}
#END OF FUNCTIONS SECTION

#MAIN CODE
List-FTP
Receive-FTP
Send-FTP
#END OF MAIN CODE
Executing the script above to list files on an ftp server over sftp, download a folder and upload a folder
Facebooktwitterredditpinterestlinkedinmail

Fan Speed Control on Dell XPS 15 running Linux

Add dell-smm-hwmon sensors to kernel modules

sudo su
echo "options dell-smm-hwmon restricted=0 force=1" > /etc/modprobe.d/dell-smm-hwmon.conf
echo "dell-smm-hwmon" > /etc/modules
exit
sudo update-initramfs -u

Reboot, and the fans should be visible with:

sensors
dell_smm-virtual-0
Adapter: Virtual device
fan1: 0 RPM
fan2: 0 RPM

Control System i8kutils

Install i8kutils to take control of the fans.

sudo apt install i8kutils
sudo su
echo "i8k" > /etc/modules
echo "options i8k force=1" > /etc/modprobe.d/i8k.conf
exit

Reboot

sudo modprobe i8k force=1


Configure i8kutils

sudo vi /etc/i8kmon.conf

I left the config file at the defaults and the fans stayed under control as did the temps. check the temps and fan speeds at any time with the sensors command

sensors
45 – 50 degrees C and 2500 RPM fan speeds whilst running Brave and Virtual Box
Facebooktwitterredditpinterestlinkedinmail

Enabling Snaps in Linux Mint 20+

Linux MInt has taken the decision to disable the ability to install snapd and subsequently containerised apps (or snaps) from the Ubuntu Snap Store.

Linux Mint users are met with an error when attempting to install snapd or snap store applications

You can disable the block on installing snapd as follows.

sudo rm /etc/apt/preferences.d/nosnap.pref
sudo apt update
sudo apt install snapd

This will allow you to install those specific containerised versions of apps that you want, e.g. Whatsdesk (a containerised Whatsapp client for your Linux desktop).

sudo snap install whatsdesk
Facebooktwitterredditpinterestlinkedinmail

Expand the existing Swapfile on Linux

Note that this only applies if you’re using a swapfile as opposed to a swap partition. This will apply if you’re using full disk encryption since the swap file is then also encrypted. Most modern linux distro’s will behave in this way by default.

Ignore the first dd command since it contains a typo (shown)

If you’re using KDE Plasma as your desktop environment, for entertainment purposes, open Memory.

The Memory Information dialog opens to look like this.

Now expand the window by dragging a corner and you’ll see some neat graphs of memory usage…

Memory and Swap Usage graphs in KDE Plasma Desktop Environments “Memory” app

Now with your Konsole to one side of the graphs, observe the changes going on on the system as you execute each command. Really quite cool. KDE Plasma is great. By far my favourite desktop environment. I recommend it but live in it for a week and figure it all out since it’s quite comprehensive. You’ll likely not go back!

Facebooktwitterredditpinterestlinkedinmail

Windows 10 De-Bloat and Customise

Download latest Windows 10 ISO from here and perform a Windows 10 Pro installation to a freshly procured virtual machine. Say No to pretty much everything. Log into your Microsoft account during installation if you have other synchronised Windows devices already.

If using Oracle Virtualbox, insert VirtualBox Guest Additions CD and install, Reboot VM

If using an Sun Microsystems/Oracle Keyboard, change Host Key to Alt Graph on Keyboard since there’s no Right-Ctrl key which is the default.

Search for Windows Updates, Check for Updates, Install Windows Updates, Reboot VM

Open Powershell as Administrator and run the following command taken from here

iex ((New-Object System.Net.WebClient).DownloadString('https://git.io/JJ8R4'))

Remove components you don’t require by clicking on each button. The script to remove the feature will execute in the PowerShell console behind.

I like to install Rainmeters and I simply stick with the default meters/widgets so I can easily keep track of the VM resource consumption at a glance, if things should slow up..

This is a running list of optimizations I’ve made in the past on problematic Windows 10 desktop systems to speed them up/fix them.

remove avast AV
remove avast VPN
restore windows defender AV
remove windows c++
check startup programs, remove superflouous items
analyze and defrag hard disk
reset windows updates
remove transparency effects
install rainmeter and fix items to desktop
make rainmeters disappear on mouse over
install brave browser
remove immediate access to MS Edge browser
set dark themes in windows and brave
change power settings to optimize for performance
change power settings to not power down or sleep when plugged in
change windows updates to dynamically adjust times when it performs windows updates based on usage
change display effects to remove all special effects apart from drop shadows and show window contents when dragging.
Disabled Windows Search Service (Search Indexing)
Enable restart and notification for restart when Windows Updates needs it
troubleshoot windows updates.
system installed updates on restart
feature update to windows 10 version 2004 being prepared. leave laptop on to complete.
Synced time and set system to sync region automatically
Run cmd as admin, run SFC /scannow to check for missing / damaged system files. Some found and repaired.

Facebooktwitterredditpinterestlinkedinmail

Ethereum Private Blockchains.

This post contains the steps to setup a private Ethereum blockchain.

First, you’ll need a Linux vm. Please note that this post assumes a medium/advanced level of knowledge. As such, it will be much more succinct than most posts in other categories.

INSTALL ETHEREUM

sudo apt-get install software-properties-common
Add the ethereum repository: sudo add-apt-repository -y ppa:ethereum/ethereum
Update the package list and upgrade entire system
Install Ethereum.

CREATE DIRECTORY TO STORE THE BLOCKCHAIN

Create a directory to store the blockchain

CREATE TWO ACCOUNTS

Create first account
Create second account

CREATE GENESIS BLOCK

{
  "config": {
    "chainId": 15,
    "homesteadBlock": 0,
    "eip150Block": 0,
    "eip155Block": 0,
    "eip158Block": 0,
    "byzantiumBlock": 0,
    "constantinopleBlock": 0,
    "petersburgBlock": 0,
    "ethash": {}
  },
  "difficulty": "1",
  "gasLimit": "8000000",
  "alloc": {
    "0x849b1448F8Cca9F3BCeE21F1ebcC1545f12b8e25": { "balance": "300000" },
    "0x140DBCb0eC85B62A66aCBf52DeEFd9F01abCc22A": { "balance": "400000" }
  }
}

INITIALIZE THE GENESIS BLOCK

Add the accounts created into the genesisblock.json file and initialize the blockchain with the following command…

geth -datadir="/home/matt/privatechain" init "/home/matt/privatechain/genesisblock.json"

If your genesisblock.json file is correctly written, the block will initialize with “Successfully wrote genesis state” message.

CHAINDATA AND LIGHTCHAINDATA

The chaindata and lightchaindata directories in geth indicate that your blockchain network has been created.

cd into ~/privatechain/geth and you’ll see chaindata and lightchaindata subdirectories
The genesis block.

MINING THE BLOCK

geth -datadir “/home/matt/privatechain” -mine

While the first block is being mined, ethers will be being added to your address. It may take a while depending on your parameters set in your genesisblock.json file

Typical output seen during mining

Now that mining has begun, you can see the new files that have appeared in the privatechain filesystem

geth.ipc transactions.rlp and the .ldb database files appear once the genesis block has been mined

SUMMARY

The steps performed above can be summarised as follows.

You can stop the mining process using the miner.stop() command

SMART CONTRACTS

“Smart contracts” is the name to describe a program that is compiled to execute on the blockchain network. Such programs running on Ethereum blockchains are written in the Solidity language.

SMART CONTRACT DEVELOPMENT ENVIRONMENT

Download ganache from here

It’s an .appimage weighing in at around 146MB. TruffleSuite Ganache is produced by ConsenSys Software Inc.

The TruffleSuite Ganache Downloads page.

chmod +x the ganache appimage file and execute it.

chmod +x ganache to allow execution of it

GANACHE

Enable/Disable analytics and click Continue
Click on Quickstart
Change Port Number to 8545 for use with Metamask or Brave Crypto Wallet Browser extension
Enable Crypto Wallets in Brave Browser
Click the option to Restore a Local Wallet

Enter the seed phrase from Ganache into the Seed phrase field in Brave

Copy and Paste this into the Restore Seed Phrase field in Brave Crypto Wallet Restore and set a new password for the wallet.
Once your wallet is displayed, change the Ethereum MainNet to Localhost:8545 to connect to the Ganache private blockchain.

Connect to the local Ethereum blockchain network on port 8545 (Ganache’s internal eth network) and you’ll see an initial balance of 100 ETH tokens.

Click on the coloured icon next to Localhost:8545 and Import a Wallet

In Ganache, click on the Key icon on one of the wallets (choose the 2nd one in the list of pre-configured wallets). Copy and Paste the private key into the Import screen shown above.

Copy and Paste the private key of the first ganache ethereum wallet into the Browser Crypto Wallet Importer
You’ll import the 2nd wallet, so now Brave displays the balance of the first and second Ganache wallets. Ganache comes with a few more wallets for you to play with in your private ethereum development network.

You can see in the screenshot above, two Accounts have been imported, each with a balance of 100 ETH tokens. You can import as many of the ETH wallets from Ganache as you like/need for your Solidity Smart Contract project.

Since Ganache is connected to our local private blockchain running on our localhost on port 8545, you can see the details of the genesis block in the BLOCKS section

REMIX SOLIDITY IDE

Next we need an IDE for creating code when developing, compiling and deloying Solidity smart contracts that will use our connected wallets to pay the gas fees required to store the smart contract on our private blockchain. Remix is a web-based IDE for this purpose.

The web based Remix IDE for Solidity smart contracts running on Ethereum blockchains.
Click on the Deploy and Run Transactions icon (shown) in the left-most panel, select Injected Web 3 and it’ll attempt to connect to your Brave Crypto Wallet. Tick the ETH wallet you want it to use and Authorise the connection of the wallet to Remix. Note that any actual transactions invoked when deploying compiled smart contract code as byte code to the private blockchain will still require manual authorisation by the wallet owner.
Note that none of the pre-defined smart contracts have yet been compiled into bytecode so cannot be executed using our connected wallet.
Click on the Compiler icon (shown) in the left-most panel and compile the smart contract.
The successfully compiled files can be deployed.

Compile all the scripts 1_Storage, 2_Owner, 3_Ballot and 4_Ballot_Test files. Deploy the 4_Ballot_Test file.

CONFIRM TRANSACTIONS

The connected wallet will prompt for a confirmation for the transaction.

The transactions in the smart contract will require confirmation by the owner of the connected wallet before being submitted to the private blockchain we created earlier where they’ll be mined.

AUDIT TRANSACTIONS STORED IN MINED BLOCKS

The genesis block and our two transactions above can be seen in the BLOCKS tab in Ganache.

In Ganache that we connected to our local private Ethereum blockchain, you can click on the BLOCKS section and see the mined blocks that contain our recent two transactions, the date stamp of the transaction and gas used.

Click on the transactions button for each mined block to see the details of the transaction in that block.
You can view the transactions in the TRANSACTIONS section if you don’t know what BLOCK contains it in the BLOCKS section.

SUMMARY

So far, we have…

Installed Ethereum

Created a private Ethereum blockchain on our localhost

Initialised the private blockchain

Mined the Genesis block in our private blockchain

Installed Ganache and connected it to our private blockchain

Imported two of the ETH wallets in Ganache to our Web Browser’s crypto wallet extension

Connected to Remix Solidity Smart Contract IDE

Connected Remix to one of our ETH Wallets

Compiled some Solidity Code Smart Contracts

Deployed the BallotTest smart contract to our private blockchain, confirming the transactions and accepting the gas fees.

Audited the mined blocks containing our transactions in Ganache

EXTRAS

The other smart contracts were compiled and deployed, and new blocks containing those transactions show up in Ganache.

The blocks in our private blockchain
The transactions in the blocks on our private blockchain
The transaction data contained in the contract creation transaction
The resulting balance in our connected ETH wallet used to pay the gas fees on the network
The transactions in our wallet.

FINAL WORD

Note that all this information is referenced from the same blockchain, instead of the necessity of trusted third parties storing the same data in multiple places that could be changed and a conflict introduced into the history of the transactions in potentially mismatched ledgers. In addition to having an accurate central ledger that all parties reference, we can introduce more nodes in our network that each maintain a copy of the same blockchain.

The public ETH network that maintains the main net has many thousands of ETH nodes. It is this decentralised consensus that gives the value to blockchain, along with public keys being used to verify that the parties transacting have the necessary funds without revealing the private keys necessary to unlock those funds to the public internet.

The input and outputs between the wallet addresses are performed by the closed network, keeping everybody safe. The issuance of new coins is also controlled by the network to prevent abuse of the inflation rate that could affect the purchasing value of the tokens by driving the value down by diluting the supply ad infinitum (hyper inflation caused by excessive quantitative easing, effectively) .

Facebooktwitterredditpinterestlinkedinmail