The AllSpark, also known as the Cube, is an ancient relic from the Transformer's homeworld, Cybertron that gives them life.It shows that the Allspark can give a life and a spirit to an machinery and technology if it comes in physical contact with it.
It is completely unknown as to where the AllSpark originally was upon the time of its creation, although it is true to say that it was created by a mysterious power for unknown advantages. The Allspark was also greatly known for creating the planet Cybertron and its sentent robotic inhabitants, known as Transformers. The Allspark also created the Dynasty of Primes and the Matrix of Leadership before The Fallen gained posession of it. Lastly, the Cube created the Transformers to work for them all.
Many generations later during the time in which the great Cybertronian War occurred, the Autobots went into a ferocious and lethal battle with the Decepticons. Optimus Prime, as a final hope, launched the Allspark into the far reaches of outer space in order to prevent the Decepticons from taking it. However, Megatron tracked the Allspark until he crash-landed on Earth unexpectedly at around 10,000 BC. The area where he landed at would later become the Colorado River in the 20th century.
Nearly ten-thousand years later, the Cube was discovered in the River in specifically 1913. This led the president of the time to have the Hoover Dam built to conceal both its actual presence on Earth and to hide the energies radiating from it that would have allowed any "aliens" to come looking for it. Sector Seven, in the meantime, made themselves useful in the situation by studying the Allspark and its abilities. They soon realized that the Cube released radiation that could bring nonliving machines and technological devices to life. Anything outside of this classification was physically impossible to be morphed.
Nearly a century until the Allspark had been discovered by the human race, the Decepticons finally came to Earth in 2007. The Hoover Dam went under a vicious attack from the Decepticons, and in a desperate effort to hide the Cube, Bumblebee managed to somehow interact with the Allspark in order to make the Allspark much smaller then its colossal form in the Dam. Now that the Cube was much smaller, Sam was able to transport it around easier.
The Decepticons continued their journey after the Allspark, with a battle ensuing on a highway between Optimus himself and Bonecrusher - which lead to the Decepticon's death. Thanks to Optimus, Bumblebee (with Sam and Mikaela inside) successfully evaded the Decepticon before he could seize the Cube. The AllSpark was soon taken to Mission City where Sam was ordered by Lennox to take it to the rooftop of a building where a helicopter would take it out of the city and supposedly take it out of the city from there. As Sam ran through the city and toward this building, Ironhide and Ratchet followed him and guarded him to prevent any Deceptions from making attempts to take the Cube. Yet as he went on, Blackout intervened only for a split-second and backed down when the two Autobots bumped in. Yet Starscream soon found the Cube as well and nearly claimed it, but Ironhide and Ratchet stopped him. However, the two Autobots were too weak to keep following Sam. Therefore, he continued running toward the building yet accidently tripped in the process. When the Allspark made impact on the sidewalk, its energies began to radiate everywhere and various items were brought to life unexpectedly.Sam ignored the Cube's actions and finally made it to the building, yet a newly-freed Megatron began to follow him. Sam ran up many stairwells until he reached the rooftop, where several helicopters awaited his arrival. Just as Sam was handing one of the co-pilots the Cube - Starscream fired a missile that annhilated the helicopters. After the helicopters crashed to the streets below, Megatron reached the rooftop and confronted Sam. After a brief offering of Sam to survive if he gave Megatron the Cube, a decision was made. Megatron used his wip to destroy the pillar Sam was standing on - sending him stumbling off of the building. Luckily, Optimus managed to catch Sam and helped him safely to the ground. He then began to battle Megatron, and in the process Optimus told Sam to shove the Cube in his chest to merge it with his very Spark. This was so that the Cube would be destroyed and the Decepticons would ultimately leave Earth. Yet Sam disregarded Optimus's commands and merged it with Megatron's Spark. With several violent jerks, Megatron fell to the ground dead, with the Cube having destroyed Megatron and the Cube itself also having been destroyed as well.
Even though the Allspark was gone, two shards of it were taken from the site of Megatron;s demise and some of the Cube's power remained. One had been obtained by Optimus, the other by Sam. Optimus's shard was kept at Diego Garcia under a large amount of security systems. The other shard remained in Sam's jumper sweatshirt that he wore during the Mission City battle. Sam's sliver remained in one of the jumper's pockets for two years, undiscovered.
In 2009, two years after the destruction of the Allspark, Sam found the fragment that he had been in posession of in his shirt when he was scouring around his bedroom. When Sam began to look over the shard, it transferred the knowledge belonging to the members of the Dynasty of Primes into Sam's own mind. Coming back to his senses, Sam dropped the cube and it burnt through the floor and landed on the kitchen table. A burst of pure energy brought the kitchen appliances to life - all of which were later destroyed by Bumblebee.
Sam gained posession of the shard soon after firefighters arrived on the scene, and gave it to Mikaela for her to hide. From that point on, it is not known as to what happened to Sam's shard, though at some point NEST may have taken it into their own safekeeping.
Optimus's shard, in the meantime, was stored by NEST at Diego Garcia to the point in which [[Soundwave[[ discovered its exact location there. He released Ravage to go out and retrieve the sliver, along with many small marble-like robots inside of Ravage (possibly Insecticons). At the base, Ravage released the robots so that they could combine into a razor-thin being known as Reed Man. Reed Man successfully escaped NEST's forces and left Diego Garcia alongside Ravage. Reed Man disentegrated into the smaller marble bots, and Ravage obtained them all and traveled to the Laurentian Abyss - where several Constructicons and him located Megatron. Ravage released Scalpel to revive Megatron, and the smaller Decepticon did so by shoviung the sliver into Megatron's chest. This resurrected the Decepticon tyrant, and at that point both of the slivers had been destroyed.