Myah  Conn

Myah Conn


Tornado and SQLAlchemy

Asynchronous Programming Intro
Asynchronous programming can be a bit tricky with all its jargon but let’s break it down in simple terms. Think of it like performing a lot of tasks around the house. You can either do them one at a time and wait for for each to finish before starting the next (synchronous) or you can start one, then start the other while the first one is going. Imagine you start the laundry. It wouldn’t make sense for you to wait for it to finish before starting to cook dinner. It is much more efficient to get the laundry started in the washing machine, then cook dinner while the laundry is working.

#developer #python #tornado #programming #software-development

What is GEEK

Buddha Community

Tornado and SQLAlchemy
Ruth  Nabimanya

Ruth Nabimanya


Introspecting Databases with Airflow and SQLAlchemy

A Tutorial For Iterating Over Automatically Introspected Database Objects

For a recent data migration project that utilized Airflow, I needed to connect to a database and automatically introspect its schemas and tables. One database that needed to be introspected had hundreds of schemas. And each schema had dozens of varying tables, most of which had different columns and column constraints.

In other words, we had database metadata made of of tens- or hundreds of thousands of objects that no one would manually type out into config files or hard-coded Python lists. Knowing that Airflow uses the SQLAlchemy module to communicate with databases as dialect- and engine-agnostically as possible, I had a hunch I could leverage Airflow’s SQLAlchemy connection to the database to generate the lists of schemas, tables, columns, or whatever database objects I needed to access.

My hunch was right! SQLAlchemy and Airflow’s DB API hook make it easy to get a hold of the SQLAlchemy engine for any connected database.

#sqlalchemy #database #introspect #airflow #introspecting databases with airflow and sqlalchemy #sqlalchemy

Myah  Conn

Myah Conn


Tornado and SQLAlchemy

Asynchronous Programming Intro
Asynchronous programming can be a bit tricky with all its jargon but let’s break it down in simple terms. Think of it like performing a lot of tasks around the house. You can either do them one at a time and wait for for each to finish before starting the next (synchronous) or you can start one, then start the other while the first one is going. Imagine you start the laundry. It wouldn’t make sense for you to wait for it to finish before starting to cook dinner. It is much more efficient to get the laundry started in the washing machine, then cook dinner while the laundry is working.

#developer #python #tornado #programming #software-development

Bek Brace

Bek Brace


Tornado : ASYNC Framework for Python

Tornado is a Python open source framework, but also an asynchronous networking library, and it was originally developed for a company called FriendFeed, which was acquired by Facebook recently in 2009. To understand Tornado we need to know what is it good for.

Make sure to check out my last video on tornado Framework

#python  #youtube  #async  #tornado

Tornado is ideal for building apps asking for high performance and several thousand concurrent users; it can handle 10K connections at once, in addition to that it's non-blocking network IO. Asynchronous programming was introduced to python since python 3.5 when the asyncio library was introduced.

Before anything, you need to know that Asynchronous programming, more specifically async syntax makes you code faster to execute.

Async is one way of doing concurrent programming, which means doing many things at once or achieving multiple tasks at once.

How does Python achieve multiple tasks at once ?

1 OS makes multi-sharing and multi-tasking happen: One way is to run multiple terminal instances and run your server, and all of them will work concurrently in the same time; and your operating system takes care of sharing your CPU resources among those terminal instances.

2 Another way of achieving multiple tasks at once is by using threads. A thread is a line of execution for several instructions which means that they all share access to common resources, and here the operating system intervenes to share your CPU with these threads

3 The last way is asynchronous programming which what Tornado does, even though the operating system will not have any role here, yet we'll be able to achieve multiple things at once with asynchronous programming

Drop your comment or contact me on:
GitHub page:​

Thank you for reading and watching 
Until next time - Peace out, 

What is Tornado Cash (TORN) | What is Tornado Cash token | What is TORN token

What Is Tornado Cash (TORN)?

Tornado Cash is a decentralized, non-custodial privacy solution built on Ethereum. It improves transaction privacy by breaking the on-chain link between recipient and destination addresses. Tornado Cash uses a smart contract that accepts ETH and ERC-20 deposits. These deposits can be withdrawn by any on-chain address. Whenever an asset is withdrawn by the new address, there is no way to link the withdrawal to the deposit, ensuring asset privacy.

Tornado Cash uses zero knowledge proofs (zk-SNARKs) to achieve privacy. When a user decides to make a withdrawal, the user must provide proof that he or she possesses a secret corresponding to one of the smart contract’s list of deposits. zk-SNARK technology allows this proof to be verified without the user needing to reveal which exact deposit corresponds to their secret. The smart contract then checks the proof, and transfers deposited funds to the address specified by the withdrawal transaction. Any external observer is unable to determine which deposit this withdrawal is linked to. TORN is Tornado Cash’s native governance token. It’s a fixed-supply ERC-20 token that is used for voting on protocol upgrades and fixes.

Introducing Private Transactions On Ethereum NOW!

We are thrilled to share with you that is also possible on Ethereum. — our brand new tool equipped with non-custodial technology based on strong cryptography — enables you to send Ethereum cryptocurrency with 100% anonymity!

Image for post

How does achieve privacy in Ethereum?

Tornado improves transaction privacy by breaking the on-chain link between the recipient and destination addresses. It uses a smart contract that accepts ETH deposits that can be withdrawn by a different address. Whenever a new address withdraws ETH, there is no way to link the withdrawal to the deposit, which** makes the procedure completely private.**

In other words, acts as a proxy to ensure that the transaction is 100% anonymous with zkSnarks proofs.

Better yet, it is 100% non-custodial, meaning you retain full control over your deposited funds.


To make a deposit, a user generates a secret and sends its hash (called a commitment) along with a desired deposit amount to the Tornado smart contract. The contract accepts the deposit and adds the commitment to its list of deposits.

Later, the user decides to make a withdrawal. In order to do that, the user should provide proof that he or she possesses a secret to an unspent commitment from the smart contract’s list of deposits. The zkSnark technology allows doing that without revealing which exact deposit matches the secret. The smart contract will check the proof and transfer deposited funds to the address specified for the withdrawal. An external observer will be unable to determine which deposit this withdrawal comes from.

That’s how it works. Now let us explain why the Anonymity Set so important.

Anonymity Set

Image for post

Anonymity set is basically a measurement of anonymity. It shows how many deposits still await for withdrawal. In other words, how many deposits your mixed ETH value can originate from.

The chicken-or-egg problem

You may notice there are two options for withdrawal:

  • Using a wallet (Metamask, Trustwallet, etc)
  • Or via Relayer

Image for post

The first method requires you to have a completely new Ethereum address with some ETH on it. This begs the question:

How to get some ETH on the address without losing anonymity?

Because usually you buy it from other people (using exchanges or not), and we want to avoid getting deanonymized, right?

That’s why you can use the Relayer feature to complete the process. All you need is to generate a new Ethereum address — the zkSnark proof and Relayer will do the rest. It will also charge you some ETH, just to cover the Ethereum network fee.

Tips to stay anonymous

Image for post

  • Using Relayer or not, you still need to keep up common Internet anonymity like using vpn, proxies, Tor in order to hide the IP address you are acting from. Since you are using browser, the Incognito Tab feature is also useful. Make sure you use different ip addresses for your old and new accounts.
  • Make sure you clear your cookies for dapps before using a new address, because if a dapp sees both old and new address with the same cookies, it will know that addresses are from the same owner.
  • Wait until there are a few deposits after yours. If your deposit and withdrawal are right next to each other, the observer can guess that they might belong to the same person. We recommend waiting until there are at least 5 deposits.
  • Wait until some time has passed after your deposit. Even if there are multiple deposits after yours they all might be made by the same person that is trying to spam deposits and make user falsely believe that there is a large anonymity set. We recommend waiting at least 24h to make sure that there were deposits made by multiple people during that time.

Tornado.Cash Governance Proposal

Tornado.Cash has become the largest privacy solution on Ethereum today. Tornado.Cash has been fully autonomous and decentralized, but it’s static — it has no way to evolve. This is a proposal to change that. If this proposal is adopted, then the governance of Tornado.Cash will be entrusted to its users, and Tornado.Cash will be allowed to evolve under the stewardship of its community. This way, the users of Ethereum will control their own privacy protocol.

Here is how a proposal for how the Tornado.Cash governance system could work:

TORN Token

TORN is an ERC20-compatible token with a fixed supply that governs Tornado.Cash. TORN holders can make proposals and vote to change the protocol via governance.

TORN is not a fundraising device or investment opportunity. It will remain non-transferable until the community decides that unlocking transfers via a governance vote, not earlier than 45 days following deployment, would comply with all applicable laws.

Here’s how the initial distribution of TORN would break down:

  • 5% (500,000 TORN): Airdrop to early users of Tornado.Cash ETH pools
  • 10% (1,000,000 TORN): Anonymity mining for Tornado.Cash ETH pools, distributed linearly over 1 year
  • 55% (5,500,000 TORN): DAO treasury, will be unlocked linearly over 5 years with 3 month cliff
  • 30% (3,000,000 TORN): Founding developers and early supporters, will be unlocked linearly over 3 years with 1 year cliff

Image for post

Image for post


Users who have believed in Tornado.Cash from early on should have a say in governing the protocol. For this reason, early adopters of the protocol will receive an airdrop of TORN.

TORN will be airdropped to  all addresses that made deposits into Tornado.Cash ETH pools before block 11400000. TORN will be airdropped in the form of a non-transferable TORN voucher (vTORN) that can be redeemed 1:1 to TORN within 1 year. TORN that aren’t redeemed will be swept into the governance contract after 1 year and become part of the DAO Treasury. Redeemed TORN will be available immediately.

The airdropped amount depends on users’ deposit size and age — larger deposits and older deposits will receive more TORN. Multipliers for deposit size are logarithmic:

Image for post

So a 100 ETH deposit will get twice as many tokens as a 1 ETH deposit. The multiplier allows large and small users of Tornado.Cash to both have a say in governance.

The exact curve for the time multiplier looks like this:

Image for post

The exact airdrop formula is the following:

Image for post

Anonymity Mining

The fundamental principle behind Tornado.Cash is that privacy is a human right, and the more everyone adopts privacy measures, the more secure it is for all of us (much like how HTTPS becoming the default for web browsers made all of us more secure). To this end, users who add to the  anonymity set of Tornado.Cash in the future should also receive TORN.

A natural option for distributing tokens is traditional DeFi liquidity mining. But any naive liquidity mining scheme would force users to reveal how much time their deposits spent in a Tornado.Cash pool. This conflicts with Tornado.Cash’s core value: preserving privacy.

That is the driving impetus behind the invention of Anonymity Mining. In Anonymity Mining, users will be able to receive TORN through a two-stage shielded liquidity mining system, which fully preserves user privacy.

After a user deposits into Tornado.Cash, a user will accrue private Anonymity Points (AP) into a shielded account — which shields your wallet address, your balance, and doesn’t leak any information about your deposits. Once the user accumulates enough AP on the user’s shielded account, the user can decide to convert the AP at any time into public TORN tokens via our custom-built Tornado.Cash AMM.

This system is a little complex. But it ensures that user privacy is always protected in the process of claiming TORN tokens.

Note: only notes that are deposited after the deployment ceremony are eligible for Anonymity Mining — earlier notes are distributed TORN via the airdrop.

Here’s how it works, step-by-step:

Claiming your AP

First, users must claim Anonymity Points (AP) for already spent Tornado.Cash notes (AP cannot be claimed until the user spends the notes). After the notes are spent, there is delay before it becomes claimable for AP.

To claim AP, the user’s browser generates a special zero knowledge proof that calculates the AP owed (based on how many blocks the user’s note was in an ETH Tornado.Cash pool) and then adds that to the user shielded balance. Below is a table of AP per block for different Tornado.Cash note sizes:

Image for post

The only information other users will see on-chain is that someone claimed some AP batch of unknown size for some note for a certain Tornado.Cash pool. To further enhance privacy, the user can claim AP via a relayer (who will accept AP as compensation to cover their relaying costs).

Shielded Accounts

Because AP is completely private, in order to store your shielded AP, the user needs to generate a secret key that stores the user’s AP balance. This key is randomly generated, and then encrypted with your Ethereum public key (using Metamask’s eth_getEncryptionPublicKey) and stored on-chain. That way, if you lose it, it can be seamlessly recovered using the user’s Ethereum keys.

This secret key is used to encrypt and submit claim and withdrawal data without revealing the user’s identity.

Converting AP into TORN

To then convert your mined AP into publicly visible TORN, you can use the custom-built Tornado.Cash Automated Market Maker (AMM).

TORN is dripped continuously and evenly into this AMM (1M TORN tokens over 1 year). All the AP that is claimed at any point can bid on the TORN that has up to that point accumulated in the AMM.

This does mean that the timing to convert AP into TORN is somewhat strategic — if too many people withdraw at the same time, the rate for AP/TORN conversion ratio contracts, and if few people are withdrawing, the rate improves. However, for the first 45 days, TORN will not be transferable at all.

Here’s a rough analogy: you can imagine TORN tokens are being released by a drip into a bucket (the AMM) over one year. AP tokens let you bid on whatever amount of TORN is in the bucket so far. If there’s a lot of AP bidding at the same time, the bucket will drain really quickly and the rate per AP will be low. But if the AP holders are patient, it should level out over time and everyone should get a roughly equal number of TORN for AP.

That’s the entire process for claiming TORN. Unfortunately there’s some irreducible complexity. But, it’s impossible to know how much AP will get generated over the course of the Anonymity Mining program (since it’s private!), so this is the only way to ensure both that TORN has a fixed supply and that all AP remains shielded until it is converted into public TORN.

The exact AMM formula looks like this:

Image for post


  • T — TORN mining program allocation
  • Tvirt — Virtual TORN balance
  • Twithdrawn — Amount of TORN that users already withdrawn
  • TORN — Amount of TORN that user will receive
  • AP — Anonymity points to exchange
  • W — AMM exchange weight constant

The Tornado.Cash Proxy

You might wonder how any of this is possible at all — isn’t Tornado.Cash immutable?

It is! The Tornado.Cash smart contracts cannot be changed or updated. They are decentralized and immutable.

But for Tornado.Cash to enable mining, it needs more metadata than is currently available: it needs to know the block number for each Tornado.Cash deposit and withdrawal. To that end, a proxy stands in front of the old Tornado.Cash that adds the current block number to each transaction. Thus, for Tornado.Cash users using the proxy, their notes can be used for Anonymity Mining, since the Merkle tree will contain data about when their deposits took place. (The version of Tornado.Cash without a proxy remains fully functional.)

Note: in order to aggregate deposits and withdrawal to the Merkle trees, someone needs to run a script called the root-updater. So long as someone out there does this, the system works smoothly and trustlessly. Who handles this role and how it is handled is a decision for the community via governance. For more information on how this works, please check out this repo.


In order to participate in Tornado.Cash governance, users first need to lock tokens in the governance contract. If a user votes or creates a proposal, the tokens cannot be unlocked before the proposal execution period ends (8.25 days from proposal creation). The locked tokens can also be delegated to another address.

To create a proposal, a user needs to have at least 1,000 TORN. All proposals must be smart contracts with verified code that are executed from the governance contract (using delegatecall). This way, it’s easy to audit and test any governance changes.

The voting period for a proposal is 3 days. A proposal will succeed if it receives a simple majority of votes and there are at least 25,000 TORN total votes (if turnout is too low, the proposal automatically fails).

After a proposal succeeds, it is subject for a timelock of 2 days. After the timelock, any user is able to execute the proposal (which initiates the changes). If proposal is not executed for 3 days after that, it is considered expired and can no longer be executed.

All of these initial parameters are relatively small, since there won’t be many TORN tokens in circulation early on. But as the circulating supply increases, governance may adjust these thresholds.

Image for post

Governance proposals have the power to change any of Tornado.Cash’s internal parameters, including completely upgrading its implementation (via the proxy, of course).

This brings us to…

Governance Initiation

At the end of the day, this is just a proposal. We don’t control Tornado.Cash — its users do, so if the community adopts this proposal, then it will become the way forward for privacy on Ethereum.

We’ve written the code, and have published it to GitHub and IPFS.

Image for post

The GitHub source code can be found at:  torn-token,  tornado-anonymity-mining,  tornado-governance, t ornado-initiation-ui. The proposed code is on IPFS with hash QmR3YK3z1okFmfWNhLjGSsdJgUJJRn2NEA7NpeQEAzAi1E, it can be accessed using a convenient shortcut Any user can submit deploy transaction for any contract using their Metamask. It uses the CREATE2 and  EIP-2470 deployer so all contract addresses are deterministic. The expected addresses of our proposed contracts are:

  • deployer.contract.tornadocash.eth:  0xCEe71753C9820f063b38FDbE4cFDAf1d3D928A80
  • torn.contract.tornadocash.eth:  0x77777FeDdddFfC19Ff86DB637967013e6C6A116C
  • governance-impl.contract.tornadocash.eth:  0xffbaC21a641Dcfe4552920138D90F3638B3c9fba
  • governance.contract.tornadocash.eth:  0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce
  • reward-verifier.contract.tornadocash.eth:  0x88fd245fEdeC4A936e700f9173454D1931B4C307
  • withdraw-verifier.contract.tornadocash.eth:  0x09193888b3f38C82dEdfda55259A82C0E7De875E
  • tree-update-verifier.contract.tornadocash.eth:  0x653477c392c16b0765603074f157314Cc4f40c32
  • reward-swap.contract.tornadocash.eth:  0x5cab7692D4E94096462119ab7bF57319726Eed2A
  • poseidon2.contract.tornadocash.eth:  0x94C92F096437ab9958fC0A37F09348f30389Ae79
  • poseidon3.contract.tornadocash.eth:  0xD82ed8786D7c69DC7e052F7A542AB047971E73d2
  • tornado-proxy.contract.tornadocash.eth:  0x905b63Fff465B9fFBF41DeA908CEb12478ec7601
  • tornado-trees.contract.tornadocash.eth:  0x43a3bE4Ae954d9869836702AFd10393D3a7Ea417
  • mining-v2.contract.tornadocash.eth:  0x746Aebc06D2aE31B71ac51429A19D54E797878E9
  • voucher.contract.tornadocash.eth:  0x3eFA30704D2b8BBAc821307230376556cF8CC39e
  • team1.vesting.contract.tornadocash.eth:  0x5f48C2A71B2CC96e3F0CCae4E39318Ff0dc375b2
  • team2.vesting.contract.tornadocash.eth:  0x00D5ec4CDF59374B2A47e842B799027356eAC02B
  • team3.vesting.contract.tornadocash.eth:  0x77C08248c93Ab53Ff734AC555C932F8b9089D4C9
  • team4.vesting.contract.tornadocash.eth:  0xc3877028655EbE90b9447DD33De391c955eAd267
  • team5.vesting.contract.tornadocash.eth:  0xb43432eC23e228FB7cB0fA52968949458b509f4F
  • governance.vesting.contract.tornadocash.eth:  0x179f48C78f57A3A78f0608cC9197B8972921d1D2

Looking for more information…

WebsiteExplorerSource CodeSocial ChannelSocial Channel 2Message BoardCoinmarketcap

Would you like to earn TORN right now! ☞ [CLICK HERE]( “CLICK HERE”)

Top exchanges for token-coin trading. Follow instructions and make unlimited money


Thank for visiting and reading this article! I’m highly appreciate your actions! Please share if you liked it!

#blockchain #bitcoin #tornado cash #torn

Introducing Asynchronous SQLAlchemy

With the increasing popularity of asynchronous frameworks, such as FastAPI, communicating asychronously with databases has become a hot topic in Python development. While there were already a lot of database drivers with asynchronous support available, support for asynchio in Object-Relation Mapping (ORM) frameworks was a lot rarer. That is, until the release of version 1.4 of SQLAlchemy back in March of 2021, which added support for Asynchronous I/O to one of the most popular ORM frameworks for Python.

In this talk, Sebastiaan Zeeff will give an overview of the newly added support for asyncio in SQLAlchemy. He will go over how easy it is to set up and use the new AsyncEngine, show you how to avoid getting bitten by some of the pitfalls, and explain how you can use the synchronous functions and methods of SQLAlchemy under asyncio.

While this talk is an introduction to SQLAlchemy's asyncio support, it is aimed at those who already have some experience with ORM and asyncio. Extensive knowledge of SQLAlchemy is not required, although having a bit of experience with the framework won't hurt.

#python #sql #sqlalchemy