Playing with a smart contract

In the previous chapter, we have developed a simple smart contract using Vyper named hello.vy. Let's create a script using web3 to interact with this smart contract. If you have forgotten the content of hello.vy, here is the content of the file:

name: public(bytes[24])@publicdef __init__(): = "Satoshi Nakamoto"@publicdef change_name(new_name: bytes[24]): = new_name@publicdef say_hello() -> bytes[32]:    return concat("Hello, ",

Compile it and deploy it to Ganache or the Rinkeby network. Now, depending on whether you want to connect to your smart contract in Ganache or Rinkeby, choose one of the following options.

The first script is for interacting with the smart contract in the Rinkeby ...

Get Hands-On Blockchain for Python Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.