Blog Article

RPCiege: The Story Thus Far

Author

Bri Wylde

Publishing date

Soroban

Rpciege

Stellar quest

Ah, reader. Wonderful of you to join us. You have entered this tavern on a fortuitous occasion, for today I will recount the tale of RPCiege. Grab a drink and settle in. But be forewarned, our story is not for the faint of heart.

Ahem.

*strums guitar*

Please take a seat and bend an ear,
A tale you’re about to hear,
Of battles fought and battles won,
Of coding challenges overcome.

Of brave developers armed with smarts,
Of contracts made of many parts,
Of woe and torment and triumph and grit,
Of strength of mind and power of wit.

Listen to my story today,
And maybe, just maybe, you’ll want to play.

What is RPCiege?

Ah, I’m so happy you asked this, dear traveler.

RPCiege is the given name for a series of small coding puzzles (called skirmishes) that teach the fundamentals of Rust and Soroban smart contract development. Each successfully completed skirmish earns the player a pack of digital collectible playing cards as proof of a battle won.

There have been seven notable challenges to date, five in the first round and two (so far) in the second. RPCiege is a great place to get started or sharpen your skills with Soroban and delivers Rust basics in a bite-sized format.

*strums guitar*

Each bout faced had its own test,
That all defiers had to best,
Invoked contracts, returned strings,
Each answer like an ax’s swing.

The skirmishes

Round 1

Round 1 of RPCiege found our heroes facing off against ruthless overlords who ruled their territories with tyranny and warfare. Only through writing, deploying, and invoking smart contracts with Soroban could players defeat the enemy and bring peace to the land.

Skirmish 1: Invoke a smart contract

The first skirmish started out easy and just tasked players with submitting a contract invocation. You can’t fire a cannon without learning how it works first — demonstrating the basics of smart contract deployment and invocation prepared our heroes for success in subsequent battles.

Skirmish 2: Strings

Skirmish two introduced players to a new tool for battle: string types. Developers were asked to create and invoke a contract that returned a string, bringing awareness to this new type that would be used in ensuing challenges.

Skirmish 3: Testing before deployment

Skirmish three found our players delving deeper into enemy territory, where their Rust fundamentals were put to the test. From byte arrays to loops to cryptographic hashing functions, this battle tested our heroes relentlessly. Players discovered that testing and debugging contracts before deployment was the best way to ensure efficiency and success.

Remember, only fools charge head-first into battle without testing their strategies first.

Skirmish 4: Find on-chain data with the RPC

Swinging swords and firing crossbows is not always the best way to win a battle.

In the fourth skirmish, our heroes used their wits to meddle with a territory’s supply chain. First, they needed to gather some information: the storage value and event value that were emitted on the Stellar blockchain. Using the Soroban RPC, they were able to look up this data on the network and use it to severely disable an overlord’s army.

Skirmish 5: Callback functions

In the final skirmish of Round 1, our heroes defeated the final boss and discovered how easy it can be to make simple mistakes with potentially devastating consequences.

In this challenge, players deployed a liquidity pool contract, deposited assets into it, and discovered a flaw in the contract’s code that allowed it to steal their funds. Luckily, our heroes were able to, in turn, find vulnerabilities in the malicious contract to get their funds back. This challenge taught our players a valuable lesson in a fundamental blockchain concept: callback functions.

*strums guitar*

Our heroes knew sweet victory,
After struggle and toil and strife,
They laughed and danced and partied,
Long into the night.

But lo, what’s that? Did you hear?
That moaning, groaning sound?
It is precisely as I feared,
It’s coming from the ground.

Round 2: Midnight Madness

Round 2 of RPCiege found players tested yet again, this time by a different type of monster. The fall of the land’s ruthless overlords only made room for ghouls, zombies, and werewolves galore! And because our heroes are, well, heroes. There was only one thing to do.

Skirmish 6: RNG, invocation timing, and execution variables

Skirmish 6 tasked our heroes with capturing these terrifying beasts as they arose from the ground. Players set traps based on pseudo-random numbers derived from known execution variables (ledger sequence and timing). They then triggered nightfall, which unleashed the monsters. If the traps were configured correctly, they would capture the scourge and all would be well.

If not, well, our heroes would have the decimation of an innocent village on their conscience.

Skirmish 7: byte array filtering and sorting

In the next skirmish, players had to deal with a compromised water supply that started turning villagers into undead menaces. Developers were given a random byte array and they had to cleanse the well by writing a purifying contract to filter out all of the composite numbers and then order the remaining numbers from lowest to highest.

Efficiency was the roadblock in this challenge with many brave players encountering resource limitations on their way to success.

*strums guitar*

That concludes the seven tasks,
Our heroes did complete,
Now, please, raise your glass,
To these glorious feats!

But don’t get comfy yet, ya hear?
Here monsters still reside,
Gather up your coding gear,
Let’s get these monsters fried!

Skirmish 8

The eighth skirmish of RPCiege is on the horizon. Jump in right at Skirmish 8 or prepare thyself by playing all previous RPCiege skirmishes from the RPCiege booklet. The leaderboards for each challenge are open! So get in there, knock some people down a peg, and collect some sweet playing cards in the process.

Speaking of playing cards, you can show off your hard-earned cards in this deck display tool, built by one of RPCiege’s greatest warriors, vinamo (who even had this card created after him).

And shout out to the infamous Row-Bear for finding several bugs in our RPCiege booklet. Look, he got a card too!

And, as always, questions are answered and rousing conversations are had in the coding games channels in the Stellar Developer Discord.

*strums guitar*

I thank you for your listening ear,
It’s time to say goodnight,
Sign up for the mailing list here,
To learn more about the fight.