Today we’re pleased to throw open the gates of the DBC Playground. Lucky Alice has 18,446,744,073,709,551,615 freshly minted tokens (she’s counted them all) and she’s generously agreed to give 100,000 to Bob. So Bob gives Alice his public key, and Alice generates a DBC just for him. Just to make sure the transaction’s gone through, Bob checks his wallet.
You can recreate this scenario and possibly some more exciting variations in @danda’s DBC Playground.
General progress
@heather_burns and @jimcollinson are working on the governance white paper and Heather has reached out to another decentralised project to scope out a possible advocacy response to the UK Online Safety Bill.
There’s been some good progress on membership integration with all tests passing now, reports @davidrusu. The pieces are all in place. Hold onto your hats folks…
@danda has finished removing the mint nodes from sn_dbc
, as discussed last week, so some building blocks for exchanging owned and bearer DBCs are in place If you’re up for building the software (just copy and paste the commands so long as you have Rust etc installed) you can be among the first to experiment hands-on with Safe Network DBC technology.
@oetyng has implemented the message control flow / backpressure work, and that’s all been merged, which has further reduced node mem usage. He continues to look at improving node workload prioritisation, so there will be more to come there soon.
The DBC playground
The sn_dbc_examples crate contains an example wallet and spentbook node(s) intended to demonstrate usage of the sn_dbc crate. These communicate using qp2p and a simple example DBC messaging protocol. To be clear, these are not integrated with the rest of Safe Network. That work is in progress now. We have nick-named this the DBC Playground.
We invite interested and technically inclined community members to give the DBC playground a spin and let us know how you find it. It should work on Linux, Mac and Windows. Let us know if you need a hand with the build.
Pre-requisites:
Rust latest version
Git
build-essential
(Debian) or equivalent
First build ultraman
or install foreman
- ultraman
is a program that makes it easy to start/stop multiple spentbook nodes. Windows users will need to install the Ruby program foreman
instead, for which you will first need to install Ruby - see instructions below.
Linux/Mac
$ git clone https://github.com/dan-da/ultraman.git
$ cd ultraman
$ cargo build
$ cargo install --path . # <- don't forget the ' .'
Windows (PowerShell)
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('<https://chocolatey.org/install.ps1>'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
cinst ruby
gem install foreman # in a new shell
Next build sn_dbc_examples
$ git clone https://github.com/maidsafe/sn_dbc_examples.git
$ cd sn_dbc_examples
$ cargo build
Open three terminal windows in the sn_dbc_examples
directory.
In terminal window 1 start a distributed spentbook with 3 nodes:
Linux/Mac
$ RUST_LOG=info ultraman start
Windows
foreman start
In terminal window 2 (Bob) create a wallet:
$ cargo run --bin wallet -- --wallet-file .wallet2.dat
Now create a public key/address to receive funds:
>> newkey
Receive PublicKey: a1234567……
In terminal window 3 (Alice) create a wallet and check the balance
$ cargo run --bin wallet
>> balance
Available balance: 0
Now issue the genesis key to create Alice’s funds
>> issue_genesis
Check the balance again
>> balance
Available balance: 18446744073709551615 :
Now Alice can reissue the genesis DBC into a smaller DBC to pay Bob 100000. The remainder automatically goes back to her wallet.
>> reissue
Available balance: 18446744073709551615
Amount to spend: 100000
[b]earer or [o]wned: o
Recipient’s public key: a1234567....
.
-- Begin DBC --
01000000a5c4a0e24ff643b9a7056af9efe3ed447472cd8b ...
-- End Dbc--
Alice copies the DBC (note: just the characters between the begin and end tags and no white space) and sends it to Bob.
In terminal window 2 (Bob)
Bob types the deposit
command in his wallet and pastes in the DBC, adding a note if he wants:
>> deposit
Paste Dbc:
01000000a5c4a0e24ff643b9a7056af9efe3ed447472cd8b ...
Notes (optional): from Alice
Deposited 100000
Now when Bob checks his balance it’s now 100,000 tokens.
>> Balance
Available balance: 100000
And he can see the DBC(s) and some info about it using the unspent
command.
>> unspent
*-- Unspent Dbcs – *
a56e45ddf45f880b588b75f243fa88328d190c928596c5237c2d3bffe993a66c, rcvd: 2022-03-24T04:24:14.208444897+00:00, amount: 100000 (mine)
Full instructions are available in the sn_dbc_examples crate.
Let us know how you get on!
Useful Links
Feel free to reply below with links to translations of this dev update and moderators will add them here:
Russian ; German ; Spanish ; French; Bulgarian
As an open source project, we’re always looking for feedback, comments and community contributions - so don’t be shy, join in and let’s create the Safe Network together!