Postr – 邮政区块链毕设代写
区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Postr – 邮政区块链毕设代写 是一篇很好的国外资料
Postr
Postr showcases a Twitter-like decentralized app (dApp) where Tweets are stored anonymously on the blockchain.
Abstract
Social media platforms are said to be the “town square of the 21st century”. Millions of people rely on news and opinion from these platforms every day, which introduces a new problem of consolidated power over information. Ethereum Co-founder, Vitalik Buterin, proposed that the blockchain could be used to create a censorship-free platform. Postr demonstrates this idea with the ability to send, store, and read a message entirely on the blockchain by using smart contracts.
Demo
How does it work?
Where’s the Blockchain?
The blockchain for Postr was setup and tested in a local Ethereum Testnet using Ganache. It communicates over an RPC Server at http://127.0.0.1:7545
. The gif below shows the accounts, blocks, transactions and contracts associated with the Testnet. The Post
contract is what initiates the “tweet” and stores the message on the blockchain. For example, you can see the hex stored is 0x746573742061626320313233
which translates to test abc 123
in UTF-8.
What’s a Smart Contract?
The smart contract is the primary mechanism for interacting with the Ethereum blockchain. A smart contract can store information, compute business logic, communicate with external applications, or even chain smart contracts together to create robust end products. Postr has only one smart contract called Post
where it stores a message as a type string
and emits an event. This is as simple as it gets.
contract Post { event StorageSet(string _message); string public storedData; function post(string memory x) public { storedData = x; emit StorageSet("Posted!"); } }
Ethereum smart contracts are written in Solidity, a high-level Object-Oriented language which is statically typed. This means that contracts are first written, compiled, then deployed to the blockchain. Web3.js
allows the Vue.js
app to communicate to the Testnet and invoke the smart contract’s post()
method. By doing so, it creates a Transaction Hash which can be used to query the blockchain for the transaction.
Considerations
Postr was created as an exhibition to show the potential of a decentralized social media platform. Currently, Ethereum 1.0 requires a small gas fee in order to submit smart contracts to the blockchain. This gas fee is used to compensate the miner with a reward when the block is processed. This system is called “Proof of Work,” but Ethereum 2.0 will move to a staking model. The new staking system should bring the barrier-to-entry to a minimum, where currently paying a fee to post a message is not a viable model.
Upgrades
Future upgrades to Postr may include:
- Integrate InterPlanetary File System (IPFS) to post decentralized media content, such as images or videos
- Add the ability to post multiple messages, dynamically creating a list of posts
- Create a NoSQL database to store Transaction Hashes, which can be used to dynamically populate posts
- Provide Gravatar option for users to help recognize each other
- And much more
A separate ReadMe file will be created with a complete tutorial on how to setup Postr for local development.
Update README.md
Postr
Postr showcases a Twitter-like decentralized app (dApp) where Tweets are stored anonymously on the blockchain.
Abstract
Social media platforms are said to be the “town square of the 21st century”. Millions of people rely on news and opinion from these platforms every day, which introduces a new problem of consolidated power over information. Ethereum Co-founder, Vitalik Buterin, proposed that the blockchain could be used to create a censorship-free platform. Postr demonstrates this idea with the ability to send, store, and read a message entirely on the blockchain by using smart contracts.
Demo
How does it work?
Where’s the Blockchain?
The blockchain for Postr was setup and tested in a local Ethereum Testnet using Ganache. It communicates over an RPC Server at http://127.0.0.1:7545
. The gif below shows the accounts, blocks, transactions and contracts associated with the Testnet. The Post
contract is what initiates the “tweet” and stores the message on the blockchain. For example, you can see the hex stored is 0x746573742061626320313233
which translates to test abc 123
in UTF-8.
What’s a Smart Contract?
The smart contract is the primary mechanism for interacting with the Ethereum blockchain. A smart contract can store information, compute business logic, communicate with external applications, or even chain smart contracts together to create robust end products. Postr has only one smart contract called Post
where it stores a message as a type string
and emits an event. This is as simple as it gets.
contract Post { event StorageSet(string _message); string public storedData; function post(string memory x) public { storedData = x; emit StorageSet("Posted!"); } }
Ethereum smart contracts are written in Solidity, a high-level Object-Oriented language which is statically typed. This means that contracts are first written, compiled, then deployed to the blockchain. Web3.js
allows the Vue.js
app to communicate to the Testnet and invoke the smart contract’s post()
method. By doing so, it creates a Transaction Hash which can be used to query the blockchain for the transaction.
Considerations
Postr was created as an exhibition to show the potential of a decentralized social media platform. Currently, Ethereum 1.0 requires a small gas fee in order to submit smart contracts to the blockchain. This gas fee is used to compensate the miner with a reward when the block is processed. This system is called “Proof of Work,” but Ethereum 2.0 will move to a staking model. The new staking system should bring the barrier-to-entry to a minimum, where currently paying a fee to post a message is not a viable model.
Upgrades
Future upgrades to Postr may include:
- Integrate InterPlanetary File System (IPFS) to post decentralized media content, such as images or videos
- Add the ability to post multiple messages, dynamically creating a list of posts
- Create a NoSQL database to store Transaction Hashes, which can be used to dynamically populate posts
- Provide Gravatar option for users to help recognize each other
- And much more
A separate ReadMe file will be created with a complete tutorial on how to setup Postr for local development.
Update README.md
部分转自网络,侵权联系删除区块链源码网
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » Postr – 邮政区块链毕设代写