Skip to Content
Hands-On Blockchain for Python Developers
book

Hands-On Blockchain for Python Developers

by Arjuna Sky Kok
February 2019
Intermediate to advanced
450 pages
9h 59m
English
Packt Publishing
Content preview from Hands-On Blockchain for Python Developers

Data types

Let's create a more complex smart contract and name it donation.vy, as follows. You can refer to the followng GitLab link for the full code: https://gitlab.com/arjunaskykok/hands-on-blockchain-for-python-developers/blob/master/chapter_03/donation.vy:

struct DonaturDetail:    sum: uint256(wei)    name: bytes[100]    time: timestampdonatur_details: public(map(address, DonaturDetail))......@publicdef withdraw_donation():    assert msg.sender == self.donatee    send(self.donatee, self.balance)

Compile and deploy the smart contract as before. Don’t forget to remove all of your files in the build/contracts directory and restart your Ganache if you reuse the project directory.

Take a look at the following lines:

struct DonaturDetail: sum: uint256(wei) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Blockchain in Action

Blockchain in Action

Bina Ramamurthy
Learn Python by Building a Blockchain and Cryptocurrency

Learn Python by Building a Blockchain and Cryptocurrency

Academind by Maximilian Schwarzmüller GmbH

Publisher Resources

ISBN: 9781788627856Supplemental Content