🚀 What happens when we merge Stellar accounts?

Did Alice account gone or still there? Did Bob still Bob? moon?

when moon!?

Questions

  1. Will we lost replaced account history?
  2. Can we merge activated account to unactivated account?
  3. Did Alice data merge to Bob data? Overwrite Bob data?
  4. Can we merge multi-sig account with activated account? How?
  5. Can we merge multi-sig account with multi-sig account? How?
  6. Can we prevent account from merging? How?
  7. (Form reddit) What happens with issued assets if you remove the issuer by merging?

Let’s find out! Now go to Stellar lab for test net and funding the accounts.

Create Alice account (+10,000XLM)

Public Key GA3TMHASYEZAFGGPVHVRQJSEVSYTJPMI5P32SAZZG5WZ262T5JJ6YYUX
Secret Key SA53NUOKSV3Y247ICLWFZNH3N5JP7JYGLA63UWSDF4XQFY6LQCOSNX6Y

Create Bob account (+10,000XLM)

Public Key GC2BPTOTVQ7UMPC2WYUPP3ABQZBSBV6D2YLARYBQYRSQLFMQJ66IRGE4
Secret Key SAQVRSJTSNO4CILPXXVR3KG6YMD5Y56IR3XUM5EH4JQHMMHMB4ANSZXI

Create Cat account (+10,000XLM)

Public Key GAGPBFTZFMTG7FWREWH2IDN263GXGILUC4LEFLN3BLLSTUCMWMC6WULU
Secret Key SBJNNYJQLTXZFUALBDC5E2QZAPV3JSDCJOIHYXBQXYUP5JDKF6GMTIIS

Question #1 — Will we lost replaced account history?

Let’s make some history by make a payments with 2 operations

  • 1,000 XLM from Alice to Bob with “FOO” as memo
  • 1,000 XLM from Alice to Cat with “FOO” as memo
ref

And another payment from Alice for Cat

  • 500 XLM from Alice to Cat with “BAR” as memo
ref

Then merge Alice to Bob

Results (ref)

Alice is dead
Bob kill Alice
Cat still see Alice account

Answer #1

Alice account appear 404, Bob take all money, Cat still remember Alice ID but she is gone…poor Alice. All history attach to her is gone (not true! see update from reddit below) but history on other account still remain.

UPDATE : Alice account is gone 404 but her history still there forever, yeah! Alice history is here https://www.stellar.org/laboratory/#explorer?resource=effects&endpoint=for_account&values=eyJhY2NvdW50X2lkIjoiR0EzVE1IQVNZRVpBRkdHUFZIVlJRSlNFVlNZVEpQTUk1UDMyU0FaWkc1V1oyNjJUNUpKNllZVVgifQ%3D%3D&network=test

Question #2 — Can we merge activated account to unactivated account?

Let see…

Create Dog account (0 XLM)

Public Key GATZLBQUVOIDL24HOHAMTVCNM5YHZJHIWVUNKOWSB2TPSYCH4NFNLTRE
Secret Key SAVHUVVZGMXQE4EXLJ7CFENTZMKZNWZV536MRSGQH6UOR4R4S4FYIKH2

Then merge Bob to Dog

ref

Answer #2

Bob refuse to merge with empty Dog and return op_no_account, wise choice Bob!

Question #3 — Did Alice data merge to Bob data? Overwrite Bob data?

Here’s Alice

Public Key GARQGJEDJGMRYNVZGBF7PON4HNCGGYR23NMPUXBXXX3AX2CIZ5Z2MRSM
Secret Key SCJZUWZL42UXT34JCHXWF7CE5NKD7TYSPKKQHANYWCEPJZZJVYZECATE

With her data

Appear as “YmFy” which mean “bar” in base64

And Bob

Public Key GAHQG767G5WR66W7W2WZ7ZR6DDDJXWUOY3SHIJT3OWPGQF5EMK7MQ6W4
Secret Key SD7OWHLU5GD4J4WLUOLK22TOYA3C3BBQ3LTHAINDOHI5NHYPRA25V2E2

With his data

baz

Then merge Alice to Bob

Aww

Answer #3

Bob refused to get merge and return op_has_sub_entries and we will need to clean Alice subentries (trustlines, offers, data) first!

“subentry_count”: 1

TODO

For question 4, 5, 6, 7 You’ll need to figure it out by yourself or donate below to let me reveal the answers 🚀, all donation belong to my cats food! 🐈

GDI6FBVJSHMF5PF6C7DDM57NAGYTYWMQQW2A6BVA6DTS2ZL7ZDRZBI2S
Like what you read? Give katopz a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.