Repository
https://github.com/steemit/steem
This is an analysis to try to determine if 'dead' or inactive (I'll use inactive from this point forward) accounts have any impact on the witness positions.
Contents
- Background
- Assumptions / Criteria used
- Results
- Overview of results
- Re-ordering the top 20
- Inactivity grouped by witness standings
- Summary
- Scripts used in the production of this report
Background
There have been a number of discussions recently regarding inactive accounts that have votes cast for witnesses.
The basic premise is that in order to vote for say an election, or a change in government, the voter must:
- be alive
- show proof of identification
If the above is not true, then a when election time comes, a new vote cannot be cast.
Within the Steem blockchain code, obviously there is currently no mechanism to check the user of an account is deceased or has lost their keys (identification). And so as it stands, the witness votes cast prior to one or both or these events occurring will remain in place forever.
Assumptions / Criteria used
For the purpose of this analysis, 180 days has been chosen as the number days that constitute inactivity. More background on the reasoning behind this analysis and the choice of 180 day can be found here: @pharesim/re-abh12345-re-sircork-re-abh12345-re-sircork-re-abh12345-re-sircork-re-abh12345-re-pharesim-a-fundamental-change-to-my-witness-voting-behavior-20180507t092325061z
This number has been used against the following criteria:
- A union of all of the below
- Last witness vote change
- Last bandwidth update
- Last vote
- Last comment (including post)
All votes are accounted for, including proxy -> proxy -> proxy -> proxy -> proxy -> witness
For this report, only the active witnesses are accounted for, and this list was taken from https://steemian.info/witnesses on the 6th June 2018 at 8:30 am UTC.
Results
The following table (ordered by MV) displays columns described as:
- Witness - Name of the witness
- MV - Current MVESTS without any criteria applied
- MV_180 - MVESTS with all criteria applied*
*This means that if an account has voted for a witness, received a bandwidth update, voted, or commented in the past 180 days, they are considered active and their MVESTS are a part of the final count.
- MV_BW - Sum of MVESTS of accounts that have received a bandwidth update within the last 180 days
- MV_wit_v - Sum of MVESTS of accounts that have made a change to their witness votes within the last 180 days
- MV_vote - Sum of MVESTS of accounts that have voted on content within the last 180 days
- MV_post - Sum of MVESTS of accounts that have posted/commented within the last 180 days
Data was collected from SteemSQL and stored locally on the 6th June 2018 at 8:30am UTC.
MVESTS are rounded to 2 decimal places for display purposes - 5 decimal places are used for all further calculations.
Witness | MV | MV_180 | MV_BW | MV_wit_v | MV_vote | MV_post |
---|---|---|---|---|---|---|
gtg | 75704.22 | 74993.22 | 74741.42 | 69642.76 | 55205.45 | 50308.81 |
jesta | 74580.47 | 74540.98 | 74238.24 | 70926.74 | 55085.62 | 48266.71 |
roelandp | 71472.71 | 71378.26 | 71111.17 | 63728.34 | 51875.13 | 45111.00 |
timcliff | 69655.46 | 69642.04 | 69524.55 | 66942.38 | 52309.93 | 44257.85 |
good-karma | 68019.40 | 67930.91 | 67729.11 | 60566.32 | 49441.82 | 41446.11 |
ausbitbank | 64034.82 | 64028.30 | 63797.86 | 62221.72 | 46715.22 | 40487.73 |
thecryptodrive | 61854.32 | 61787.48 | 61521.89 | 59025.44 | 43840.06 | 38802.92 |
someguy123 | 61318.69 | 61241.43 | 61040.11 | 57853.55 | 43538.66 | 36834.34 |
aggroed | 61033.80 | 61028.99 | 60807.77 | 59111.45 | 43647.63 | 38430.63 |
clayop | 61002.54 | 60017.51 | 59896.94 | 56219.88 | 57492.56 | 51853.04 |
smooth.witness | 60398.51 | 59329.75 | 59136.81 | 55991.42 | 56016.13 | 51450.59 |
blocktrades | 59925.46 | 58344.01 | 58226.24 | 52034.01 | 55465.48 | 47077.12 |
lukestokes.mhth | 59831.90 | 59828.99 | 59698.00 | 59018.27 | 42481.11 | 38338.88 |
netuoso | 59513.73 | 59453.93 | 59156.03 | 58142.09 | 40625.67 | 35104.42 |
anyx | 58975.54 | 58883.41 | 58597.21 | 55036.38 | 39246.59 | 33229.99 |
curie | 58595.05 | 58533.47 | 58528.12 | 53363.76 | 42125.51 | 33491.11 |
pharesim | 58346.87 | 57364.46 | 57114.42 | 53498.53 | 54702.91 | 48347.42 |
followbtcnews | 58183.47 | 58180.20 | 57950.47 | 57877.52 | 40950.91 | 34740.28 |
xeldal | 56526.06 | 55842.92 | 55733.24 | 51337.09 | 37545.88 | 28133.77 |
pfunk | 54925.72 | 54832.02 | 54542.29 | 51700.30 | 51616.11 | 46310.40 |
jerrybanfield | 54581.35 | 54575.24 | 54510.15 | 50081.62 | 37383.95 | 33432.26 |
riverhead | 52690.07 | 51641.52 | 51375.91 | 47912.38 | 47933.90 | 44261.17 |
drakos | 50222.60 | 50217.90 | 50044.75 | 49748.40 | 32095.32 | 30290.76 |
cervantes | 49432.94 | 49372.31 | 49125.08 | 47214.79 | 29961.45 | 28888.82 |
furion | 47998.51 | 47988.15 | 47859.96 | 45672.56 | 28818.45 | 26971.21 |
utopian-io | 47395.33 | 47395.21 | 47274.12 | 46938.14 | 31216.48 | 27522.67 |
liondani | 46237.00 | 46213.26 | 46131.89 | 43845.41 | 28088.88 | 25517.23 |
bhuz | 46131.63 | 45194.35 | 45035.74 | 42341.03 | 25674.13 | 22712.89 |
busy.witness | 46076.57 | 46010.14 | 45979.68 | 44076.93 | 29369.37 | 25682.63 |
teamsteem | 42062.05 | 42052.57 | 41854.37 | 40279.44 | 40590.14 | 38237.16 |
yabapmatt | 39658.26 | 39658.26 | 39530.22 | 39482.51 | 23769.69 | 22954.69 |
abit | 30505.94 | 29476.72 | 29429.24 | 25378.61 | 28324.77 | 23006.77 |
klye | 30338.23 | 30312.45 | 30143.76 | 29313.08 | 30215.36 | 25322.36 |
ihashfury | 26470.69 | 26362.15 | 26359.84 | 24417.97 | 10230.28 | 9380.32 |
aizensou | 26225.89 | 26218.30 | 26122.97 | 25858.35 | 9161.72 | 7821.23 |
blockbrothers | 26182.70 | 26182.70 | 26052.65 | 26131.37 | 26102.47 | 25190.77 |
therealwolf | 25097.12 | 25097.12 | 25095.12 | 25097.12 | 9292.86 | 8279.61 |
reggaemuffin | 25044.89 | 25034.04 | 24868.71 | 24716.03 | 24907.22 | 21550.32 |
rival | 23738.11 | 23737.90 | 23734.93 | 23575.46 | 7936.58 | 7851.74 |
ocd-witness | 23186.64 | 23186.64 | 23057.13 | 23186.64 | 23152.87 | 19050.93 |
prc | 22746.27 | 22744.64 | 22743.83 | 22599.18 | 6926.23 | 6755.93 |
patrice | 22485.24 | 22485.24 | 22415.70 | 22266.03 | 21330.07 | 17539.11 |
steemed | 21459.32 | 20470.54 | 20369.55 | 19178.19 | 19132.94 | 15635.94 |
themarkymark | 20203.26 | 20202.95 | 20025.79 | 19940.67 | 19006.27 | 17351.26 |
nextgencrypto | 20087.60 | 19129.32 | 19062.74 | 18285.47 | 17790.05 | 15664.51 |
fyrst-witness | 19368.18 | 19348.97 | 19217.03 | 18082.64 | 19296.79 | 18283.08 |
asbear | 18603.32 | 18603.32 | 18540.61 | 18603.32 | 17524.16 | 16653.72 |
adsactly-witness | 16883.35 | 16883.04 | 16879.07 | 16880.83 | 16876.66 | 14920.69 |
arcange | 15769.23 | 15709.49 | 15586.39 | 14153.85 | 15384.51 | 13675.98 |
joseph | 15680.55 | 15580.13 | 15515.35 | 13715.90 | 13606.95 | 11599.33 |
noisy.witness | 14947.34 | 14947.34 | 14767.89 | 14947.34 | 13837.09 | 12879.81 |
liberosist | 14896.81 | 14896.79 | 14859.97 | 14888.38 | 14858.79 | 12006.19 |
steemgigs | 14287.78 | 14287.30 | 14172.12 | 13765.51 | 14286.68 | 13402.29 |
firepower | 14106.36 | 14106.36 | 14094.65 | 14106.36 | 14094.71 | 13246.71 |
ats-witness | 13104.14 | 13104.14 | 13067.27 | 13071.73 | 12999.57 | 9220.75 |
neoxian | 12979.50 | 12977.00 | 12972.89 | 12866.50 | 12972.34 | 12324.29 |
charlieshrem | 12477.82 | 12453.16 | 12452.91 | 7398.01 | 11624.08 | 8045.99 |
jackmiller | 12188.71 | 12188.71 | 12175.83 | 12188.71 | 12174.86 | 11658.82 |
dragosroua | 12186.93 | 12183.10 | 12145.82 | 11821.58 | 12128.56 | 9928.18 |
justyy | 11116.82 | 11116.82 | 11069.19 | 11116.82 | 11067.82 | 8936.77 |
sircork | 9968.01 | 9967.39 | 9964.43 | 9937.56 | 9962.35 | 9575.59 |
steemychicken1 | 9869.34 | 9827.16 | 9763.46 | 8108.21 | 7591.94 | 6373.23 |
chitty | 9244.51 | 9176.02 | 9169.71 | 7391.63 | 8833.62 | 7317.90 |
boatymcboatface | 8957.75 | 8939.34 | 8899.08 | 8462.54 | 8824.24 | 5970.46 |
emrebeyler | 8253.49 | 8253.49 | 8118.19 | 8253.41 | 8167.66 | 6069.17 |
privex | 8194.35 | 8194.35 | 8191.41 | 8194.35 | 8193.04 | 7848.24 |
complexring | 7323.26 | 7219.96 | 7159.63 | 5960.37 | 5939.85 | 5008.81 |
blockchained | 6446.97 | 6388.26 | 6386.28 | 5129.56 | 6078.63 | 5408.88 |
ura-soul | 6334.12 | 6334.11 | 6331.33 | 6297.65 | 6329.20 | 6310.73 |
qurator | 5877.06 | 5877.06 | 5762.83 | 5877.06 | 5876.92 | 5452.86 |
blackwidow | 5861.30 | 5860.90 | 5769.17 | 5684.06 | 4647.45 | 3682.48 |
felixxx | 5824.07 | 5821.71 | 5820.40 | 5784.65 | 5754.56 | 5626.18 |
yuriks2000 | 5480.36 | 5480.36 | 5479.53 | 5479.83 | 5480.04 | 4077.98 |
jatinhota | 5479.22 | 5479.22 | 5477.80 | 5475.85 | 5478.62 | 5400.68 |
ro-witness | 5398.41 | 5398.41 | 5397.29 | 5398.41 | 5332.30 | 4968.83 |
guiltyparties | 5387.81 | 5387.71 | 5386.02 | 5375.82 | 5383.86 | 3941.70 |
mahdiyari | 5121.50 | 5121.44 | 5119.83 | 5070.38 | 5116.72 | 4823.12 |
helo | 4980.47 | 4980.47 | 4865.66 | 4980.47 | 4980.24 | 4299.80 |
krnel | 4978.35 | 4972.40 | 4958.75 | 4489.83 | 4948.82 | 4869.28 |
b0y2k | 4858.48 | 4858.48 | 4798.25 | 4857.90 | 3727.29 | 3208.51 |
block-buster | 4832.84 | 4832.84 | 4832.74 | 4832.84 | 4832.74 | 4831.19 |
demotruk | 4404.97 | 4404.94 | 4401.98 | 4398.17 | 4403.13 | 4327.92 |
jacor-witness | 4070.88 | 4070.88 | 4070.84 | 4070.88 | 4070.84 | 3706.05 |
steem-bounty | 3991.12 | 3991.12 | 3991.11 | 3991.12 | 3991.12 | 3973.41 |
bue | 3723.14 | 2803.65 | 2803.36 | 2269.36 | 2782.48 | 2626.20 |
bitrocker2020 | 3711.76 | 3711.73 | 3710.98 | 3687.75 | 3711.59 | 3343.27 |
chainsquad.com | 3468.28 | 3409.04 | 3396.04 | 2231.22 | 2630.10 | 2573.67 |
steemcommunity | 3168.44 | 3168.44 | 3168.30 | 3168.44 | 3168.27 | 3153.47 |
sc-steemit | 3147.75 | 3145.37 | 3142.98 | 3037.43 | 3124.10 | 3133.87 |
masteryoda | 3076.35 | 3024.46 | 2967.63 | 2511.35 | 1850.85 | 2555.75 |
comedyopenmic | 3035.96 | 3035.96 | 3035.27 | 3035.96 | 3035.72 | 1642.91 |
anarcho-andrei | 2946.89 | 2946.79 | 2945.30 | 2883.54 | 2946.12 | 2835.44 |
swelker101 | 2946.47 | 2942.99 | 2941.22 | 2904.13 | 2941.13 | 2894.34 |
yehey | 2928.19 | 2928.19 | 2926.26 | 2923.59 | 2924.13 | 2835.15 |
windforce | 2598.46 | 2598.46 | 2593.91 | 2588.79 | 2594.22 | 1980.92 |
jrswab | 2446.54 | 2446.54 | 2445.13 | 2446.54 | 2445.87 | 2364.72 |
samrg472 | 2351.03 | 2351.03 | 2350.36 | 2351.03 | 2350.87 | 2334.42 |
enginewitty | 2331.92 | 2331.92 | 2331.32 | 2331.92 | 2331.78 | 2327.32 |
intelliwitness | 2074.21 | 2074.21 | 2073.96 | 2074.21 | 2073.73 | 2070.58 |
silversteem | 2062.04 | 2001.34 | 1944.68 | 1761.22 | 818.25 | 1566.78 |
Overview of results
The table above has been presented so that it can be copied out to a spreadsheet if the reader wishes to do so, but it is not that easy to see what it represents. The next table displays the various percentages each of the criteria holds against the total voting 'MV'.
For this table we can make the following observations:
- The vast majority of MVESTS (held by the accounts) voting for any of the top 100 witnesses have performed some activity relating to the above criteria in the last 6 months
- 'bue' is a notable exception with 75% of the MVESTS voting for this witness having performed an activity in the last 180 days
- The activity %'s generally slide as we move from 'any activity' (MV_180_%) to a bandwidth update, witness voting, content voting, and posting.
- New witnesses of the past 6 months (correctly, phew!) show 100% in the 'MV_180_%' column
Re-ordering the top 20
To do this, we need to go back to the first table - criteria used will be 'MV_180' and 'MV_Wit_v'.
'MV_180' - Any of the criteria met
To refresh, 'MV_180' is total MVESTS owned by accounts supporting a witness that have performed any activity, of the a fore mentioned criteria, in the past 180 days.
The top 10 witnesses are unchanged using this criteria, but there are a couple of changes further down with MVESTS supporting 'lukestokes.mhth' and 'netuoso' being more active in the past 6 months than those supporting 'smooth.witness'. The MVESTS of the accounts supporting 'blocktrades' are less active than 'lukestokes.mhth', 'netuoso', 'anyx', and 'curie'.
It is possible then that 'blocktrades' holds more votes, in terms of MVESTS held, of inactive accounts than the witnesses mentioned above.
'MV_Wit_v' - Witness vote changes
'MV_Wit_v' is the total MVESTS of the accounts that have performed a change to their witness votes in the past 180 days.
Most of the top 20 are re-ordered in some way. 'jesta' regains top place, but perhaps more notable are the moves from 'lukestokes.mhth' and 'netuoso' into the top 10, and the move from 18th to 11th from 'followbtcnews'.
If we look back at the table showing the percentage 'drop-off', this confirms that less witness voting activity has taken place by the accounts voting for 'blocktrades', than the names mentioned above.
Of course, this doesn't mean that the accounts are dead/locked-out/inactive though.
Inactivity grouped by witness standings
Well, every analysis needs at least one chart ;)
The witnesses have been grouped (in original MVEST order), 20 at a time, and the percentages are averaged within these groups.
As far as 'any activity' ('180_%'), the percentages are fairly close throughout the top 100.
The witness voting activity (of the accounts holding the MVESTS) is more static within the top 20 witnesses, than any of the other groups.
The table above is also represented in this chart, in which we can see the general rise in activity with regards to voting on, and posting content as the witness ranks get lower.
Summary
For the most part, the accounts holding the MVESTS voting for witnesses are mainly active in some way.
Posting/Voting activity is associated less with the higher ranks than the lower, but this is likely to be views as less important criteria.
One more table - The top 100 witnesses ordered by the MVESTS of the supporting accounts that have made a change to their witness voting in the last 180 days.
Do 'inactive' account votes for Witnesses affect the Witness ranks?
A little, but not as much as expected?
Scripts used in the production of this report
--tbl_witness
select name, vesting_shares, last_post, last_vote_time, last_bandwidth_update, proxy, witness_votes from accounts with (nolock)
order by name desc
-- tbl_witnessvotes
select account,witness, timestamp from TxAccountWitnessVotes with (nolock)
-- tbl_witnessproxy
select account,proxy,timestamp from TxAccountWitnessProxies
---------------------------
-- All data
SET NOCOUNT ON
Declare @witness Varchar(2000)
Declare @total_SP float
Declare @mvests float
DECLARE WIT_CURSOR CURSOR FOR
select [wit] FROM [SteemSQL].[dbo].[witnesses]
OPEN WIT_CURSOR
FETCH NEXT FROM WIT_CURSOR
INTO @witness
WHILE (@@FETCH_STATUS = 0)
BEGIN
Insert into tbl_witness_all
SELECT @witness, sum(cast(left(vesting_shares, len(vesting_shares)-6) as float)*491.965/1000000)
,sum(cast(left(vesting_shares,charindex(' ', vesting_shares)-1) as float))/1000000
from [dbo].[tbl_witness]
where name in (
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
where a2.witness_votes like '%'+@witness+'%'
union
select a1.name from [dbo].[tbl_witness] a1 where witness_votes like '%'+@witness+'%'
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
where a3.witness_votes like '%'+@witness+'%'
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
where a4.witness_votes like '%'+@witness+'%'
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
inner join [dbo].[tbl_witness] a5 on a4.proxy = a5.name
where a5.witness_votes like '%'+@witness+'%'
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
inner join [dbo].[tbl_witness] a5 on a4.proxy = a5.name
inner join [dbo].[tbl_witness] a6 on a5.proxy = a6.name
where a6.witness_votes like '%'+@witness+'%'
)
FETCH NEXT FROM WIT_CURSOR
INTO @witness
END
CLOSE WIT_CURSOR
DEALLOCATE WIT_CURSOR
SET NOCOUNT OFF
---------------------------
-- MV 180
SET NOCOUNT ON
Declare @witness Varchar(2000)
Declare @total_SP float
Declare @mvests float
DECLARE WIT_CURSOR CURSOR FOR
select [wit] FROM [SteemSQL].[dbo].[witnesses]
OPEN WIT_CURSOR
FETCH NEXT FROM WIT_CURSOR
INTO @witness
WHILE (@@FETCH_STATUS = 0)
BEGIN
Insert into tbl_witness_180
SELECT @witness, sum(cast(left(vesting_shares, len(vesting_shares)-6) as float)*491.965/1000000)
,sum(cast(left(vesting_shares,charindex(' ', vesting_shares)-1) as float))/1000000
from [dbo].[tbl_witness]
where name in (
select a1.name from [dbo].[tbl_witness] a1
where witness_votes like '%'+@witness+'%'
and (
a1.last_post > getdate()-180 or a1.last_vote_time > getdate()-180 or a1.last_bandwidth_update > getdate()-180
or
a1.name in (select distinct account from [dbo].[tbl_witnessvotes] where timestamp > getdate()-180)
)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
where a2.witness_votes like '%'+@witness+'%'
and (a1.last_post > getdate()-180 or a1.last_vote_time > getdate()-180 or a1.last_bandwidth_update > getdate()-180
or
a2.name in (select distinct account from [dbo].[tbl_witnessvotes] where timestamp > getdate()-180)
or
a2.name in (select distinct account from [dbo].[tbl_witnessproxy] where timestamp > getdate()-180)
)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
where a3.witness_votes like '%'+@witness+'%'
and (a1.last_post > getdate()-180 or a1.last_vote_time > getdate()-180 or a1.last_bandwidth_update > getdate()-180
or
a3.name in (select distinct account from [dbo].[tbl_witnessvotes] where timestamp > getdate()-180)
or
a3.name in (select distinct account from [dbo].[tbl_witnessproxy] where timestamp > getdate()-180)
)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
where a4.witness_votes like '%'+@witness+'%'
and (a1.last_post > getdate()-180 or a1.last_vote_time > getdate()-180 or a1.last_bandwidth_update > getdate()-180
or
a4.name in (select distinct account from [dbo].[tbl_witnessvotes] where timestamp > getdate()-180)
or
a4.name in (select distinct account from [dbo].[tbl_witnessproxy] where timestamp > getdate()-180)
)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
inner join [dbo].[tbl_witness] a5 on a4.proxy = a5.name
where a5.witness_votes like '%'+@witness+'%'
and (a1.last_post > getdate()-180 or a1.last_vote_time > getdate()-180 or a1.last_bandwidth_update > getdate()-180
or
a5.name in (select distinct account from [dbo].[tbl_witnessvotes] where timestamp > getdate()-180)
or
a5.name in (select distinct account from [dbo].[tbl_witnessproxy] where timestamp > getdate()-180)
)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
inner join [dbo].[tbl_witness] a5 on a4.proxy = a5.name
inner join [dbo].[tbl_witness] a6 on a5.proxy = a6.name
where a6.witness_votes like '%'+@witness+'%'
and (a1.last_post > getdate()-180 or a1.last_vote_time > getdate()-180 or a1.last_bandwidth_update > getdate()-180
or
a6.name in (select distinct account from [dbo].[tbl_witnessvotes] where timestamp > getdate()-180)
or
a6.name in (select distinct account from [dbo].[tbl_witnessproxy] where timestamp > getdate()-180)
)
)
FETCH NEXT FROM WIT_CURSOR
INTO @witness
END
CLOSE WIT_CURSOR
DEALLOCATE WIT_CURSOR
SET NOCOUNT OFF
-------------------------------------
-- WITNESS CHANGES
SET NOCOUNT ON
Declare @witness Varchar(2000)
Declare @total_SP float
Declare @mvests float
DECLARE WIT_CURSOR CURSOR FOR
select [wit] FROM [SteemSQL].[dbo].[witnesses]
OPEN WIT_CURSOR
FETCH NEXT FROM WIT_CURSOR
INTO @witness
WHILE (@@FETCH_STATUS = 0)
BEGIN
Insert into tbl_witness_witness_votes
SELECT @witness, 0
,sum(cast(left(vesting_shares,charindex(' ', vesting_shares)-1) as float))/1000000
from [dbo].[tbl_witness]
where name in (
select a1.name from [dbo].[tbl_witness] a1
where witness_votes like '%'+@witness+'%'
and
(
a1.name in (select distinct account from [dbo].[tbl_witnessvotes] where timestamp > getdate()-180)
)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
where a2.witness_votes like '%'+@witness+'%'
and
(
a2.name in (select distinct account from [dbo].[tbl_witnessvotes] where timestamp > getdate()-180)
or
a2.name in (select distinct account from [dbo].[tbl_witnessproxy] where timestamp > getdate()-180)
)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
where a3.witness_votes like '%'+@witness+'%'
and
(
a3.name in (select distinct account from [dbo].[tbl_witnessvotes] where timestamp > getdate()-180)
or
a3.name in (select distinct account from [dbo].[tbl_witnessproxy] where timestamp > getdate()-180)
)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
where a4.witness_votes like '%'+@witness+'%'
and
(
a4.name in (select distinct account from [dbo].[tbl_witnessvotes] where timestamp > getdate()-180)
or
a4.name in (select distinct account from [dbo].[tbl_witnessproxy] where timestamp > getdate()-180)
)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
inner join [dbo].[tbl_witness] a5 on a4.proxy = a5.name
where a5.witness_votes like '%'+@witness+'%'
and
(
a5.name in (select distinct account from [dbo].[tbl_witnessvotes] where timestamp > getdate()-180)
or
a5.name in (select distinct account from [dbo].[tbl_witnessproxy] where timestamp > getdate()-180)
)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
inner join [dbo].[tbl_witness] a5 on a4.proxy = a5.name
inner join [dbo].[tbl_witness] a6 on a5.proxy = a6.name
where a6.witness_votes like '%'+@witness+'%'
and
(
a6.name in (select distinct account from [dbo].[tbl_witnessvotes] where timestamp > getdate()-180)
or
a6.name in (select distinct account from [dbo].[tbl_witnessproxy] where timestamp > getdate()-180)
)
)
FETCH NEXT FROM WIT_CURSOR
INTO @witness
END
CLOSE WIT_CURSOR
DEALLOCATE WIT_CURSOR
SET NOCOUNT OFF
------------------------
-- POST(or comment)
SET NOCOUNT ON
Declare @witness Varchar(2000)
Declare @total_SP float
Declare @mvests float
DECLARE WIT_CURSOR CURSOR FOR
select [wit] FROM [SteemSQL].[dbo].[witnesses]
OPEN WIT_CURSOR
FETCH NEXT FROM WIT_CURSOR
INTO @witness
WHILE (@@FETCH_STATUS = 0)
BEGIN
Insert into tbl_witness_comments
SELECT @witness, 0
,sum(cast(left(vesting_shares,charindex(' ', vesting_shares)-1) as float))/1000000
from [dbo].[tbl_witness]
where name in (
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
where a2.witness_votes like '%'+@witness+'%'
and (a1.last_post > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1
where witness_votes like '%'+@witness+'%'
and (a1.last_post > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
where a3.witness_votes like '%'+@witness+'%'
and (a1.last_post > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
where a4.witness_votes like '%'+@witness+'%'
and (a1.last_post > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
inner join [dbo].[tbl_witness] a5 on a4.proxy = a5.name
where a5.witness_votes like '%'+@witness+'%'
and (a1.last_post > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
inner join [dbo].[tbl_witness] a5 on a4.proxy = a5.name
inner join [dbo].[tbl_witness] a6 on a5.proxy = a6.name
where a6.witness_votes like '%'+@witness+'%'
and (a1.last_post > getdate()-180)
)
FETCH NEXT FROM WIT_CURSOR
INTO @witness
END
CLOSE WIT_CURSOR
DEALLOCATE WIT_CURSOR
SET NOCOUNT OFF
---------------------
-- BANDWIDTH UPDATE
SET NOCOUNT ON
Declare @witness Varchar(2000)
Declare @total_SP float
Declare @mvests float
DECLARE WIT_CURSOR CURSOR FOR
select [wit] FROM [SteemSQL].[dbo].[witnesses]
OPEN WIT_CURSOR
FETCH NEXT FROM WIT_CURSOR
INTO @witness
WHILE (@@FETCH_STATUS = 0)
BEGIN
Insert into tbl_witness_bandwidth
SELECT @witness, 0
,sum(cast(left(vesting_shares,charindex(' ', vesting_shares)-1) as float))/1000000
from [dbo].[tbl_witness]
where name in (
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
where a2.witness_votes like '%'+@witness+'%'
and (a1.last_bandwidth_update > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1
where witness_votes like '%'+@witness+'%'
and (a1.last_bandwidth_update > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
where a3.witness_votes like '%'+@witness+'%'
and (a1.last_bandwidth_update > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
where a4.witness_votes like '%'+@witness+'%'
and (a1.last_bandwidth_update > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
inner join [dbo].[tbl_witness] a5 on a4.proxy = a5.name
where a5.witness_votes like '%'+@witness+'%'
and (a1.last_bandwidth_update > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
inner join [dbo].[tbl_witness] a5 on a4.proxy = a5.name
inner join [dbo].[tbl_witness] a6 on a5.proxy = a6.name
where a6.witness_votes like '%'+@witness+'%'
and (a1.last_bandwidth_update > getdate()-180)
)
FETCH NEXT FROM WIT_CURSOR
INTO @witness
END
CLOSE WIT_CURSOR
DEALLOCATE WIT_CURSOR
SET NOCOUNT OFF
--------------------------------------
-- VOTE ON CONTENT
SET NOCOUNT ON
Declare @witness Varchar(2000)
Declare @total_SP float
Declare @mvests float
DECLARE WIT_CURSOR CURSOR FOR
select [wit] FROM [SteemSQL].[dbo].[witnesses]
OPEN WIT_CURSOR
FETCH NEXT FROM WIT_CURSOR
INTO @witness
WHILE (@@FETCH_STATUS = 0)
BEGIN
Insert into tbl_witness_votes
SELECT @witness, 0
,sum(cast(left(vesting_shares,charindex(' ', vesting_shares)-1) as float))/1000000
from [dbo].[tbl_witness]
where name in (
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
where a2.witness_votes like '%'+@witness+'%'
and (a1.last_vote_time > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1
where witness_votes like '%'+@witness+'%'
and (a1.last_vote_time > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
where a3.witness_votes like '%'+@witness+'%'
and (a1.last_vote_time > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
where a4.witness_votes like '%'+@witness+'%'
and (a1.last_vote_time > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
inner join [dbo].[tbl_witness] a5 on a4.proxy = a5.name
where a5.witness_votes like '%'+@witness+'%'
and (a1.last_vote_time > getdate()-180)
union
select a1.name from [dbo].[tbl_witness] a1 with (nolock)
inner join [dbo].[tbl_witness] a2 on a1.proxy = a2.name
inner join [dbo].[tbl_witness] a3 on a2.proxy = a3.name
inner join [dbo].[tbl_witness] a4 on a3.proxy = a4.name
inner join [dbo].[tbl_witness] a5 on a4.proxy = a5.name
inner join [dbo].[tbl_witness] a6 on a5.proxy = a6.name
where a6.witness_votes like '%'+@witness+'%'
and (a1.last_vote_time > getdate()-180)
)
FETCH NEXT FROM WIT_CURSOR
INTO @witness
END
CLOSE WIT_CURSOR
DEALLOCATE WIT_CURSOR
SET NOCOUNT OFF
-------------------------
-- FOR DISPLAY
select a.witness, a.vests as MV, b.vests as MV_180, d.vests as MV_BW, c.vests as MV_wit_vote, e.vests as MV_vote, f.vests as MV_post
FROM [tbl_witness_all] a
inner join [tbl_witness_180] b on a.witness = b.witness
inner join [tbl_witness_witness_votes] c on a.witness = c.witness
inner join [tbl_witness_bandwidth] d on a.witness = d.witness
inner join [tbl_witness_votes] e on a.witness = e.witness
inner join [tbl_witness_comments] f on a.witness = f.witness