Industrial Training Report
Industrial Training Report
Magpie xyz
Submitted by
Deepak Pal
(Roll No: UE205032)
Jan-June 2024
DECLARATION
I hereby declare that the project work entitled Penpie is an authentic record of my own work
carried out at Magpie xyz as requirements of six months Industrial Training for the award Of
the degree of B.E ELECTRONICS AND COMMUNICATION ENGINEERING at
University Institute of Engineering & Technology, Panjab University, Chandigarh under the
guidance of Priyanshu Srivastava (Senior FE Engineer @Magpiexyz).
Date:12-07-2024
UE205032
Deepak Pal
Certified that the above statement made by the student is correct to the best of my/our
knowledge and belief.
MENTOR CERTIFICATE
It is hereby certified that the work presented in the training report entitled INDUSTRIAL
TRAINING REPORT at Magpie xyz, for the partial fulfillment of the requirement for the
award of the Degree of Bachelor of Engineering in Electronics and Communication from
University Institute of Engineering and Technology, Panjab University, Chandigarh, is an
authentic record of work carried out by me during my 8th semester Industrial
Training/Internship at Magpie xyz. The matter embodied in this report has not been submitted
for the award of any other degree.
Deepak Pal
UE205032
8th Semester
ECE
This is to certify that the above statement made by the candidate is correct to the best of my
knowledge and belief.
Acknowledgement
First and foremost, I extend my heartfelt thanks to Priyanshu Srivastava for his leadership
and guidance throughout my internship journey. His mentorship has been invaluable,
providing me with a solid foundation to grow both personally and professionally.
I am grateful for their guidance, support, and trust throughout the internship period. Their
expertise and insights have been instrumental in shaping my understanding of the industry
and enhancing my professional skills.
I extend my sincere appreciation to my seniors at Magpie xyz for their unwavering support
and valuable advice. Their willingness to share their knowledge and experiences has been
invaluable in expanding my understanding of software engineering principles and practices. I
am grateful for the collaborative work environment they fostered, which allowed me to learn
and grow as a professional.
I would also like to express my gratitude to UIET for incorporating industrial training as part
of the curriculum and providing me with the opportunity to gain practical exposure. The
academic foundation and theoretical knowledge I acquired from my college studies have
served as a strong base for my performance during the internship. I am thankful to the faculty
members for their guidance and encouragement throughout my academic journey.
Lastly, I would like to acknowledge the support and understanding of my family and friends,
who have been a constant source of motivation and encouragement. Their unwavering belief
in my abilities has been pivotal in my professional development.
In conclusion, I am immensely grateful to all those mentioned above and to everyone else
who has contributed to my growth during this internship. Their support and guidance have
played a crucial role in shaping my skills, knowledge, and professional ethics. I am truly
thankful for the opportunities and experiences I gained at Magpie xyz
TABLE OF CONTENTS
TRAINING COMPLETION CERTIFICATE………………………………………………………ii.
CANDIDATE DECLARATION……………………………………………………………………..iv.
MENTOR CERTIFICATE……………………………………………………………………………v.
ACKNOWLEDGEMENT…………………………………………………………………………….vi.
CHAPTER 6: CONCLUSION 32
6.1 Conclusion………………………………………………………………………………32
REFERENCES………………………………………………………………………...33
A Blockchain has as many blocks as transactions, and each block refers to the previous block, and all
these blocks together are called a Blockchain. Blockchain technology is very effective because
multiple copies of a Blockchain are spread across multiple computers via the Internet, due to which it
is not possible to alter them.
Ledger: is any file having a constantly growing record related to the transaction.
Permanent: transaction means that once the transaction goes inside a Blockchain, it is stored
permanently in the record and immutable.
Secure: Information is stored securely through this technology as highly advanced cryptographic
techniques are used to ensure that your information is locked within the Blockchain.
Chronological: It means every transaction occurs after the previous one.
Time reduction: In finance, Blockchain allows for a speedy resolution of trades with high
reliability and security. It does not take long to verify, settlement as well as clearance.
Unchangeable transactions: This technology has the characteristics of registering transactions
in a sequential order that is used for certifying the inalterability of all operations, which
means all the transactions are immutable; Therefore, modification is restricted, and the
integrity of the data is preserved.
Reliability: It certifies as well as confirms the uniqueness of each party of the chain hence
eliminates duplicate records, accelerates transactions, and reducing rates.
Security: Blockchain uses SHA-256 hashing algorithm cryptography to ensure that the
information inside the blockchain is secured. It uses distributed laser technology. Each party
will keep a copy of the original chain so that the system remains functional even if any node
is separated.
Collaboration: This allows each party to transact directly with each other without the need for
a third-party intermediary.
Decentralized: This is because there is no central authority that supervises the entire system
process. There are certain paradigms and rules on which each node interacts with Blockchain
information. Someone buys some article and that article went out of stock we will have to
immediately reflect the changes to the user. Also we will have to keep our database updated.
We have also taken care of security of our website like our website is cannot be harmed by
sql injection or nobody can breach into the privacy of our users because all the sensitive
information is stored in encrypted format.
CHAPTER 2:
THEORY
Blockchain platform
Nodes
Network Platform Stack
Transactions
Blockchain Platform:
The Blockchain runs on distributed servers. The Blockchain data is stored either in a flat file
or in an RDB based on the choice of the user.
The Blockchain software operation is so massive that it is impossible to hack into the
application. The nodes within the network use a peer-to-peer IP network to verify
transactions.
When numerous nodes have the same blocks within their databases, they are regarded to be in
consensus.
Eliminating intermediation
The exchange between two parties is made possible without any necessary intermediation from
the third party. This process strongly eliminates the risk from outer parties.
Authorized users
Users are completely aware of all their data and information regarding transactions. Standard
data
Reliability
Blockchain does not deal with a central point of failure, as it is built with decentralized
networks. Due to this feature, Blockchain is able to withstand malicious attacks.
Integration of process
Transactions are well - executed same as the protocol commands. This access removes
intermediation of a third party site.
Transparency
Alterations to blockchains are available for use by all parties. This results in transparency, and
immutability while performing transactions.
Simplified Ecosystem
All transactions are added to an autonomous public ledger. This reduces the complications
associated with multiple ledgers.
Quicker transactions
Interbank transactions take much time, in fact, days for final settlement, mainly out of working
hours. Blockchain transactions lessen this transaction time to just a few minutes.
Blockchain technology created the backbone of a new type of internet allowing distributed
digital information.
A distributed database
The blockchain database is kept open, public and readily verifiable, and accessible. It is
Blockchain technology possesses built-in robustness. It stores blocks of identical data across its
network, which ensures:
- Be controlled by any single entity.
- Has no single point of failure
Blockchain network stays in a state of consensus and automatically checks within itself. The
network reconciles each transaction within a span of a ten-minute interval. Two significant
features are:
-Transparency : data is embedded public within the entire network.
-Incorruptible : Huge amount of computing power is utilized to override the network while
altering a single unit of data.
Blockchain stores the data along with its network. This feature reduces the risks associated with
the data. Security methods of the Blockchain employ encryption technology, making data
incorruptible.
A second-level network
With blockchain technology, the web gains a new layer of functionality. With the added
security brought by the blockchain, new internet business is on track to unbundle the traditional
institutions of finance.
The blockchain potentially cuts out the middleman for a huge type of transaction. Currently,
finance offers the strongest use cases for blockchain technology.
Wallet applications are the most common GUI devised for the blockchain. This methodology
is attainable even to the general public with basic knowledge of computing.
Blockchain shows great promise across a wide range of business applications like:
-Banking
-Finance
-Government
-Healthcare
-Insurance
-Legal
-Manufacturing
-Media and Entertainment
-Retail
CHAPTER 3:
BLOCKCHAIN TRAINING
At first training consisted of Introduction to Blockchain, Blockchain Networks focusing
mainly on the Ethereum, Arbitrum, BNB Smart Chain, Optimism Networks. Learning about
the Block confirmations and the transactions gas fees comparisons along with the security
Levels and Native Currency Tokens of these Networks.
Also learnt about Block Explorers, using Tenderly for analyzing transactions, contract calls
and gas utilization for various calls.
Fig. 3.2 : A successful Transaction for analysis on the Tenderly development platform
Used Block Explorers for actual mainnet executed transactions and to figure out the causes of
failed transactions:
Fig. 3.3: A multiple ERC20- transfer transaction on the Ethereum mainnet network
3.1 Solidity
Solidity is an object-oriented, high-level language for implementing smart contracts. Smart
contracts are programs that govern the behavior of accounts within the Ethereum state.
Solidity is a curly-bracket language designed to target the Ethereum Virtual Machine (EVM).
It is influenced by C++, Python, and JavaScript. You can find more details about which
languages Solidity has been inspired by in the language influences section.
Solidity is statically typed, supports inheritance, libraries, and complex user-defined types,
among other features.
With Solidity, you can create contracts for uses such as voting, crowdfunding, blind auctions,
and multi-signature wallets.
When deploying contracts, you should use the latest released version of Solidity. Apart from
exceptional cases, only the latest version receives security fixes. Furthermore, breaking
changes, as well as new features, are introduced regularly. We currently use a 0.y.z version
number to indicate this fast pace of change.
Created and deployed my own ERC-20 Token which is exactly like a new crypto currency
that can be bought and sold for actual USDT(stablecoin)
An Ethereum smart contract is a type of account executed as a program with a code and data
Functioning as a type of Ethereum account, smart contracts can hold a balance and send
transactions over the network. However, it is noteworthy that they are deployed to the
network instead of being controlled by a user. They run according to how they are
programmed, and user accounts can interact with them by submitting transactions according
Just like a regular contract, smart contracts define rules. However, the difference lies in its
execution. Instead of just defining rules, smart contracts enforce them through code. Also,
interactions with smart contracts are irreversible and they cannot be deleted by default.
Complex blockchain programs like Ethereum are highly experimental. There are constant
changes and whenever new bugs or loopholes are discovered, new best practices are
introduced. Hence, the security landscape is always changing and differs from one aspect to
the other.
What is TypeScript
JavaScript and More
TypeScript adds additional syntax to JavaScript to support a tighter integration with your
editor. Catch errors early in your editor.
TypeScript code converts to JavaScript, which runs anywhere JavaScript runs: In a browser,
on Node.js or Deno and in your apps.
Safety at Scale
TypeScript understands JavaScript and uses type inference to give you great tooling
without additional code.
3.3 Hardhat
Hardhat Runner is the main component you interact with when using Hardhat. It's a flexible
and extensible task runner that helps you manage and automate the recurring tasks inherent to
developing smart contracts and dApps.
Hardhat Runner is designed around the concepts of tasks and plugins. Every time you're
running Hardhat from the command-line, you're running a task. For example, npx hardhat
compile runs the built-in compile task. Tasks can call other tasks, allowing complex
workflows to be defined. Users and plugins can override existing tasks, making those
workflows customizable and extendable.
This guide will take you through the installation of our recommended setup, but as most of
Hardhat's functionality comes from plugins, you are free to customize it or choose a completely
different path.
# Installation
TIP
Hardhat for Visual Studio Code is the official Hardhat extension that adds advanced support for
Solidity to VSCode. If you use Visual Studio Code, give it a try!
Hardhat is used through a local installation in your project. This way your environment will be
reproducible, and you will avoid future version conflicts.
To install it, you need to create an npm project by going to an empty folder, running npm init,
and following its instructions. You can use another package manager, like yarn, but we
recommend you use npm 7 or later, as it makes installing Hardhat plugins simpler.
Fig. 3.7 : Hardhat local installation command(Non-Local installations are not supported)
To use your local installation of Hardhat, you need to use npx to run it (i.e. npx hardhat init).
Web3.js
web3.js - Ethereum JavaScript API
web3.js is a collection of libraries that allow you to interact with a local or remote ethereum
node using HTTP, IPC or WebSocket. The web3.js library is a collection of modules that
contain functionality for the ethereum ecosystem. web3-eth is for the ethereum blockchain and
smart contracts. web3-shh is for the whisper protocol, to communicate p2p and broadcast.
web3-bzz is for the swarm protocol, the decentralized file storage.
web3-utils contains useful helper functions for Dapp developers. Adding web3.js First you need
to get web3.js into your project. This can be done using the following methods:
npm: npm install web3 yarn: yarn add web3
pure js: link the dist/web3.min.js
After that you need to create a web3 instance and set a provider.
a) Ether.js
What is Ether.js?
The ethers.js library aims to be a complete and compact library for interacting with the
Ethereum Blockchain and its ecosystem. It was originally designed for use with ethers.io and
has since expanded into a more general-purpose library.
Features
Keep your private keys in your client, safe and sound
Import and export JSON wallets (Geth, Parity and crowdsale)
Import and export BIP 39 mnemonic phrases (12 word backup phrases) and HD Wallets
(English, Italian, Japanese, Korean, Simplified Chinese, Traditional Chinese; more coming
soon)
Meta-classes create JavaScript objects from any contract ABI, including ABIv2 and Human-
Readable ABI
Connect to Ethereum nodes over JSON-RPC, INFURA, Etherscan, Alchemy, Cloudflare or
MetaMask.
ENS names are first-class citizens; they can be used anywhere an Ethereum addresses can be
used
Tiny (~88kb compressed; 284kb uncompressed)
Complete functionality for all your Ethereum needs
Extensive documentation
Large collection of test cases which are maintained and added to
Fully TypeScript ready, with definition files and full TypeScript source
MIT License (including ALL dependencies); completely open source to do with as you please
Fig. 3.8 : The update rewards method of the Base Reward Pool Smart Contract(the entire smart
contract is 500+ lines of code)
Fig. 3.9 : The update reward method of the Stream Rewarder( the entire smart contract is
500+ lines of code)
This is even more complex and requires a deeper understanding of the delayed rewards
concept.
CHAPTER 4
MAGPIE ECOSYSTEM
Magpie is the first protocol within Magpie XYZ, designed to provide yield and
veTokenomics boosting services for Wombat Exchange. Incubated by Wombat Exchange,
Magpie is focused on locking WOM tokens to own governance rights and boosted yield
benefits as liquidity provider on Wombat.
The platform offers users the opportunity to deposit their Stablecoins, BNB, Liquid BNB,
frxETH, ETH, WOM, mWOM tokens in single-sided boosted pools to earn high APR %
while it allows Wombat Exchange voters to cost-effectively acquire voting power and earn
passive income at the same time through the MGP token.
Magpie offers WOM holders the chance to earn high APR by converting their tokens into
mWOM. mWOM refers to "Magpie WOM". mWOM can be staked on Magpie to earn
boosted passive income.
When users convert their WOM tokens, they get mWOM that allows them to earn high
rewards while Magpie locks all the converted WOM as veWOM on Wombat Exchange.
That's how Magpie accumulates veWOM. veWOM entitles Magpie to boosted WOM
rewards and governance benefits on Wombat Exchange. That's why Magpie can offer users
sustainable boosted passive income.
Our SubDAO model signifies a groundbreaking initiative by to incubate new protocols that
fortify veTokenomics-based protocols within the sprawling DeFi ecosystem. This initiative
involves the birth of SubDAOs — sub-decentralized autonomous organizations — each
crafted with a bespoke purpose and function that harmonizes with the parent protocol. The
cornerstone of the SubDAO model is a symbiotic alliance between Magpie and the protocols
it supports, fostering an environment where both entities thrive and collectively contribute to
the larger growth of the DeFi landscape. The Magpie treasury is entitled to 20% of the total
token supply from each SubDAO following a 2-year vesting period; this approach provides
governance benefits and a new source of income for vlMGP holders.
Benefits of SubDAOs for vlMGP holders
Low FDV SubDAO : vlMGP holders can secure allocations for the Initial DEX Offerings
(IDO) of our SubDAOs tokens, thus facilitating easier access to these new tokens at a
competitive price.
Revenue Sharing from SubDAOs: vlMGP holders are entitled to a share of the revenue
generated by the SubDAOs, providing them with a new stream of passive income.
SubDAOs Voting Power: vlMGP holders are granted voting rights within the SubDAOs,
empowering them to directly influence decisions and drive the direction of the SubDAOs.
Magpie has currently 6 SubDao’s all of which are built on different DEXes and
Magpie Ecosystem boasts a TVL of more than $700M making it among the top 20 players in
the deFI sector.
8. Magpie XYZ created its own IDO Launchpad platform and performed two
successful IDOs.
10. The CKP IDO accumulated a total of $2.6M(around 22 Crore INR) in January 2024.
11. Magpie XYZ received Arbitrum grant of more than $2.5M(around 21 crore INR)
in October 2023.
CHAPTER 5
MY ROLE IN THE COMPANY
f. AWS Cloud - Used by Magpie for managing various API services that are used for
off chain calculations.
In the last 2 months, in addition to learning about the various blockchain concepts, tools and
languages, I also had to work on solving a real world problem of the Magpie Ecosystem.
The Magpie Ecosystem received an ARB token STIP of around $2.5M(around 21 Crore INR)
in October 2023. The distribution of part of this STIP to magpie ecosystem stakeholders was
to be done using a ARB rewarder, the ARB rewarder was to be a secure and robust smart
contract that had to be funded by the $2.5M STIP and had to be deployed and configured
with extreme care by multisig owners to avoid any loss of funds.
Fig. 5.1 : The ARB rewarder contract’s last few lines of implementation
The final implementation was a 200+ lines Smart Contract that utilized various libraries and
security parameters to distribute ARB rewards among the stakeholders according to their
current positions and the time of their recent deposits including various other factors. The
immutable contract was deployed via the opnezeppelin’s upgradeable and ownable proxy
pattern so that vulnerabilities can be fixed to minimize the losses in case a vulnerability
occurs in the worst scenario after the Audit and security checks.
Also worked on the Stream rewarder and the vlStream rewarder for magpie to reduce the
user’s wait time for the distribution of rewards upon harvest, this saves gas for manual
harvest at smaller intervals but increases the gas that user had to pay by a tiny bit overall
improving the efficient and running cost of the Penpie.
CHAPTER 6
CONCLUSION
Training at Magpie xyz helped me grasp the knowledge of the blockchain world, diving into
the deFi protocols governance, elimination of the centralization and efficient usage of the
Proof of Work mechanism allows for transparent and trustworthy protocols.
I leant the usage of tools and technologies like Solidity, Hardhat, Block Explorers, was given
test funds to learn about the product of the Magpie Ecosystem by actually providing Liquidity
and getting governance power on the Magpie Ecosystem, it all helped me have a deeper
understanding of the decentralization mechanism the the blockchain aims to implement into
this world.
In addition to the usage of the blockchain I also had to deep dive into the blockchain’s internal
architecture for integrating with Babylon chain, I had to take a closer look into the Proof of
work mechanism of the EVM chains and replace with the Proof of Stake mechanism.
The overall experience at Magpie xyz has given me blockchain skillset that I can use to easily
secure a job into the deFi(decentralized finance) space.
Bibliography /references
• https://www.w3schools.com/js/
• https://docs.magpiexyz.io/
• https://git-scm.com/
• https://docs.aws.amazon.com/
• https://hardhat.org/docs
• https://book.getfoundry.sh/
• https://ethereum.org/en/developers/docs/
• https://docs.soliditylang.org/en/v0.8.26/
• https://docs.soliditylang.org/en/v0.8.26/layout-of-source-files.html
• https://docs.radiant.capital/radiant
• https://www.typescriptlang.org/docs/
• https://docs.github.com/en
• https://www.blockchain.com/explorer/api
• https://docs.tenderly.co/
• https://docs.layerzero.network/v2
• https://docs.babylonchain.io/
• https://docs.arbitrum.foundation/gentle-intro-dao-governance
• https://docs.eigenlayer.xyz/eigenlayer/overview/whitepaper