SpankBank v0 Guide

SpankChain
SpankChain
Published in
10 min readSep 1, 2018

Today we are incredibly excited to announce that we’ve launched the SpankBank v0. The smart contracts have been deployed to Ethereum mainnet and the staking UI is up at bank.spankchain.com.

Deployment Transaction Link

SpankBank Contract Link

Here’s what you need to know:

  1. While the smart contracts are complete, the UI still needs some work. Notably, only the staking is functional at the moment, the rest of the SpankBank Explorer (viewing other staker profiles, historical data, analytics, etc…) will be coming in the next few weeks.
  2. You can stake your SPANK any time during the next 30 days of period 0 in order to participate in the inaugural SpankBank period. The next period, period 1, will start on Friday October 5th, at 4:39:22 AM.
  3. BOOTY goes live in 30 days. The initial supply of BOOTY is 10,069, and will be airdropped at the beginning of period 1 to all period 0 stakers, proportional to their SpankPoints (derived from the SPANK staked and the length of the stake, more on this at the end of this post).
  4. We are timing our next camsite update to coincide with the BOOTY airdrop in 30 days, and it will enable tipping in BOOTY. In BOOTY we trust.
  5. While we rigorously tested the SpankBank smart contracts and code, we’re not omnipotent gods. If you find any bugs or anything that you think might be a bug, please let us know and we’ll fix it ASAP.

How to stake your SPANK

Below are a series of screenshots where I (Ameen) staked my SPANK. I didn’t do everything perfectly in order, but if you follow along I’ll walk through all the details.

If none of this makes any sense to you, or you’re newly discovering the project, FEAR NOT. Our wonderful community manager Chase put together a great overview of the two-token SPANK + BOOTY economy we’ve built that you can start with.

It is time. My SPANK is ready.

So first I went to the SpankBank Explorer at bank.spankchain.com and clicked the “Stake your SPANK” button at the bottom. Then I noticed that the little gray “Max:” wasn’t properly loading and I realized that I hadn’t connected to my MetaMask account.

I clicked the “Connect to MetaMask” button and the button turned pink and confirmed the connection.

Once I connected my MetaMask, the “Max:” was properly populated with the total SPANK I had in my wallet. I decided to stake 350,000 SPANK for 12 months, the maximum staking time.

One thing to note is that 1 SpankBank period = 30 days, not quite 1 month. Perfectly aligning periods with months in Solidity was more trouble than it was worth so we decided to skip it. This means that even though periods will roughly track calendar months by virtue of starting on Sept 1st, they will eventually start to end a few days before the end of the month as we progress.

Before moving on, I clicked on the “Settings” button.

Optionally set your Delegate Address and Booty Address from the staking settings.

From the Settings, you can optionally set your Delegate Address and Booty Address. As a staker, you are required to checkIn once every period in order to be eligible to claimBooty for the next period. We wanted to give stakers who prefer additional security the option of keeping their main staking account in cold storage, and instead use a separate delegate account to checkIn and claimBooty . We also wanted to give stakers the option to set a separate Booty Address — the destination address for their claimed BOOTY—both for convenience (e.g. so you can set it to your SpankPay account) and for increased security (e.g. in case your delegate account gets hacked, the hacker would also need to get your Booty account in order to claim and steal your Booty).

If you decide to use a different Delegate Address or Booty Address, you’ll still need to send ETH to your Spank Address—that’s the one which initiates the transaction and needs to pay the gas fees.

In my case I decided to skip all that, stick to the defaults, and use my MetaMask account as all three addresses.

If I change my mind later, I can update the delegate and Booty addresses… as soon as we ship the interface for that :)

One other thing to know at this stage is that you can only ever stake once from a specific staker account. Staking addresses and delegate addresses must be unique to a specific staker, so if you stake once (e.g. to test), you’ll have to use a separate account to stake again. You can however use the same Booty Address to receive your BOOTY in one place across multiple stakers you control.

Look before you leap!

Once I clicked confirm I see another popup confirmation screen which shows me how much SPANK I’m getting ready to stake and for how long.

Yes. Let’s do this. I hit stake.

Now for the MetaMask confirmation.

Once I hit stake, I see the familiar MetaMask confirmation popup window. If you look closely above the $0.00 USD amount you’ll notice that the transaction is an “ApproveAndCall” and the address is not actually the SpankBank contract address, but instead the SPANK ERC20 token contract address. This is fine. The short answer here is that this saves the user from having to execute (and wait for) an extra transaction to the SPANK ERC20 contract first to “approve” the SPANK amount they want to stake. Instead, we combine the “approve” and “stake” into a single transaction by sending the staking parameters as a payload to the SPANK ERC20 “ApproveAndCall” function, which forwards them along to the SpankBank contract on your behalf. Nifty.

Because I’m impatient, I clicked “edit” above the “Gas Fee” and switched it over to 20 gwei from it’s default of ~3 gwei so the transaction would get mined more quickly. Then I clicked “save” and then confirmed the transaction.

Once I confirmed the MetaMask transaction, the confirmation popup in the SpankBank explorer displayed the transaction ID, which I could click on to show the transaction on etherscan.

After a few moments my staking transaction was confirmed and after refreshing the page, I was able to see my active stake and some basic analytics.

I’m not going to lie, it feels pretty good to be the genesis staker.

And that’s all there is to staking! Cheers!

Wait don’t go I still have a lot of questions!

Okay. So now you’ve seen how to stake, but we haven’t gotten into all the details about how this whole SpankBank actually works. Let’s do that now.

What is this all about?

You stake your SPANK to earn BOOTY. Okay that part you understand.

How much BOOTY will I earn?

Answering this requires a bit of background into how the SpankBank manages BOOTY issuance.

Our SpankBank driven economy.

Every month, all the fees that SpankChain collects we send as BOOTY to the SpankBank to be counted and burned (eliminated from the total supply). At the beginning of each new period, the SpankBank will issue new BOOTY only if the total BOOTY supply is less than the target BOOTY supply, which is 20x the previous period’s fees.

If let’s say there are 20,000 total BOOTY in circulation, and in a given period 20,000 BOOTY is transacted on the SpankChain camsite (some BOOTY would be re-used and spent multiple times), we would take our 5% cut (1,000 BOOTY), and send it to SpankBank where it would be counted and burned, leaving only 19,000 BOOTY remaining. The target supply would then be 20 x 1,000 BOOTY in fees= 20,000 BOOTY, and so 1,000 new BOOTY would be minted to get from 19,000 to 20,000 BOOTY and it would be distributed to all SPANK stakers proportional to their SpankPoints.

Now to explain SpankPoints. Stakers are rewarded with extra BOOTY for staking for additional periods. The SpankPoints for each staker are calculated as the amount of SPANK staked multiplied by the staking factor. The staking factor ranges linearly from 100% if staking for the maximum length of 12 periods, to 45% for staking the minimum length of 1 period. So 50% for 2 periods, 55% for 3 periods, etc…

So let’s say there are only two stakers, Alice and Bob, each with 100 SPANK staked. Alice stakes for 12 periods while Bob stakes for only 2. This means Alice has 100 SPANK * 100% = 100 SpankPoints, and Bob has 100 SPANK * 50% = 50 SpankPoints. Now, Alice and Bob would each receive BOOTY equal to their fraction of the total SpankPoints for the period. The total SpankPoints would be 100 Alice + 50 Bob = 150 total. If we plug this into our last example and distribute the 1,000 newly minted BOOTY among these two stakers, Alice would receive (100 / 150) * 1,000 = ~667 BOOTY and Bob would receive (50 / 150) * 1,000 = ~333 BOOTY.

Bootstrapping the SpankBank

As mentioned earlier, we set the initial BOOTY supply to 10,069 which roughly matches 20x the fees we would have collected if we charged 5% on this past month’s transactions. Because we can’t collect fees in BOOTY until we have BOOTY, we decided to bootstrap (or should we say… bootystrap?) the SpankBank by issuing the initial BOOTY supply to ourselves, and then distributing it through an airdrop at the beginning of next month to all stakers based on their SpankPoints. So if you stake for longer, you’ll start out with more BOOTY.

What else can this thing do?

The SpankBank has several other features, which we explain in detail in the documentation, but will cover briefly here:

  • checkIn — Used by stakers to establish their eligibility for receiving BOOTY for the next period. Can also optionally extend the staker’s ending period.
  • claimBooty — Used by stakers to withdraw their share of the BOOTY minted for a previous period.
  • withdrawStake — Used by stakers to withdraw their staked SPANK after their stake’s ending period has passed or after the SpankBank has been closed via voteToClose.
  • splitStake — Used by stakers to transfer some of their staked SPANK (up to 100%) to a new address. Can only be called before the staker checks in for a period.
  • voteToClose — Used by stakers to close the SpankBank and be able to withdraw early (e.g. in case of catastrophic bug or planned upgrade). If stakers accounting for more than 50% of the staked SPANK call voteToClose in the same period, the SpankBank will immediately transition to a "closed" state and allow stakers to withdraw early.
  • updateDelegateKey — Used by a staker to update the delegateKey account which they use to checkIn and claimBooty.
  • updateBootyBase — Used by a staker to update the bootyBase account at which they receive the BOOTY they claim.

Once we upgrade the SpankBank Explorer UI we’ll create a follow up guide with screenshots to explain how to use each of these features.

What if this all goes horribly wrong?

So in the absolute worst case scenario, where staked SPANK from the SpankBank are somehow stolen or frozen, we would have to “hard-fork” our own SPANK ERC20 token. We would immediately contact all exchanges to let them know to stop all SPANK trading to limit any potential upside for an attacker in selling to unknowing buyers. Then we would migrate to a new SPANK ERC20 contract and airdrop to a snapshot of balances, deploy a new SpankBank, and start sending fees to that.

This would be a massive coordination headache, but ultimately the migration cost isn’t that high, we’re confident that the codebase has been thoroughly tested, and the upside for an attack is limited enough that it probably makes more sense to just let us know. So I’m not that worried about this scenario.

In the less bad scenario where we discover a critical bug, but no funds have been stolen or frozen yet, we would vote with our staked SPANK to close the SpankBank, and all stakers would immediately be able to withdraw their stakes. Then we would redeploy a new SpankBank, but wouldn’t have to hard-fork the SPANK ERC20 token.

Teehee.

As of this writing, we’ve passed $69,000 in staked SPANK, huzzah!

Connect with SpankChain

For more information about the SpankChain project:

--

--

SpankChain
SpankChain

A cryptoeconomic powered adult entertainment ecosystem built on the Ethereum network.