The summer and fall of 1838 were times of increasing tensions both within and without the Church. Internal dissent originating in the Kirtland banking crisis of late 1837 bled into 1838, and Missourian opposition to the increasing Mormon population in northern Missouri was rising to a boiling point. During the ensuing months, these tensions led to the outbreak of violence between Mormons and non-Mormons, a conflict in which neither side was guiltless, and one that resulted in the expulsion of the Latter-day Saints from Missouri in winter 1838-1839. Any discussion of Mormon vigilantism during this period must be framed within the context of what historian William G. Hartley [following Juanita Brooks] has called war hysteria.
In June 1838 Mormon vigilantes formed an extralegal organization that came to be known as the Danites, apparently with the full knowledge and support of Church leaders Joseph Smith and Sidney Rigdon. Scholars have suggested that the Danites existed as an organization from late June to October 1838. Their existence can be divided into three (or perhaps four) rough time segments.
1) June-July 1838: The Danites served as internal regulators, intimidating (and expelling) dissenters from Far West, Missouri, as well as regulating efforts to consecrate properties and voting patterns among the Saints.
2) August-September 1838: The Danites aggressively worked to defend the Latter-day Saints against anti-Mormon vigilantes.
3) October 1838: The Danites participated in offensive attacks against non-Mormon settlements (which were largely abandoned by this time).
4) Alex Baugh suggests a fourth phase where the Danites became a rogue organization and indiscriminately destroyed and stole non-Mormon property.
Phases 3 and 4 are problematic due to overlap with another organization, the Army of Israel, the origins of which are not as clear as the Danites. The leading thinkers on the Mormon War (Gentry, LeSueur, and Baugh) agree essentially that Joseph Smith knew and approved of Danite activities during the first two phases. LeSueur argues that Smith approved and even directed Danite activities during all of October 1838. Baugh accepts that Smith approved initial and selective actions during October, but argues that Smith was not aware of indiscriminate activities later in the month. It is generally agreed that the Danites did not continue as an organization after the expulsion of the Mormons from Missouri in winter 1838-1839, although anti-Mormons continued to raise the specter of the Danites or Destroying Angels throughout the nineteenth century.
In all historical topics (especially controversial issues, like the Danites), historians rely on primary sources that are imperfect representations of the past. Much of what we know about the Danites comes from writers that left the Church during or after the crisis of 1838, and as such the sources should be treated with some skepticism. Mormon sources should also be treated with care, as many leaders, including Joseph Smith, when faced with anti-Mormon propaganda, later disavowed all personal knowledge of the Danites and/or dismissed them as a rogue organization. Wading through these sources can therefore be frustrating work. Among the few contemporary sources (from summer/fall 1838) that describe the Danites in a manner friendly to the Church is Joseph Smith’s 1838 journal, known as the Scriptory Book.
The Scriptory Book is not a perfect source. It was not written by Smith himself, but rather by the General Church Recorder, George Robinson. Robinson was partial to the Danites and was even a Danite officer. Despite these limitations, the Scriptory Book is the most authentic source that historians have that confirms that the Danites were approved of and supported by Smith and other Mormon leaders, at least during the period from June to September 1838, at which time Robinson ceased recording entries in the journal.
Reproduced here are the three references to the Danites from the Scriptory Book, with my commentary in the footnotes.
July 8, 1838
The following Revelation [D&C 118] was given in Far West Mo. July 8th. 1838. And read this day in the congregation of the saints,
Revelation Given to the Twelve Apostles July 8th 1838 in Far West Mo in the presence of Jsmith Jr. S, Rigdon, H, smith, E, Partridge I, Morl[e]y J[ared], Carter, S, Avard T,B, Marsh & G, W, Robinson 
July 27, 1838
July 27th some time past the bretheren or saints have come up day after day to consecrate, and to bring their offerings into the store house of the lord, to prove him now herewith and se if he will not pour us out a blessings that there will not be room enough to contain it, They have come up hither [p. 60] Thus far, according to the ordr of the Dan-Ites, we have a company of Danites in these times, to put to rights physically that which is not righ[t], and to clense the Church of verry great evils which hath hitherto existed among us, inasmuch as they cannot be put to rights m by teachings & persuaysons, This company or a part of them exibited on the fourth day of July|.|
They come up to consecrate, by companies of tens, commanded by their Captain over ten. 
August 7, 1838
Tuesday the 7th This morning an alarm come from Galliton [Gallatin] the County seat of Davis [Daviess] County. that during the Election on yesterday at that place some two or three of our bretheren were killed in consequence of the Malignity of the Missourians, it was reported that the citizens of Daviess County who were opposed to our religion, did endeavor to prohibit the bretheren from voting at the election in that place, and that, the men who were killed were left upon the ground and not suffered to be intered, and that the majority of that county were determined to drive the [p. 65] bretheren from the county, under these conciderations quite a number of us volunteered to go to the assistance of our bretheren in that place accordingly some 15 or 20 men started from this place armed and equipt for our defence the bretheren from all parts of the County, followed after and continued to come and join us, and before we arrived at Col. Wights we had quite a large company Prest.Smith and Rigdon and H Smith, alll the first presidency, General [Elias] Higbee Gen. [Sampson] Avard myself and may others to tedious to mention at this time or in this record, were in the company 
 See Hartley’s excellent My Best for the Kingdom: History and Autobiography of John Lowe Butler a Mormon Frontiersman (Salt Lake City: Aspen Books, 1993), chapters 4-7.
 The literature on the Danites is fairly extensive. I’m listing here major dissertations/books that treat the Danites in chapters. There are also significant articles that upon request I can list as well. See Leland Homer Gentry, “A History of the Latter-day Saints in Northern Missouri from 1836 to 1839,” (PhD. Diss., Brigham Young University, 1965), reprinted in Dissertations in Latter-day Saint History (Provo: Joseph Fielding Smith Institute and BYU Studies, 2000), 115-30; Stephen C. LeSueur, The 1838 Mormon War in Missouri (Columbia: University of Missouri Press, 1987), references throughout; Alexander L. Baugh, “A Call to Arms: The 1838 Mormon Defense of Northern Missouri,” (PhD. Diss., Brigham Young University, 1996), reprinted in Dissertations in Latter-day Saint History (Provo: JFSI and BYU Studies, 2000), references throughout, see esp. 36-46.
 Dean C. Jessee, ed., The Papers of Joseph Smith, 2 vols. (Salt Lake City: Deseret Book Company, 1992), 2:256. Joseph Smith, Sidney Rigdon, and Hyrum Smith comprised the First Presidency. Edward Partridge and Isaac Morely were members of the Missouri bishopric. Jared Carter and Sampson Avard did not hold any ecclesiastical offices that I am aware of, but both were major figures in the Danite organization. Marsh was the President of the Quorum of the Twelve Apostles. George W. Robinson was General Church Recorder and a Danite officer. This is the least revealing of the three entries, as the entry does not tell us why the people mentioned were present. Given the high profile positions of the majority of the individuals mentioned, it suggests that the Danites in early July 1838 were not considered to be a rogue organization, but held the approval of the leading brethren in the Church.
 Jessee, Papers, 2:262. This is the only time that the word Danites is recorded in the Scriptory Book. The entry suggests that 1) The Danites facilitated the consecration of property by Church members. 2) The Danites were known by this time as an organization that cleansed the Church of great evils that were not corrected by persuasion, likely a reference to the dissenters. 3) The Danites were part of the 4th of July parade (the same day that Rigdon gave his infamous 4th of July speech). This suggests that they had legitimacy at this point. 4) The Danites were organized according to the biblical pattern of companies of tens with captains over ten.
 Jessee, Papers, 2:268. On 6 August non-Mormons tried to stop the Latter-day Saints in Daviess County, Missouri from voting. A scuffle ensued, and, as mentioned in the entry, rumors spread to Far West (in Caldwell County) that a few Mormons had been killed with their bodies left in the streets without burial. Upon hearing the rumors, Danite leader Sampson Avard called for volunteers in Far West and commenced a march to Mormon leader Lyman Wight’s home in Daviess County. Robinson here records that the First Presidency marched with the company, as well as Generals Elias Higbee and Sampson Avard. Neither Higbee nor Avard were generals in the state militia, suggesting that there were acting in their roles as Danite Generals.