Skip to content

Instantly share code, notes, and snippets.

@weserickson
Created Apr 22, 2021
Embed
What would you like to do?
(* return calculations as a function of n nodes, rough calculations *)
Q[nn_]:=Module[{n=nn,tvotes,fr,l,m,V,W,X,R,Q},
fr=(23/25)(1/25);(*average fraction of blocks produced, assuming 100% success rate*)
l=(1152*75*fr); (* num blocks produced by the SPB in a day. *)
m=(1152*75*fr); (* number of blocks SPB expected to produce *)
V=10000000+n*10000; (* votes and stake of the FullNodePool SPB node *)
tvotes=105745810; (*total votes 4/20/2021, w/ ~1450 active full nodes*)
W=tvotes+(n-1450)*10000; (* votes and stake of top 100 SPB nodes, subtracting stake for 1450 nodes to prevent counting it twice *)
X=1152*75; (* total number of blocks produced by all SPBs in a cycle*)
R=0.951293759512937595; (* fixed Vite per block pay rate *)
Q=((l/m)*(V/W)*X*R*0.5+l*R*0.5) (* total rewards *)];
extra[x_]:=If[x<8000,x,((x-8000)8000)/x+8000]; (* bonus rewards from latest ViteLabs incentive program *)
totalrewardspernode[n_]:=(extra[Q[n]]+Q[n])/n;
sbprewardspernode[n_]:=Q[n]/n;
APR[n_]:=totalrewardspernode[n]*365/10000*100;
APRbase[n_]:=sbprewardspernode[n]*365/10000*100;
APY[n_]:=((1+totalrewardspernode[n]/10000)^365-1)*100;
p1=Plot[{totalrewardspernode[n],sbprewardspernode[n]},{n,1,5000},PlotRange->{0,35},PlotTheme->"Detailed", PlotLabel->"Estimated Full Node Daily Rewards",FrameLabel->{"n (# of nodes)","Vite per day"},LabelStyle->{FontSize->14},ImageSize->Large,PlotLegends->{"total rewards","\"SBP only\" rewards"}]
p2=Plot[{APR[n],APRbase[n],APY[n]},{n,1,4000},PlotRange->{0,100},PlotTheme->"Detailed", PlotLabel->"Estimated Full Node Annualized Returns",FrameLabel->{"n (# of nodes)","Annualized Returns (%)"},LabelStyle->{FontSize->14},ImageSize->Large,PlotLegends->{"APR","APR (\"SBP only\")","APY (w/ compounding)"}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment