News
How to Use Python to Build Secure Blockchain Applications
Did you know that you can now build blockchain applications, also known as decentralized applications (or “dApps” for short) in native Python? Blockchain development has traditionally required learning specialized languages, creating a barrier for many developers… until now. Algorithmic kitan all-in-one development toolkit for Algorand, allows developers to build blockchain applications in pure Python.
This article will walk you through the benefits of building blockchain applications, why Python is an ideal choice for dApp development, how to set up your blockchain development environment, and how to get started building secure blockchain applications in native Python.
Why build blockchain applications?
Blockchain application development goes far beyond creating a decentralized database and peer-to-peer transactions. Unlock a new level of trust, security and efficiency for various applications.
Ensure tamper-proof records: Blockchain creates an immutable and transparent ledger, ensuring data security and eliminating the risk of manipulation.
Automate complex deals: Smart contracts and atomic exchanges eliminate the need for third-party verification, simplifying transactions and reducing costs.
Revolutionizing asset ownership: Digitalization enables fractional ownership and secure trading of real-world assets.
Build innovative solutions: Python development skills can be used to create breakthrough applications in artificial intelligence, identity management, and secure IoT data exchange.
Why use Python to build blockchain applications?
Readability and maintainability: Python’s smooth syntax and robust tools make it easy to write, understand, and modify code, especially when working on complex and powerful blockchain projects.
Integration with other technologies: Python works well with other technologies often used in conjunction with blockchain, such as web development frameworks and machine learning libraries. This allows you to create dApps that go beyond the core functionality of the blockchain.
World-class development experience: Python has a large and active developer community, as well as comprehensive, world-class documentation and robust tools to support your Python and blockchain development journey.
How to set up your development environment to start building blockchain applications
The easiest way to create blockchain applications in Python is to download and install them AlgoKit. This comprehensive toolkit allows you to build, launch, and deploy secure, production-ready decentralized applications on the Algorand blockchain.
With AlgoKit you can set up your development environment and project folder and start building your project with just one command.
Download and install the prerequisites
Make sure you have Python 3.12 or later, pipx, Git, and Docker installed. On macOS, you will also need to install Homebrew.
Install AlgoKit
Open command line/terminal and type “pipx install algokit”. This will install AlgoKit so you can use it in any directory.
Set up a local blockchain network
You can try a private version of the Algorand blockchain on your computer.
Type “algokit localnet start” in the command line/terminal. This will create a local blockchain network running in a container using Docker. You can then check the Docker Desktop app to see it running.
To launch a browser-based blockchain explorer to see what’s happening on this local network, type “algokit localnet explore”.
Create a new project
Now that AlgoKit is installed, you can create a new project for your blockchain application.
First, run “algokit init”. A guided process will begin and you will be asked to answer a few short questions to set up your project.
If this is your first time, start by selecting “smart contracts” to indicate that you are building a smart contract application.
Since you will be writing Python code, select “Python” as the language and choose a name for the folder that will store all of your project files and a name for your application.
Finally, choose the “Production” template to set up a deployment-ready project.
The production model is like a pre-built starter kit for your Algorand project. It will give you a clear picture of how different parts like testing, continuous integration/continuous deployment (CI/CD), and deployment work together in a complete Algorand project. Then, select “Python” again.
Answer Y to the following questions to have AlgoKit install the dependencies and initialize a Git repository for you.
Once the project generation process is complete, open the project directory in your favorite code editor.
How to create secure blockchain applications in Python
Explore the code
The “Production” template will include a simple “hello world” smart contract located in “smart_contracts/hello_world/contract.py”. This contract should look quite familiar to Python developers with a couple of key differences.
The first thing to note is that we inherit “ARC4Contract” for our “HelloWorld” class. ARC4 is Algorand Request for Comment #0004 which defines the binary application interface (ABI) for Algorand methods. By inheriting from “ARC4Contract”, we ensure that the contract conforms to this standard used by many tools in the Algorand ecosystem, including AlgoKit itself.
Above the actual “hello” method definition there is also a “@arc4.abimethod” decorator. This decorator exposes the method as a public method within our contract. Since this is an ARC4 ABI method, any tool that supports the ABI can call this method with ease. AlgoKit also includes a client generator, which can generate a Python or TypeScript client to interact with any ABI methods you’ve defined.
Finally, you’ll notice that the argument and return type of our function is “arc4.String”. ARC4 also defines how we encode and decode data types when interacting with contracts. Since Algorand Virtual Machine (AVM) does not support all the same functionality as a Python “str”, we must use the “arc4.String” type provided by the “algopy” module.
Compile and build
You can use “algokit project run build” to compile the smart contract written in native Python to TEAL, the bytecode language that AVM can understand. Building also generates additional artifacts that can be used to make interactions with the contract easier, as we will see in the tests.
Interact and try
To see how contract interaction and tests are performed, go to “tests/hello_world_test.py”. Here you can see that we are using HelloWorldClient which was automatically generated by AlgoKit during the creation phase. This makes it easier to interact with the contract and can be leveraged in testing, backend, or frontend development.
Write your code
Once you’ve explored this project and run your first “Hello World,” you’re ready to build on Algorand! You can turn the sample contract into your own dApp, such as a marketplace, a tokenized real asset manager, or an on-chain immutable data store.
Write your on-chain smart contract logic in contract.py and associated tests in “smart_contracts/tests”. Run “algokit project run build” again to recompile, deploy and test the contract in seconds.
Now you are ready to rapidly iterate as you build your application while AlgoKit takes care of the boilerplate code and development environment setup.
For more tutorials on how to use Python to build on Algorand with AlgoKitvisit the AlgoDev YouTube channel.
For more information on Algorand Python, refer to documentation.
Did you find this article interesting? This article is contributed by one of our valued partners. Follow us on Twitter AND LinkedIn to read the most exclusive content we publish.
Fuente
News
Terra Can’t Catch a Break as Blockchain Gets $6 Million Exploited
The attack, which exploited a vulnerability disclosed in April, drained around 60 million ASTRO tokens, sending the price plummeting.
The Terra blockchain has been exploited for over $6 million, forcing developers to take a momentary break the chain.
Beosin Cyber Security Company reported that the protocol lost 60 million ASTRO tokens, 3.5 million USDC, 500,000 USDT, and 2.7 BTC or $180,000.
Terra developers paused the chain on Wednesday morning to apply an emergency patch that would address the attack. Moments later, a 67% majority of validators upgraded their nodes and resumed block production.
The ASTRO token has plunged as much as 75%. It is now trading at $0.03, a 25% decline on the day. Traders who took advantage of the drop are now on 195%.
The vulnerability that took down the Cosmos-based blockchain was disclosed in April and involved the deployment of a malicious CosmWasm contract. It opened the door to attacks via what is called an “ibc-hooks callback timeout reentrancy vulnerability,” which is used to invoke contracts and enable cross-chain swaps.
Terra 2.0 also suffered a massive drop in total value locked (TVL) in April, shortly after the vulnerability was discovered. It plunged 80% to $6 million from $30 million in TVL and has since lost nearly half of that value, currently sitting at $3.9 million.
The current Earth chain emerged from the rubble as a hard fork after the original blockchain, now called Terra Classic, collapsed in 2022. Terra collapsed after its algorithmic stablecoin (UST) lost its peg, causing a run on deposits. More than $50 billion of UST’s market cap was wiped out in a matter of days.
Terraform Labs, the company behind the blockchain, has been slowly unravelling its legal woes since its mid-2022 crash. Founder Do Kwon awaits sentencing in Montenegro after he and his company were found liable for $40 billion in customer funds in early April.
On June 12, Terraform Labs settled with the SEC for $4.4 billion, for which the company will pay about $3.59 billion plus interest and a $420 million penalty. Meanwhile, Kwon will pay $204.3 million, including $110 million in restitution, interest and an $80 million penalty, a court filing showed.
News
Google and Coinbase Veterans Raise $5M to Build Icebreaker, Blockchain’s Answer to LinkedIn
Icebreaker: Think LinkedIn but on a Blockchain—announced Wednesday that it has secured $5 million in seed funding. CoinFund led the round, with participation from Accomplice, Anagram, and Legion Capital, among others.
The company, which is valued at $21 million, aims to become the world’s first open-source network for professional connections. Its co-founders, Dan Stone and Jack Dillé, come from Google AND Monetary base; Stone was a product manager at the cryptocurrency giant and also the co-creator of Google’s largest multi-identity measurement and marketing platform, while Dillé was a design manager for Google Working area.
The pair founded Icebreaker on the shared belief that the imprint of one’s digital identity (and reputation) should not be owned by a single entity, but rather publicly owned and accessible to all. Frustrated that platforms like LinkedIn To limit how we leverage our connections, Dillé told Fortune he hopes to remove paywalls and credits, which “force us to pay just to browse our network.” Using blockchain technology, Icebreaker lets users transfer their existing professional profile and network into a single, verified channel.
“Imagine clicking the login button and then seeing your entire network on LinkedIn, ChirpingFarcaster and email? Imagine how many introductions could be routed more effectively if you could see the full picture of how you’re connected to someone,” Stone told Fortune.
Users can instantly prove their credentials and provide verifiable endorsements for people in their network. The idea is to create an “open graph of reputation and identity,” according to the founders. They hope to challenge LinkedIn’s closed network that “secures data,” freeing users to search for candidates and opportunities wherever they are online. By building on-chain, the founders note, they will create a public ledger of shared context and trust.
Verified channels are now launched for
Chirping
Online Guide
Wallet
Discord
Telephone
TeleporterYou can find them in Account -> Linked Accounts Italian: https://t.co/mRDyuWW8O2
— Icebreaker (@icebreaker_xyz) April 3, 2024
“Digital networking is increasingly saturated with noise and AI-driven fake personas,” the founders said in a statement. For example: Dillé’s LinkedIn headline reads “CEO of Google,” a small piece of digital performance art to draw attention to unverifiable information on Web2 social networks that can leave both candidates and recruiters vulnerable to false claims.
“Icebreaker was created to enable professionals to seamlessly tap into their existing profiles and networks to surface exceptional people and opportunities, using recent advances in cryptographically verifiable identity,” the company said, adding that the new funding will go towards expanding its team and developing products.
“One of the next significant use cases for cryptocurrency is the development of fundamental social graphs for applications to leverage… We are proud to support Dan, Jack and their team in their mission to bring true professional identity ownership to everyone online,” said CoinFund CIO Alex Felix in a statement.
Learn more about all things cryptocurrency with short, easy-to-read flashcards. Click here to Fortune’s Crash Course in Cryptocurrency.
Fuente
News
Luxembourg proposes updates to blockchain laws | Insights and resources
On July 24, 2024, the Ministry of Finance proposed Blockchain Bill IVwhich will provide greater flexibility and legal certainty for issuers using Distributed Ledger Technology (DLT). The bill will update three of Luxembourg’s financial laws, the Law of 6 April 2013 on dematerialised securitiesTHE Law of 5 April 1993 on the financial sector and the Law of 23 December 1998 establishing a financial sector supervisory commissionThis bill includes the additional option of a supervisory agent role and the inclusion of equity securities in dematerialized form.
DLT and Luxembourg
DLT is increasingly used in the financial and fund management sector in Luxembourg, offering numerous benefits and transforming various aspects of the industry.
Here are some examples:
- Digital Bonds: Luxembourg has seen multiple digital bond issuances via DLT. For example, the European Investment Bank has issued bonds that are registered, transferred and stored via DLT processes. These bonds are governed by Luxembourg law and registered on proprietary DLT platforms.
- Fund Administration: DLT can streamline fund administration processes, offering new opportunities and efficiencies for intermediaries, and can do the following:
- Automate capital calls and distributions using smart contracts,
- Simplify audits and ensure reporting accuracy through transparent and immutable transaction records.
- Warranty Management: Luxembourg-based DLT platforms allow clients to swap ownership of baskets of securities between different collateral pools at precise times.
- Tokenization: DLT is used to tokenize various assets, including real estate and luxury goods, by representing them in a tokenized and fractionalized format on the blockchain. This process can improve the liquidity and accessibility of traditionally illiquid assets.
- Tokenization of investment funds: DLT is being explored for the tokenization of investment funds, which can streamline the supply chain, reduce costs, and enable faster transactions. DLT can automate various elements of the supply chain, reducing the need for reconciliations between entities such as custodians, administrators, and investment managers.
- Issuance, settlement and payment platforms:Market participants are developing trusted networks using DLT technology to serve as a single source of shared truth among participants in financial instrument investment ecosystems.
- Legal framework: Luxembourg has adapted its legal framework to accommodate DLT, recognising the validity and enforceability of DLT-based financial instruments. This includes the following:
- Allow the use of DLT for the issuance of dematerialized securities,
- Recognize DLT for the circulation of securities,
- Enabling financial collateral arrangements on DLT financial instruments.
- Regulatory compliance: DLT can improve transparency in fund share ownership and regulatory compliance, providing fund managers with new opportunities for liquidity management and operational efficiency.
- Financial inclusion: By leveraging DLT, Luxembourg aims to promote greater financial inclusion and participation, potentially creating a more diverse and resilient financial system.
- Governance and ethics:The implementation of DLT can promote higher standards of governance and ethics, contributing to a more sustainable and responsible financial sector.
Luxembourg’s approach to DLT in finance and fund management is characterised by a principle of technology neutrality, recognising that innovative processes and technologies can contribute to improving financial services. This is exemplified by its commitment to creating a compatible legal and regulatory framework.
Short story
Luxembourg has already enacted three major blockchain-related laws, often referred to as Blockchain I, II and III.
Blockchain Law I (2019): This law, passed on March 1, 2019, was one of the first in the EU to recognize blockchain as equivalent to traditional transactions. It allowed the use of DLT for account registration, transfer, and materialization of securities.
Blockchain Law II (2021): Enacted on 22 January 2021, this law strengthened the Luxembourg legal framework on dematerialised securities. It recognised the possibility of using secure electronic registration mechanisms to issue such securities and expanded access for all credit institutions and investment firms.
Blockchain Act III (2023): Also known as Bill 8055, this is the most recent law in the blockchain field and was passed on March 14, 2023. This law has integrated the Luxembourg DLT framework in the following way:
- Update of the Act of 5 August 2005 on provisions relating to financial collateral to enable the use of electronic DLT as collateral on financial instruments registered in securities accounts,
- Implementation of EU Regulation 2022/858 on a pilot scheme for DLT-based market infrastructures (DLT Pilot Regulation),
- Redefining the notion of financial instruments in Law of 5 April 1993 on the financial sector and the Law of 30 May 2018 on financial instruments markets to align with the corresponding European regulations, including MiFID.
The Blockchain III Act strengthened the collateral rules for digital assets and aimed to increase legal certainty by allowing securities accounts on DLT to be pledged, while maintaining the efficient system of the 2005 Act on Financial Collateral Arrangements.
With the Blockchain IV bill, Luxembourg will build on the foundations laid by previous Blockchain laws and aims to consolidate Luxembourg’s position as a leading hub for financial innovation in Europe.
Blockchain Bill IV
The key provisions of the Blockchain IV bill include the following:
- Expanded scope: The bill expands the Luxembourg DLT legal framework to include equity securities in addition to debt securities. This expansion will allow the fund industry and transfer agents to use DLT to manage registers of shares and units, as well as to process fund shares.
- New role of the control agent: The bill introduces the role of a control agent as an alternative to the central account custodian for the issuance of dematerialised securities via DLT. This control agent can be an EU investment firm or a credit institution chosen by the issuer. This new role does not replace the current central account custodian, but, like all other roles, it must be notified to the Commission de Surveillance du Secteur Financier (CSSF), which is designated as the competent supervisory authority. The notification must be submitted two months after the control agent starts its activities.
- Responsibilities of the control agent: The control agent will manage the securities issuance account, verify the consistency between the securities issued and those registered on the DLT network, and supervise the chain of custody of the securities at the account holder and investor level.
- Simplified payment processesThe bill allows issuers to meet payment obligations under securities (such as interest, dividends or repayments) as soon as they have paid the relevant amounts to the paying agent, settlement agent or central account custodian.
- Simplified issuance and reconciliationThe bill simplifies the process of issuing, holding and reconciling dematerialized securities through DLT, eliminating the need for a central custodian to have a second level of custody and allowing securities to be credited directly to the accounts of investors or their delegates.
- Smart Contract Integration:The new processes can be executed using smart contracts with the assistance of the control agent, potentially increasing efficiency and reducing intermediation.
These changes are expected to bring several benefits to the Luxembourg financial sector, including:
- Fund Operations: Greater efficiency and reduced costs by leveraging DLT for the issuance and transfer of fund shares.
- Financial transactions: Greater transparency and security.
- Transparency of the regulatory environment: Increased attractiveness and competitiveness of the Luxembourg financial centre through greater legal clarity and flexibility for issuers and investors using DLT.
- Smart Contracts: Potential for automation of contractual terms, reduction of intermediaries and improvement of transaction traceability through smart contracts.
Blockchain Bill IV is part of Luxembourg’s ongoing strategy to develop a strong digital ecosystem as part of its economy and maintain its status as a leading hub for financial innovation. Luxembourg is positioning itself at the forefront of Europe’s growing digital financial landscape by constantly updating its regulatory framework.
Local regulations, such as Luxembourg law, complement European regulations by providing a more specific legal framework, adapted to local specificities. These local laws, together with European initiatives, aim to improve both the use and the security of projects involving new technologies. They help establish clear standards and promote consumer trust, while promoting innovation and ensuring better protection against potential risks associated with these emerging technologies. Check out our latest posts on these topics and, for more information on this law, blockchain technology and the tokenization mechanism, do not hesitate to contact us.
We are available to discuss any project related to digital finance, cryptocurrencies and disruptive technologies.
This informational piece, which may be considered advertising under the ethics rules of some jurisdictions, is provided with the understanding that it does not constitute the rendering of legal or other professional advice by Goodwin or its attorneys. Past results do not guarantee a similar outcome.
News
New bill pushes Department of Veterans Affairs to examine how blockchain can improve its work
The Department of Veterans Affairs would have to evaluate how blockchain technology could be used to improve benefits and services offered to veterans, according to a legislative proposal introduced Tuesday.
The bill, sponsored by Rep. Nancy Mace, R-S.C., would direct the VA to “conduct a comprehensive study of the feasibility, potential benefits, and risks associated with using distributed ledger technology in various programs and services.”
Distributed ledger technology, including blockchain, is used to protect and track information by storing data across multiple computers and keeping a record of its use.
According to the text of the legislation, which Mace’s office shared exclusively with Nextgov/FCW ahead of its publication, blockchain “could significantly improve benefits allocation, insurance program management, and recordkeeping within the Department of Veterans Affairs.”
“We need to bring the federal government into the 21st century,” Mace said in a statement. “This bill will open the door to research on improving outdated systems that fail our veterans because we owe it to them to use every tool at our disposal to improve their lives.”
Within one year of the law taking effect, the Department of Veterans Affairs will be required to submit a report to the House and Senate Veterans Affairs committees detailing its findings, as well as the benefits and risks identified in using the technology.
The mandatory review is expected to include information on how the department’s use of blockchain could improve the way benefits decisions are administered, improve the management and security of veterans’ personal data, streamline the insurance claims process, and “increase transparency and accountability in service delivery.”
The Department of Veterans Affairs has been studying the potential benefits of using distributed ledger technology, with the department emission a request for information in November 2021 seeking input from contractors on how blockchain could be leveraged, in part, to streamline its supply chains and “secure data sharing between institutions.”
The VA’s National Institute of Artificial Intelligence has also valued the use of blockchain, with three of the use cases tested during the 2021 AI tech sprint focused on examining its capabilities.
Mace previously introduced a May bill that would direct Customs and Border Protection to create a public blockchain platform to store and share data collected at U.S. borders.
Lawmakers also proposed additional measures that would push the Department of Veterans Affairs to consider adopting other modernized technologies to improve veteran services.
Rep. David Valadao, R-Calif., introduced legislation in June that would have directed the department to report to lawmakers on how it plans to expand the use of “certain automation tools” to process veterans’ claims. The House of Representatives Subcommittee on Disability Assistance and Memorial Affairs gave a favorable hearing on the congressman’s bill during a Markup of July 23.
-
Videos9 months ago
Crypto News: Bitcoin, ETH Price, CPI Print, PYTH, WIF & MORE!!
-
Videos9 months ago
Crypto News: Bitcoin Price, ETF, ETH, WIF, HNT & MORE!!
-
DeFi9 months ago
Metasphere Labs announces follow-up event regarding
-
Videos9 months ago
Solana price potential?! Check out THIS update if you own SOL!!
-
Videos8 months ago
Who Really CONTROLS THE MARKETS!! Her plans REVEALED!!
-
DeFi6 months ago
Pump.Fun Overtakes Ethereum in Daily Revenue: A New Leader in DeFi
-
DeFi6 months ago
Degens Can Now Create Memecoins From Tweets
-
News6 months ago
New bill pushes Department of Veterans Affairs to examine how blockchain can improve its work
-
News6 months ago
Lawmakers, regulators to study impact of blockchain and cryptocurrency in Alabama • Alabama Reflector
-
Bitcoin6 months ago
1 Top Cryptocurrency That Could Surge Over 4,300%, According to This Wall Street Firm
-
Ethereum8 months ago
Comment deux frères auraient dérobé 25 millions de dollars lors d’un braquage d’Ethereum de 12 secondes • The Register
-
Videos8 months ago
Cryptocurrency News: BTC Rally, ETH, SOL, FTM, USDT Recover & MORE!