Skip to content

rmul method inside FieldElement Class to be added before completing ex 4 chapter 3 #261

Open
@enricobottazzi

Description

@enricobottazzi

In order to complete Exercise 4 chapter 3, it is necessary to execute a call the self == other exception in point addition. This will likely return you an error

  File "/Users/enricobottazzi/Documents/GitHub/ec-primer-rust/ec.py", line 47, in __add__
    s = (3 * self.x**2 + self.a) / (2 * self.y)
TypeError: unsupported operand type(s) for *: 'int' and 'FieldElement'

The way to avoid this error you need ti add the __rmul__ method inside the FieldElement Class as implemented here => https://github.com/jimmysong/programmingbitcoin/blob/master/code-ch03/ecc.py#L75

The problem is that this method is never explained nor mentioned inside the book.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions