Skip to content

Instantly share code, notes, and snippets.

@lemonway
Last active November 16, 2020 15:53
Show Gist options
  • Save lemonway/a527276bae0bfc0b281decd2d5b49861 to your computer and use it in GitHub Desktop.
Save lemonway/a527276bae0bfc0b281decd2d5b49861 to your computer and use it in GitHub Desktop.
POC scenario

Scenario 1: P2P basic scenario

Given:

wallet::1 {
    balance: 100
}
wallet::2 {
    balance: 50
}
transaction::1 {
    source: wallet::1,
    target: wallet::2
    amount: 30
    status: pending
    nature: walletToWallet
}

==> Now I want to do all of these in 1 transaction

  1. check balance of wallet::1 if there is enough money.
  2. update transaction::1.status from "pending" to "success"
  3. update wallet::1.balance = 70
  4. update wallet::2.balance = 80

Scenario 2: P2P with commission (simple model)

Given:

wallet::sc {
    balance: 100
}
wallet::lw {
    balance: 100
}
wallet::1 {
    balance: 100
}
wallet::2 {
    balance: 50
}
transaction::1 {
    source: wallet::1,
    target: wallet::2
    amount: 30
    status: pending
    nature: walletToWallet
}

==> Now I want to do all of these in 1 transaction

  1. check balance of wallet::1 if there is enough money.
  2. update transaction::1.status from "pending" to "success"
  3. update wallet::1.balance = 70
  4. update wallet::2.balance = 80
  5. create a new transaction
transaction::2 {
     source: wallet::sc,
     target: wallet::lw
     amount: 0.03,
     nature: Commission
     originTransaction: transaction::1
     status: success
}
  1. update wallet::sc.balance = 100-0.03
  2. update wallet::lw.balance = 100+0.03
  3. if there is not enough money in the wallet SC to pay the commission (0.03 EUR) then throw error and rollback everything

What we want to see

Using the C# SDK

  1. Create 2 random wallets
  2. Create N transactions to send money back and forth between these two wallets
  3. We want to benchmark how many transactions per second we can make to have a first impression about the perf.
  4. We want to avoid negative balance in wallets. We want to try to send 50 EUR from wallet::1 to wallet::2 two times concurently and see that only one trasaction can success.
  5. We want to query the transaction along with all the wallets (source+targent) information (join transaction + wallet) in the same request if possible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment