If the result of my point addition is point Q = ( x, y ) then what is the arithmetic to do the mod p?
Is the mod to be done on x or y as soon as they exceed p?
Maybe here is the answer. This is an elliptic curve and, to my novice knowledge, must be manipulated with the correct field arithmetic. Standard arithmetic does not apply to the entire point, Q for example, having two parts. But, individual arithmetic steps are subject to standard arithmetic such as 1 + 1 =2 and 4 / 2 = 2. Is that what is to be done rather than some eliptic curve operation such as elliptic addition? Just use regular arithmetic on the x or y of Q = (x,y)? Just regular integer division and keep the remainder?
Yes, I have searched for this extensively and not been able to recognize the answer. A link to an answer that provides the individual arithmetic steps would be wonderful.
Update following this answer:
The use of $-977$ for $p$ surprised me but I was able to figure it out. Most places subtract all powers of two. I have visited a few sites and have found that the basic algebra works out to these two equations. $$\begin{align} x_r &= \left(\frac{y_q - y_p}{x_q - x_p}\right)^2 - x_p - x_q\\ \\ y_r &= \frac{y_q - y_p}{x_q - x_p}(x_p - x_r) - y_p \end{align}$$ (presuming some specific conditions)
I can convert those to arithmetic and can write code in C or C++ to do the long arithmetic. To my understanding the above is addition on the field that composes, or defines, or makes up, (best phrase?) the secp256k1 curve.
But I never see an explanation of how to do the modulo operation. I just assumed it was another special operation like the addition. But as I wrote my question, the insight (possibly wrong) occurred to me that the modulo is an individual action, not a field action, and should be done with regular arithmetic. In this case, meaning regular division, albeit using very long numbers.
And: referring to the equations above, when $x_r$ or $y_r$ exceed $p$, do the modulo $p$ operation. That can be done with division or repetitive subtraction.
Subtraction would probably be less subject to error.
I think the answer is implicit in the first paragraph, but not certain. Do I have the right concept about the use of mod $p$?