Create an account


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 20,140
» Latest member: supersport
» Forum threads: 21,971
» Forum posts: 22,842

Full Statistics

Online Users
There are currently 799 online users.
» 2 Member(s) | 791 Guest(s)
Applebot, Baidu, Bing, DuckDuckGo, Google, Yandex, mar7w7, supersport

 
  [Tut] Blockchain Basics of Smart Contracts and Solidity
Posted by: xSicKxBot - 08-07-2022, 07:55 AM - Forum: Python - No Replies

Blockchain Basics of Smart Contracts and Solidity

5/5 – (1 vote)

This article will give you an overview of the blockchain basics, transactions, and blocks.

In the previous article of this series, we looked at how to create your own token using Solidity and, specifically, events for transactions.

YouTube Video

Blockchain Basics


Blockchain technology enables us to write programs without having to think about the details of the underlying communication infrastructure.

However, just to be aware of some of the keywords which are commonly used when studying the infrastructure, we’ll name just a few among others (borrowed from the Solidity documentation):

  • mining,
  • elliptic-curve cryptography,
  • peer-to-peer network.

Although it’s interesting to see how these technologies work “under the blockchain’s hood”, the beneficial fact is that you don’t have to be closely familiar with them. You can just implicitly utilize them and maybe even forget they’re there. However, they represent some of the key elements which make up Web3.

? Note: Here, we need to establish a firm distinction between the terms Web3 in the blockchain context that is the subject of our interest when discussing Solidity, and the Semantic Web, sometimes known as Web 3.0, which is an extension of the World Wide Web, intended to make Internet data machine-readable.

Transactions


One of the main roles of a blockchain is to preserve the data and make it temper-resistant. In that sense, we can easily consider a blockchain as a globally shared, transactional database.

A blockchain network is globally shared because any party in the network can access and read its contents.

It is transactional because any change to the blockchain has to be accepted by almost all, or at least the majority of other members, depending on the blockchain implementation.

In database theory and practice having a transactional property means two things: the change to the database is either applied completely or not at all (see here); no other transaction can modify the effect of a transaction being executed.

We regularly ensure the equivalent behavior of our smart contracts by using error handling and control structures available in Solidity (docs).

Blockchain Security


There is also a strong security property that is inherent in the way how blockchain works: each new block header includes the hash of the previous block.

To alter a block in a blockchain, an attacker would have to re-mine the targeted block and all the following blocks, therefore creating a chain fork.

Also, an attacker would need to invest more total work than was invested in the original chain segment to get his chain fork accepted by the rest of the network (source).

The latter would require immense computing power and energy, making the entire effort unfeasible in theory.

However, there have been successful attacks on blockchain networks, mostly due to the smaller scale of a particular network, where a fraudulent consensus (the verification process) was less difficult to fabricate, block creation errors, or insufficient security measures (source).

Example Application


An example to the story above is already given in part by the example we did in the previous article: a smart contract for (simulated) currency transfer between any two parties.

There was a list of accounts holding balances in a cryptocurrency, Wei, and our smart contract supported transfers of a given amount of currency from the sender to the receiver.

What’s important in the context of such transactions is that the same amount of currency should always be “simultaneously” deducted from the sender’s account and added to the receiver’s account.

What we mean by “simultaneously” is not a matter of happening at the same moment, but happening with the same, but the opposite consequence, i.e. if the amount gets successfully deducted from the sender’s account, it has to be added to the receiver’s account.

If an error occurs after the amount is decreased from the sender’s account, but before the amount is added to the receiver’s account, the operation should revert to the smart contract’s previous state, as it was before the transaction started.

This way, the blockchain behaves in a consistent, transactional manner and warrants that the transaction will be done entirely or not at all.

In the context of everything said so far, with our subcurrency example in mind, we may ask ourselves:

? Question: How would we enable an account owner to transfer the currency only from the account in his ownership?

The answer to the question is relatively simple:

? Answer: A transaction always bears the sender’s cryptographic signature, which serves as a seal in granting access to precisely defined modifications of (operations on) the database, such as currency transfer from the account owner originally holding the currency, to the account owner – receiver of the currency.

Blocks


There is no story about blockchain without actually mentioning the block itself. We will definitively return to talk about a block from some other angles, but with a security perspective in mind, we will focus on overcoming a significant obstacle known (in Bitcoin terms) a “double-spend attack” (source).

Some paragraphs ago, we mentioned a blockchain attack implying the majority of the network members’ acceptance, popularly known as the “51% attack”.

Let’s assume there are two transactions in the blockchain network, and each of them attempts to transfer all the account’s currency to another account, i.e. they will both attempt to empty the account.

Since there can be only one accepted, confirmed transaction (in contrast to two or more possible unconfirmed transactions), the transaction that gets confirmed first will end up bundled in a block. It is not under our control or, for that matter, not even a subject of our concern which block will be the first one.

What matters is that the second block will be rejected and the contention between the blocks/transactions will be resolved automatically, and the likelihood of the double-spend attack problem will decrease with each additional confirmation (source).

Blocks are sequentially added to a blockchain, ordered by the time of their arrival. Adding a block to the blockchain is mostly done in regular intervals, which last about 17 seconds for the Ethereum network.

Nonetheless, the blockchain tip can sometimes be reverted during the order selection mechanism. In that case, a confirmed block will get discarded and become a stale block, and the stale block’s successor blocks just get returned to the memory pool.

? Note: discarded or stale blocks are popularly and wrongly called orphan blocks. (source)

For block reversal to happen, two conditions should occur.

(1) First, multiple blocks should get created from the same parent block P simultaneously (by different miners) and get confirmed by the network, forming a fork with multiple subchains/branches at the tip (block) P of the blockchain.

As there are multiple successor block candidates (e.g. we will assume three blocks, A, B, and C), each block has an equal chance of becoming a permanent part of the blockchain.

Because blocks propagate through the blockchain network differently, miners will receive one of the blocks (A, B, or C) before the other blocks and start mining a new block on the block they received first.

(2) Second, one of the miners will mine and broadcast a new block, e.g.  C1 to the network before the other miners mine blocks A1 or B1 (these don’t exist as yet).

Since the fastest miner first received block C and then produced C1, it will extend the branch P-C, effectively making the branch P-C-C1 the longest one. Once the network detects there is a chain longer than the chains P-A and P-B, it will disqualify the candidate blocks A and B as stale blocks, thus resolving the contention.

All the miners who chose a different blockchain from the fork, e.g. P-A or P-B, and started building their blockchains on them, will experience a block reversal, as their chains will also get updated by the network with the blockchain P-C-C1 as the longest one.

The blockchain tip reversal gets less likely to happen as more blocks are confirmed and added to the blockchain. A common number of confirmations after we can be virtually certain that our block became a permanent part of a blockchain is six confirmations (source).

Conclusion


In this article, we first shortly made a short detour (sorry about that) to a missing part about Solidity events, and then boldly stepped into the direction of blockchain basics, transactions, and blocks.

First, we made friends with an event listener example based on web3.js library.

Second, we glanced at the blockchain basics. You already know the works: some basic terms, dry notes, etc. It’s just a scratch, really.

Third, we learned about how blockchain treats transactions and how it makes them feel secure,  shared and cared for. That’s why we mentioned some properties that make blockchain look like a database.

Fourth, we went into some light details on what a block is, what is its role in the blockchain ecosystem and what are some of the risks present in a blockchain network.


Learn Solidity Course


Solidity is the programming language of the future.

It gives you the rare and sought-after superpower to program against the “Internet Computer”, i.e., against decentralized Blockchains such as Ethereum, Binance Smart Chain, Ethereum Classic, Tron, and Avalanche – to mention just a few Blockchain infrastructures that support Solidity.

In particular, Solidity allows you to create smart contracts, i.e., pieces of code that automatically execute on specific conditions in a completely decentralized environment. For example, smart contracts empower you to create your own decentralized autonomous organizations (DAOs) that run on Blockchains without being subject to centralized control.

NFTs, DeFi, DAOs, and Blockchain-based games are all based on smart contracts.

This course is a simple, low-friction introduction to creating your first smart contract using the Remix IDE on the Ethereum testnet – without fluff, significant upfront costs to purchase ETH, or unnecessary complexity.




https://www.sickgaming.net/blog/2022/08/...-solidity/

Print this item

  (Indie Deal) Match3 Heat Bundle, Destiny 2, 2k, PD Sales
Posted by: xSicKxBot - 08-07-2022, 07:55 AM - Forum: Deals or Specials - No Replies

Match3 Heat Bundle, Destiny 2, 2k, PD Sales

Match3 Heat Bundle | 9 Steam Games | 95% OFF
[www.indiegala.com]
Tackle the summer heat with an even hotter Match3 treat! A selection of casual match3 puzzle games with distinctive elements are waiting to be solved: Gaslamp Cases 2, 100 Days without delays, Funny Pets, Halloween Trouble 2, Catherine Ragnor and the Legend of the Flying Dutchman, Rorys Restaurant Deluxe, Suddenly Meow, Save the Planet, The lost Labyrinth

https://www.youtube.com/watch?v=uHnIP7OCtH4
[www.indiegala.com]
[www.indiegala.com]
https://www.youtube.com/watch?v=yzDtg7LXTWA
Stay Inside, Stay Safe and Enjoy Good Games.
Check out IndieGala on Twitter, YouTube & Facebook[www.facebook.com]


https://steamcommunity.com/groups/indieg...9658620548

Print this item

  PC - Capcom Arcade 2nd Stadium
Posted by: xSicKxBot - 08-07-2022, 07:55 AM - Forum: New Game Releases - No Replies

Capcom Arcade 2nd Stadium



Included Games: 1943 Kai
Black Tiger
Block Block
Capcom Sports Club
Darkstalkers: The Night Warriors
Eco Fighters
Gan Sumoku (GunSmoke)
Hissatsu Buraiken (Avengers)
Hyper Dyne Side Arms
Hyper Street Fighter II: The Anniversary Edition
Knights of the Round
Last Duel
Magic Sword
Mega Man: The Power Battle
Mega Man 2: The Power Fighters
Night Warriors: Darkstalkers’ Revenge
Pnickies
Rally 2011 LED Storm
Saturday Night Slam Masters
Savage Bees (Exed Exes)
SonSon
Street Fighter
Street Fighter Alpha: Warriors’ Dreams
Street Fighter Alpha 2
Street Fighter Alpha 3
Super Gem Fighter Mini Mix
Super Puzzle Fighter II Turbo
The King of Dragons
The Speed Rumbler (Rush & Crash)
Three Wonders
Tiger Road
Vampire Savior: The Lord of Vampire

Publisher: Capcom

Release Date: Jul 22, 2022




https://www.metacritic.com/game/pc/capco...nd-stadium

Print this item

  News - Jetpack Joyride 2 Is Not An Endless Runner
Posted by: xSicKxBot - 08-07-2022, 07:55 AM - Forum: Lounge - No Replies

Jetpack Joyride 2 Is Not An Endless Runner

The original Jetpack Joyride released in 2011 and was a huge mobile hit for developer Halfbrick, who was already enjoying a great deal of success with 2010's Fruit Ninja. The game was ported to many platforms, including PlayStation consoles, and was still receiving updates as recently as a month ago. Even for hits, sequels are not inevitable in the world of mobile games, as most of them are treated as ongoing platforms, but more than a year ago, Halfbrick surprise announced Jetpack Joyride 2… and then it disappeared.

Despite having an announcement trailer and official channels sharing details about the game, Jetpack Joyride 2 went dark shortly after announcement. It turns out the reason was Halfbrick was working out details with Apple to make it an Apple Arcade game. “We started creating this game a long time ago. I think it was in 2020. And we soft-launched the game in three or four countries just for initial testing purposes, but when we started the conversations with Apple Arcade we felt the better platform to develop this game was the Apple Arcade platform," product manager and lead game designer Francisco Gonzalez told us shortly after Apple announced the game was coming to its subscription platform. "That way we could really make the game that we wanted to create. We focused on making the game fun and forgot for a while about the business model and IAPs [in-app purchases].”

You still move left to right while avoiding obstacles in Jetpack Joyride 2, but there are plenty of changes compared to the first game. Protagonist Barry Steakfries now automatically shoots while he flies and new power-ups and vehicles (as well as old favorites) mix up the action, but there is one major mix-up that changes the progress of the whole game. "It’s not an endless runner anymore. That’s a big change,” lead artist Toni Martin says.

Continue Reading at GameSpot

https://www.gamespot.com/articles/jetpac...01-10abi2f

Print this item

  [Tut] How to Convert Multiple Text Files to a Single CSV in Python?
Posted by: xSicKxBot - 08-05-2022, 06:41 PM - Forum: Python - No Replies

How to Convert Multiple Text Files to a Single CSV in Python?

5/5 – (1 vote)

You can merge multiple text files to a single CSV file in Python by using the glob.glob('./*.txt') expression to filter out all path names of text files in a given folder. Then iterate over all those path names and use the open() function to read the file contents and write append them to the CSV.

Example: merge those files

Here’s the simple example:

import glob with open('my_file.csv', 'a') as csv_file: for path in glob.glob('./*.txt'): with open(path) as txt_file: txt = txt_file.read() + '\n' csv_file.write(txt) 

The resulting output CSV file shows that all text files have been merged:


You can replace the separator (e.g., from single empty space to comma) by using the txt.replace(' ', ',') function before writing it in the CSV:

import glob with open('my_file.csv', 'a') as csv_file: for path in glob.glob('./*.txt'): with open(path) as txt_file: txt = txt_file.read() + '\n' txt = txt.replace(' ', ',') csv_file.write(txt) 

The resulting CSV is neatly separated with comma characters:


In case you need some more advanced ways to convert the text files to the CSV, you may want to check out the Pandas read_csv() function to read the CSV into a DataFrame.

As soon as you have it as a DataFrame, you can do advanced processing such as merging, column selection, slicing, etc.

? Related Tutorial: How to Read a CSV to a DataFrame?



https://www.sickgaming.net/blog/2022/08/...in-python/

Print this item

  (Indie Deal) Vocalo-Beats 2 & Summer Breeze Bundles, W40k Deals
Posted by: xSicKxBot - 08-05-2022, 06:41 PM - Forum: Deals or Specials - No Replies

Vocalo-Beats 2 & Summer Breeze Bundles, W40k Deals

Summer Breeze Bundle | 6 Steam Games | 93% OFF
[www.indiegala.com]
Summer is the season of relaxation & it brings a breath of fresh air with newest selection of Anime Visual Novels including: Seance, Omni Link, Crypterion, Summer With You, Winter With You & Sky in your eyes. Read to your heart's content, feel like you've never felt before.

Vocalo-Beats 2 Bundle | 12 Music Albums | 89% OFF
[www.indiegala.com]
?Enjoy listening to a collection of tracks by Miku & her vocaloid friends, in different genres and languages, brought to you by Vocallective Records and featuring prominent artists like Softscape, Starbox, Steampianinst, Hidaritsuu, The Rainfields, Scythe of Luna & furez.

https://www.youtube.com/watch?v=JJhse_lgDOM
[www.indiegala.com]
https://www.youtube.com/watch?v=bLUsjzbtBrQ
Stay Inside, Stay Safe and Enjoy Good Games.
Check out IndieGala on Twitter, YouTube & Facebook[www.facebook.com]


https://steamcommunity.com/groups/indieg...5630760722

Print this item

  (Free Game Key) Despotism 3k - Free Steam Game
Posted by: xSicKxBot - 08-05-2022, 06:41 PM - Forum: Deals or Specials - No Replies

Despotism 3k - Free Steam Game

Despotism 3k
https://store.steampowered.com/sub/747342/

Store Page

The Game is free to claim till: Thursday, 11 August 2022 17:00 UTC

- Mobile: j‌avascript:AddFreeLicense(747342)
- ArchiSteamFarm (ASF): !addlicense asf s/747342

We are welcoming everyone to join our discord[discord.gg]. We are more active there on finding giveaways, small or large, and there are daily raffles you can participate.

?GrabFreeGames.com ?Twitter ?Steam Curator ?Facebook[fb.me]?Discord[discord.gg]
❤️Support us: ✔️HumbleBundle Partner[www.humblebundle.com] Epic Tag: GrabFreeGames


https://steamcommunity.com/groups/GrabFr...3391780999

Print this item

  PC - Hell Pie
Posted by: xSicKxBot - 08-05-2022, 06:41 PM - Forum: New Game Releases - No Replies

Hell Pie



Hell Pie is an obscene 3D platformer that takes bad taste to the next level. Hell Pie sees you grab the horns of Nate, the ‘Demon of Bad Taste’. He is given the honorable task of gathering the disgusting ingredients for Satan’s infamous birthday pie.

Publisher: Headup Games

Release Date: Jul 21, 2022




https://www.metacritic.com/game/pc/hell-pie

Print this item

  News - Overwatch 2 Won't Receive A Third Beta Before Launch
Posted by: xSicKxBot - 08-05-2022, 06:41 PM - Forum: Lounge - No Replies

Overwatch 2 Won't Receive A Third Beta Before Launch

Overwatch 2 will not receive a third beta prior to the game's launch, Blizzard has confirmed.

The news comes via tweets from Overwatch commercial leader Jon Spector. Instead of running another beta, the team will be using feedback received from the game's alpha and two public beta tests to focus on "launching the best game possible on Oct. 4," Spector writes.

Players could sign up for a chance to play in Overwatch 2's two beta periods (or preorder the game's Watchpoint Pack for instant beta access), but it was only for the last few days of the game's most recent beta period when all players who signed up were granted access.

Continue Reading at GameSpot

https://www.gamespot.com/articles/overwa...01-10abi2f

Print this item

  [Tut] How to Convert Avro to CSV in Python?
Posted by: xSicKxBot - 08-04-2022, 06:03 PM - Forum: Python - No Replies

How to Convert Avro to CSV in Python?

4/5 – (1 vote)

? Question: How to convert an .avro file to a .csv file in Python?

Solution:

To convert an Avro file my_file.avro to a CSV file my_file.csv, create a CSV writer using the csv module and iterate over all rows using the iterator returned by fastavro.reader(). Then write each row to a file using the writerow() function.

Here’s an example:

from fastavro import reader
import csv with open('my_file.avro', 'rb') as file_object: csv_file = csv.writer(open("my_file.csv", "w+")) head = True for x in reader(file_object): if head: # write header header = emp.keys() csv_file.writerow(header) head = False # write normal row csv_file.writerow(emp.values())

Related: This code is a modified and improved version of this source.

? Avro is a data serialization framework for RPCs (remote procedure calls) that uses JSON and binary format to serialize data.

? CSV stands for comma-separated values, so you have a row-based file format where values are separated by commas, and the file is named using the suffix .csv.



https://www.sickgaming.net/blog/2022/08/...in-python/

Print this item

 
Latest Threads
[°NeW°]⩽Ireland⟫°TℰℳU Cou...
Last Post: abhi89
24 minutes ago
[°NeW°]⩽Chile⟫°TℰℳU Coupo...
Last Post: abhi89
28 minutes ago
[°NeW°]⩽Pakistan⟫°TℰℳU Co...
Last Post: abhi89
31 minutes ago
[°NeW°]⩽Mexico⟫°TℰℳU Coup...
Last Post: abhi89
1 hour ago
Kod Temu Nowy Użytkownik ...
Last Post: demble8888
2 hours ago
Kod Promocyjny Temu [ald9...
Last Post: demble8888
2 hours ago
Temu Kupon Zniżkowy [ald9...
Last Post: demble8888
2 hours ago
Darmowy Kod Do Temu [ald9...
Last Post: demble8888
2 hours ago
Kod Rabatowy Temu [ald911...
Last Post: demble8888
2 hours ago
Temu Kupon Rabatowy [ald9...
Last Post: demble8888
2 hours ago

Forum software by © MyBB Theme © iAndrew 2016