Home
k0nze
Cancel

Estimate Gas in Ethereum Transactions with Python web3 and brownie

The Python package brownie does not offer a built-in function to estimate the gas of a transaction calling a smart contract function before broadcasting it. However, together with web3 a gas estimation is pretty straightforward. For this example, the Faucet contract, together with the project structure from the article on “Compile and Interact with Solidity...

Python Course #11: Dictionaries for Complete Beginners (incl. Free Cheat Sheet)

thumbnail
After learning about the data types list, tuple, and set let’s talk about the Python Dictionary (dict). The Python dictionary is an ordered and mutable data type that stores key-value pairs. That means there is no index as you know them from lists and tuples; instead, there is a unique key to access an element...

Compile and Interact with Solidity Smart Contracts with the Python brownie Package and VSCode

The most commonly used language to interact with Ethereum Smart Contracts is JavaScript. However, JavaScript has some very notable flaws (taken from https://www.destroyallsoftware.com/talks/wat check it out if you want a good laugh): > [] + [] < '' > [] + {} < [object Object] > {} + [] < 0 Python is not perfect...

How to Set up a Local Ethereum Network on Windows 11 and Connect MetaMask

Everyone is talking about blockchain, web3, smart contracts, etc., and you probably want to check out how it works and what you can do with it. In this article, you will learn how to set up your own local Ethereum network on Windows 10/11 to test all the possibilities that the Ethereum blockchain offers without...

Python Course #10: Sets for Complete Beginners (incl. Free Cheat Sheet)

thumbnail
The next data type on the list is the Python set. The Python set can, such as the tuple (Python Course #9: Tuples) and the list (Python Course #8: Lists), store multiple values, however, a Python set does not have an order which is in accordance with the mathematical definition of a set. Two other...

Python Course #9: Tuples for Complete Beginners (incl. Free Cheat Sheet)

thumbnail
In the Python Course #8 you learned everything about Python list, list slicing, and all the list functions that Python provides. In this article, you will learn about another sequential data type, the tuple. The data type tuple is inspired by the tuples in mathematics (Wikipedia) and in stark contrast to Python lists tuples are...

Python Course #8: Lists, List Slicing, and all List Functions (incl. Free Cheat Sheet)

thumbnail
In this article, you will learn about the sequential data type list. In the first article on data types you have seen the primitive data types bool, int, float and str. While str is also a sequential data type and behaves similar to a list in many ways with one key difference. A str can...

Python Course #7: Conditional Statments if, else and elif

thumbnail
After learning a lot about Boolean algebra, binary numbers and how to add, subtract, multiply and divide them let’s get back to programming Python. The first couple of programs you have written so far are static and don’t have any dynamic behavoir. That means the program data stored in variables does not have an effect...

How to Install Python on Windows 11 and Fix Python not Recognized

thumbnail
To install the latest version of Python on Windows 11, head over to the Python download website and choose Windows Installer (64-bit) under the Stable Release section: When the download has finished, open your downloads folder and double click on the installer. In the installer window, make sure to check Add Python 3.X to PATH...

Python Course #6: Multiplying and Dividing Binary Numbers

thumbnail
Now that you can add and subtract binary numbers (Python Course #5: Adding and Subtracting Binary Numbers),let’s take it one step further and multiply and divide binary numbers. Multiplying Binary Numbers First, look at decimal multiplication and how you probably learned how to do it in school. Take, for example, the multiplication of \(23\cdot 45\)....