Scientists in the US gave octopuses ecstasy — for a good reason.

They discovered fascinating insights into how social behaviour is coded, and traced its biological roots to a common ancestor of ours that lived around 500 million years ago.

The work, led by neuroscientist Gul Dolen from Johns Hopkins University, was published today in Current Biology.

Because brains are soft and mushy, they tend to be eaten or decay long before they can be fossilised and preserved.

This means we don't really have any physical evidence of how our brains have developed over time.

So researchers must think laterally — and come up with ideas like giving 3,4-methylenedioxy-methamphetamine or MDMA, commonly called ecstasy, to octopuses.

Why give ecstasy to an octopus?

Ecstasy works, in part, by flooding the brain with a chemical called serotonin.

Among its effects, this makes people more sociable than normal.

But octopuses mostly prefer a lonesome life — they're not known to socialise with each other outside mating.

So the question was: if serotonin encodes social behaviour in people, would it have the same effect on octopuses?

Or to put it another way, if you give ecstasy to an octopus, would it be telling its friends it loved them at three o'clock in the morning with eight lollipops in its tentacles?

And if we better understand how social behaviour is coded, can that help us to fix things when they go awry in people?

How much ecstasy do you give an octopus?

If you've never given ecstasy to an octopus, working out the proper dose — and how to administer it — is the first hurdle.

Octopuses breathe by flushing water across their gills, like a fish.

So Dr Dolen and her colleagues added ecstasy to a beaker of water and gave a species of octopus, Octopus bimaculoides, a 10-minute bath.

"I have to admit that it was totally trial and error. Honestly, I just didn't think this was going to work, so we started out at super high doses," she said.

"But the animals went through this hyper-vigilance where they were perched at the top of the tank like a hawk trying to watch a mouse or something."

Surprised by the octopuses' sensitivity to the drug, the researchers scaled back the dose.

"When we gave them the dose that you'd give a human, but adjusted for body weight, they started acting just like you'd expect a human to," Dr Dolen said.

Once suitably dosed, it was experiment time.

The setup consisted of a tank with three chambers linked by small openings that a test octopus in the centre chamber could move through.

The octopuses spent more time in the chamber with the other octopus after being given MDMA. ( Johns Hopkins University: Gul Dolen )

An object such as a flower pot was placed in the left chamber and another octopus trapped in the right.

Without ecstasy, test octopuses spent significantly more time in the chamber with the object. But with ecstasy, they became more social, preferring the chamber with the other octopus in it.

And the nature of the interactions between octopuses changed too.

Before a dose of ecstasy, social interactions were "limited, usually to one extended arm", the scientists wrote in the paper.

"After MDMA treatment, social interactions were characterised by extensive ventral surface contact, which appeared to be exploratory rather than aggressive in nature," they said.

The researchers also developed a system to quantify octopus behavioural changes after being given ecstasy.

Unfortunately, some behavioural changes were outside the scope of classification.

"They were really interested in touching; instead of reaching out with one arm, they'd reach out with six to handle the flowerpot, and they looked more relaxed in their posture," Dr Dolen said.

"Another octopus was doing backflips and looked like he was playing in the water, but we don't have good ways of quantifying that."

So what does getting octopuses high actually tell us?

From these early results, and a sample size of four octopuses, the researchers believe that serotonin does encode their social behaviour.

Although octopuses are generally solitary animals, Zoe Doubleday from the University of Adelaide, who was not involved with the study, said they quickly adapt to different environments.

"Even when you work with octopuses in tanks, they all have quite different personalities," Dr Doubleday said.

A group of around 15 octopuses were discovered last year living in an octopus "city", nicknamed "Octlantis", in Jervis Bay on Australia's east coast.

Dr Doubleday said it was possible octopuses are more social than we think, but they require certain environmental triggers to display that behaviour.

Although there probably needs to be more research to conclude that serotonin produces a social response, she said there was little question of the effects of alcohol on octopuses.

"We use alcohol as an anaesthetic. Alcohol knocks them out," she said.

Dr Dolen and her team also delved into the octopus genome to find clues of social behaviour.

In humans, the SLC6A4 gene encodes a protein that transports serotonin. This protein is targeted by ecstasy, which increases the release of serotonin in the brain and blocks its reuptake.

And it turns out octopuses have something similar. Dr Dolen and her team identified a SLC6A4 ortholog — a gene that has retained the same function in the octopus.

They said they believed social behaviour was present in our common ancestor more than 500 million years ago but was "switched off" in octopuses.

There is currently a renaissance in research into the potential benefits of psychotropic drugs such as ecstasy, LSD and psilocybin, the compound found in hallucinogenic mushrooms.

Ecstasy has been shown to potentially help in the treatment of post-traumatic stress disorder, and psilocybin in the treatment of depression and anxiety disorders, for instance.

Dr Dolen's lab is investigating how the brain encodes social behaviour, and how that relates to autism and schizophrenia.

If MDMA switches on social behaviour in octopuses, further research may yield insights into how those processes work, she said.