Rupert  Beatty

Rupert Beatty


Mustard: A Swift Library for tokenizing Strings When Splitting

Mustard 🌭

Mustard is a Swift library for tokenizing strings when splitting by whitespace doesn't cut it.

Quick start using character sets

Foundation includes the String method components(separatedBy:) that allows us to get substrings divided up by certain characters:

let sentence = "hello 2017 year"
let words = sentence.components(separatedBy: .whitespaces)
// words.count -> 3
// words = ["hello", "2017", "year"]

Mustard provides a similar feature, but with the opposite approach, where instead of matching by separators you can match by one or more character sets, which is useful if separators simply don't exist:

import Mustard

let sentence = "hello2017year"
let words = sentence.components(matchedWith: .letters, .decimalDigits)
// words.count -> 3
// words = ["hello", "2017", "year"]

If you want more than just the substrings, you can use the tokens(matchedWith: CharacterSet...) method which will return an array of TokenType.

As a minimum, TokenType requires properties for text (the substring matched), and range (the range of the substring in the original string). When using CharacterSets as a tokenizer, the more specific type CharacterSetToken is returned, which includes the property set which contains the instance of CharacterSet that was used to create the match.

import Mustard

let tokens = "123Hello world&^45.67".tokens(matchedWith: .decimalDigits, .letters)
// tokens: [CharacterSet.Token]
// tokens.count -> 5 (characters '&', '^', and '.' are ignored)
// second token..
// token[1].text -> "Hello"
// token[1].range -> Range<String.Index>(3..<8)
// token[1].set -> CharacterSet.letters
// last token..
// tokens[4].text -> "67"
// tokens[4].range -> Range<String.Index>(19..<21)
// tokens[4].set -> CharacterSet.decimalDigits

Advanced matching with custom tokenizers

Mustard can do more than match from character sets. You can create your own tokenizers with more sophisticated matching behavior by implementing the TokenizerType and TokenType protocols.

Here's an example of using DateTokenizer (see example for implementation) that finds substrings that match a MM/dd/yy format.

DateTokenizer returns tokens with the type DateToken. Along with the substring text and range, DateToken includes a Date object corresponding to the date in the substring:

import Mustard

let text = "Serial: #YF 1942-b 12/01/17 (Scanned) 12/03/17 (Arrived) ref: 99/99/99"

let tokens = text.tokens(matchedWith: DateTokenizer())
// tokens: [DateTokenizer.Token]
// tokens.count -> 2
// ('99/99/99' is *not* matched by `DateTokenizer` because it's not a valid date)
// first date
// tokens[0].text -> "12/01/17"
// tokens[0].date -> Date(2017-12-01 05:00:00 +0000)
// last date
// tokens[1].text -> "12/03/17"
// tokens[1].date -> Date(2017-12-03 05:00:00 +0000)

Documentation & Examples


  •  Include detailed examples and documentation
  •  Ability to skip/ignore characters within match
  •  Include more advanced pattern matching for matching tokens
  •  Make project logo 🌭
  •  Performance testing / benchmarking against Scanner
  •  Include interface for working with Character tokenizers


  • Swift 4.1


Feedback, or contributions for bug fixing or improvements are welcome. Feel free to submit a pull request or open an issue.

Download Details:

Author: Mathewsanders
Source Code: 
License: MIT license

#swift #tokenize #sub #strings 

Mustard: A Swift Library for tokenizing Strings When Splitting
Chloe  Butler

Chloe Butler


Pdf2gerb: Perl Script Converts PDF Files to Gerber format


Perl script converts PDF files to Gerber format

Pdf2Gerb generates Gerber 274X photoplotting and Excellon drill files from PDFs of a PCB. Up to three PDFs are used: the top copper layer, the bottom copper layer (for 2-sided PCBs), and an optional silk screen layer. The PDFs can be created directly from any PDF drawing software, or a PDF print driver can be used to capture the Print output if the drawing software does not directly support output to PDF.

The general workflow is as follows:

  1. Design the PCB using your favorite CAD or drawing software.
  2. Print the top and bottom copper and top silk screen layers to a PDF file.
  3. Run Pdf2Gerb on the PDFs to create Gerber and Excellon files.
  4. Use a Gerber viewer to double-check the output against the original PCB design.
  5. Make adjustments as needed.
  6. Submit the files to a PCB manufacturer.

Please note that Pdf2Gerb does NOT perform DRC (Design Rule Checks), as these will vary according to individual PCB manufacturer conventions and capabilities. Also note that Pdf2Gerb is not perfect, so the output files must always be checked before submitting them. As of version 1.6, Pdf2Gerb supports most PCB elements, such as round and square pads, round holes, traces, SMD pads, ground planes, no-fill areas, and panelization. However, because it interprets the graphical output of a Print function, there are limitations in what it can recognize (or there may be bugs).

See docs/Pdf2Gerb.pdf for install/setup, config, usage, and other info.

#Pdf2Gerb config settings:
#Put this file in same folder/directory as itself (global settings),
#or copy to another folder/directory with PDFs if you want PCB-specific settings.
#There is only one user of this file, so we don't need a custom package or namespace.
#NOTE: all constants defined in here will be added to main namespace.
#package pdf2gerb_cfg;

use strict; #trap undef vars (easier debug)
use warnings; #other useful info (easier debug)

#configurable settings:
#change values here instead of in main file

use constant WANT_COLORS => ($^O !~ m/Win/); #ANSI colors no worky on Windows? this must be set < first DebugPrint() call

#just a little warning; set realistic expectations:
#DebugPrint("${\(CYAN)} ${\(VERSION)}, $^O O/S\n${\(YELLOW)}${\(BOLD)}${\(ITALIC)}This is EXPERIMENTAL software.  \nGerber files MAY CONTAIN ERRORS.  Please CHECK them before fabrication!${\(RESET)}", 0); #if WANT_DEBUG

use constant METRIC => FALSE; #set to TRUE for metric units (only affect final numbers in output files, not internal arithmetic)
use constant APERTURE_LIMIT => 0; #34; #max #apertures to use; generate warnings if too many apertures are used (0 to not check)
use constant DRILL_FMT => '2.4'; #'2.3'; #'2.4' is the default for PCB fab; change to '2.3' for CNC

use constant WANT_DEBUG => 0; #10; #level of debug wanted; higher == more, lower == less, 0 == none
use constant GERBER_DEBUG => 0; #level of debug to include in Gerber file; DON'T USE FOR FABRICATION
use constant WANT_STREAMS => FALSE; #TRUE; #save decompressed streams to files (for debug)
use constant WANT_ALLINPUT => FALSE; #TRUE; #save entire input stream (for debug ONLY)

#DebugPrint(sprintf("${\(CYAN)}DEBUG: stdout %d, gerber %d, want streams? %d, all input? %d, O/S: $^O, Perl: $]${\(RESET)}\n", WANT_DEBUG, GERBER_DEBUG, WANT_STREAMS, WANT_ALLINPUT), 1);
#DebugPrint(sprintf("max int = %d, min int = %d\n", MAXINT, MININT), 1); 

#define standard trace and pad sizes to reduce scaling or PDF rendering errors:
#This avoids weird aperture settings and replaces them with more standardized values.
#(I'm not sure how photoplotters handle strange sizes).
#Fewer choices here gives more accurate mapping in the final Gerber files.
#units are in inches
use constant TOOL_SIZES => #add more as desired
#round or square pads (> 0) and drills (< 0):
    .010, -.001,  #tiny pads for SMD; dummy drill size (too small for practical use, but needed so StandardTool will use this entry)
    .031, -.014,  #used for vias
    .041, -.020,  #smallest non-filled plated hole
    .051, -.025,
    .056, -.029,  #useful for IC pins
    .070, -.033,
    .075, -.040,  #heavier leads
#    .090, -.043,  #NOTE: 600 dpi is not high enough resolution to reliably distinguish between .043" and .046", so choose 1 of the 2 here
    .100, -.046,
    .115, -.052,
    .130, -.061,
    .140, -.067,
    .150, -.079,
    .175, -.088,
    .190, -.093,
    .200, -.100,
    .220, -.110,
    .160, -.125,  #useful for mounting holes
#some additional pad sizes without holes (repeat a previous hole size if you just want the pad size):
    .090, -.040,  #want a .090 pad option, but use dummy hole size
    .065, -.040, #.065 x .065 rect pad
    .035, -.040, #.035 x .065 rect pad
    .001,  #too thin for real traces; use only for board outlines
    .006,  #minimum real trace width; mainly used for text
    .008,  #mainly used for mid-sized text, not traces
    .010,  #minimum recommended trace width for low-current signals
    .015,  #moderate low-voltage current
    .020,  #heavier trace for power, ground (even if a lighter one is adequate)
    .030,  #heavy-current traces; be careful with these ones!
#Areas larger than the values below will be filled with parallel lines:
#This cuts down on the number of aperture sizes used.
#Set to 0 to always use an aperture or drill, regardless of size.
use constant { MAX_APERTURE => max((TOOL_SIZES)) + .004, MAX_DRILL => -min((TOOL_SIZES)) + .004 }; #max aperture and drill sizes (plus a little tolerance)
#DebugPrint(sprintf("using %d standard tool sizes: %s, max aper %.3f, max drill %.3f\n", scalar((TOOL_SIZES)), join(", ", (TOOL_SIZES)), MAX_APERTURE, MAX_DRILL), 1);

#NOTE: Compare the PDF to the original CAD file to check the accuracy of the PDF rendering and parsing!
#for example, the CAD software I used generated the following circles for holes:
#CAD hole size:   parsed PDF diameter:      error:
#  .014                .016                +.002
#  .020                .02267              +.00267
#  .025                .026                +.001
#  .029                .03167              +.00267
#  .033                .036                +.003
#  .040                .04267              +.00267
#This was usually ~ .002" - .003" too big compared to the hole as displayed in the CAD software.
#To compensate for PDF rendering errors (either during CAD Print function or PDF parsing logic), adjust the values below as needed.
#units are pixels; for example, a value of 2.4 at 600 dpi = .0004 inch, 2 at 600 dpi = .0033"
use constant
    HOLE_ADJUST => -0.004 * 600, #-2.6, #holes seemed to be slightly oversized (by .002" - .004"), so shrink them a little
    RNDPAD_ADJUST => -0.003 * 600, #-2, #-2.4, #round pads seemed to be slightly oversized, so shrink them a little
    SQRPAD_ADJUST => +0.001 * 600, #+.5, #square pads are sometimes too small by .00067, so bump them up a little
    RECTPAD_ADJUST => 0, #(pixels) rectangular pads seem to be okay? (not tested much)
    TRACE_ADJUST => 0, #(pixels) traces seemed to be okay?
    REDUCE_TOLERANCE => .001, #(inches) allow this much variation when reducing circles and rects

#Also, my CAD's Print function or the PDF print driver I used was a little off for circles, so define some additional adjustment values here:
#Values are added to X/Y coordinates; units are pixels; for example, a value of 1 at 600 dpi would be ~= .002 inch
use constant
    CIRCLE_ADJUST_MINY => -0.001 * 600, #-1, #circles were a little too high, so nudge them a little lower
    CIRCLE_ADJUST_MAXX => +0.001 * 600, #+1, #circles were a little too far to the left, so nudge them a little to the right
    SUBST_CIRCLE_CLIPRECT => FALSE, #generate circle and substitute for clip rects (to compensate for the way some CAD software draws circles)
    WANT_CLIPRECT => TRUE, #FALSE, #AI doesn't need clip rect at all? should be on normally?
    RECT_COMPLETION => FALSE, #TRUE, #fill in 4th side of rect when 3 sides found

#allow .012 clearance around pads for solder mask:
#This value effectively adjusts pad sizes in the TOOL_SIZES list above (only for solder mask layers).
use constant SOLDER_MARGIN => +.012; #units are inches

#line join/cap styles:
use constant
    CAP_NONE => 0, #butt (none); line is exact length
    CAP_ROUND => 1, #round cap/join; line overhangs by a semi-circle at either end
    CAP_SQUARE => 2, #square cap/join; line overhangs by a half square on either end
    CAP_OVERRIDE => FALSE, #cap style overrides drawing logic
#number of elements in each shape type:
use constant
    RECT_SHAPELEN => 6, #x0, y0, x1, y1, count, "rect" (start, end corners)
    LINE_SHAPELEN => 6, #x0, y0, x1, y1, count, "line" (line seg)
    CURVE_SHAPELEN => 10, #xstart, ystart, x0, y0, x1, y1, xend, yend, count, "curve" (bezier 2 points)
    CIRCLE_SHAPELEN => 5, #x, y, 5, count, "circle" (center + radius)
#const my %SHAPELEN =
#Readonly my %SHAPELEN =>
    rect => RECT_SHAPELEN,
    line => LINE_SHAPELEN,
    curve => CURVE_SHAPELEN,
    circle => CIRCLE_SHAPELEN,

#This will repeat the entire body the number of times indicated along the X or Y axes (files grow accordingly).
#Display elements that overhang PCB boundary can be squashed or left as-is (typically text or other silk screen markings).
#Set "overhangs" TRUE to allow overhangs, FALSE to truncate them.
#xpad and ypad allow margins to be added around outer edge of panelized PCB.
use constant PANELIZE => {'x' => 1, 'y' => 1, 'xpad' => 0, 'ypad' => 0, 'overhangs' => TRUE}; #number of times to repeat in X and Y directions

# Set this to 1 if you need TurboCAD support.
#$turboCAD = FALSE; #is this still needed as an option?

#CIRCAD pad generation uses an appropriate aperture, then moves it (stroke) "a little" - we use this to find pads and distinguish them from PCB holes. 
use constant PAD_STROKE => 0.3; #0.0005 * 600; #units are pixels
#convert very short traces to pads or holes:
use constant TRACE_MINLEN => .001; #units are inches
#use constant ALWAYS_XY => TRUE; #FALSE; #force XY even if X or Y doesn't change; NOTE: needs to be TRUE for all pads to show in FlatCAM and ViewPlot
use constant REMOVE_POLARITY => FALSE; #TRUE; #set to remove subtractive (negative) polarity; NOTE: must be FALSE for ground planes

#PDF uses "points", each point = 1/72 inch
#combined with a PDF scale factor of .12, this gives 600 dpi resolution (1/72 * .12 = 600 dpi)
use constant INCHES_PER_POINT => 1/72; #0.0138888889; #multiply point-size by this to get inches

# The precision used when computing a bezier curve. Higher numbers are more precise but slower (and generate larger files).
#$bezierPrecision = 100;
use constant BEZIER_PRECISION => 36; #100; #use const; reduced for faster rendering (mainly used for silk screen and thermal pads)

# Ground planes and silk screen or larger copper rectangles or circles are filled line-by-line using this resolution.
use constant FILL_WIDTH => .01; #fill at most 0.01 inch at a time

# The max number of characters to read into memory
use constant MAX_BYTES => 10 * M; #bumped up to 10 MB, use const

use constant DUP_DRILL1 => TRUE; #FALSE; #kludge: ViewPlot doesn't load drill files that are too small so duplicate first tool

my $runtime = time(); #Time::HiRes::gettimeofday(); #measure my execution time

print STDERR "Loaded config settings from '${\(__FILE__)}'.\n";
1; #last value must be truthful to indicate successful load


#use Package::Constants;
#use Exporter qw(import); #

#my $caller = "pdf2gerb::";

#sub cfg
#    my $proto = shift;
#    my $class = ref($proto) || $proto;
#    my $settings =
#    {
#        $WANT_DEBUG => 990, #10; #level of debug wanted; higher == more, lower == less, 0 == none
#    };
#    bless($settings, $class);
#    return $settings;

#use constant HELLO => "hi there2"; #"main::HELLO" => "hi there";
#use constant GOODBYE => 14; #"main::GOODBYE" => 12;

#print STDERR "read cfg file\n";

#our @EXPORT_OK = Package::Constants->list(__PACKAGE__); #; NOTE: "_OK" skips short/common names

#print STDERR scalar(@EXPORT_OK) . " consts exported:\n";
#foreach(@EXPORT_OK) { print STDERR "$_\n"; }
#my $val = main::thing("xyz");
#print STDERR "caller gave me $val\n";
#foreach my $arg (@ARGV) { print STDERR "arg $arg\n"; }

Download Details:

Author: swannman
Source Code:

License: GPL-3.0 license


Pdf2gerb: Perl Script Converts PDF Files to Gerber format
Crypto Like

Crypto Like


What is Subsocial (SUB) | What is Subsocial coin | What is SUB coin | Substrate on Polkadot

**Introduction  **

Many of us signed up to Facebook unaware of what it meant to use a free product. There are always costs, so value has to be extracted somehow. Your data and your time is your payment. Had we known then what we know now, we may have chosen differently.

It is also important to acknowledge that while value was extracted by social media platforms of Web 2.0, the bigger story is actually a more positive one. Individuals could create content, share it with the world, and get paid without leaving their home.

Despite this freedom which we have to express ourselves and get paid for the value we create; we also know that the Internet is not as free as intended.

Accessing the web, posting content, and receiving payment involves numerous service providers lurking the background. These service providers can block your content, halt your payments, or simply remove you from the platform entirely. Every service provider is a potential point of censorship. Each of them is able to extract value.

Blockchain is technology for disintermediation. It is possible to remove the unnecessary service providers that stand between creators and consumers. We see an interesting paradox where blockchain technology is most valuable when it extracts as little value as possible from its users.

Facebook shouldn’t sell your data without paying you. YouTube shouldn’t get paid more for advertising than you do. Twitter shouldn’t be able to ban you or block your tweets because they disagree with you.

This is why we have created Subsocial. A web 3.0 technology with the promise of data sovereignty. You control the data you create. Your content, your value.


Subsocial is an open platform that allows anyone to launch their own decentralized censorship-resistant social networks and marketplaces. Subsocial will help you create your own decentralized version of the popular sites we see today, such as Medium, Twitter, Reddit, Instagram, Discourse, Patreon, OnlyFans and more.

Our software uses the Substrate blockchain framework and IPFS for decentralized file storage. This enables personalized news feed and notifications, transparent reputation, full text searching, rich content formats, without sacrificing SEO (search engine optimization).

Using Substrate also allows Subsocial to connect to the Polkadot and Kusama networks. Polkadot is a next-generation blockchain protocol that unites an entire network of purpose-built blockchains, allowing them to operate seamlessly together at scale. Polkadot will provide cross-chain interaction as well as providing a shared security platform upon which Subsocial can scale whilst remaining secure.

**Architecture **

Subsocial is more than a blogging platform with crypto payments. It is a revolution in connecting social media with decentralized finance. This is social finance where social media meets DeFi. To better explain how we differ from a simple blogging platform we must outline our architecture at a high level.

We will briefly cover topics such as where content is published and how it can be monetized via myriad primitives that we are working to add as soon as possible. This paper will also cover how we handle reputation and allow for a multitude of reputation types.

Subsocial saves you the hassle of running your own social network blockchain. Multiple social networks can run from the Subsocial chain which will provide shared networking effects. By default the network is censorship-resistant, however, each community is able to set their own rules for moderation.

Posts and Spaces

The building blocks of Subsocial are the spaces , posts , comments , likes , and follows . They will be familiar to everyone who has used any social media platform.

The best way to understand them is through comparison to familiar platforms:

Spaces are similar to:

  • Blogs on Blogger,
  • Publications on Medium,
  • Groups or pages on Facebook,
  • Accounts on Twitter and Instagram,
  • Channels on YouTube,
  • Servers on Discord,
  • Forums on Discourse.

Posts are similar to:

  • Posts on Facebook,
  • Articles on Medium,
  • Tweets on Twitter.

How about something more advanced? How can we recreate popular platforms for Web 3.0 using Subsocial?

  • Airbnb – apartment listings are spaces, while reviews are posts.
  • Quora – a question is a post, answers are comments/replies.
  • Stack Overflow
  • Answer writers can be rewarded, e.g. by the question writer.
  • The distribution of payouts can also be split between what the question owner and what the community finds to be the best answer.
  • Patreon /OnlyFans – supported users could be represented as spaces who are rewarded through paid subscriptions and community votes, etc.

All posts and spaces are associated with public key pairs (accounts). This means all content can be correctly attributed to the posts author and/or owner. The cryptography used is the same as found in Polkadot and Kusama. Subsocial supports the Polkadot{.js} extension that allows for easy key management in the browser or, in the future, an offline vault via Parity Signer.

With built in support for IPFS, your space can take advantage of decentralized hosting.

All code is open source and allows for customization of the front-end user interface and tailor it to the needs of your community. Check out the Subsocial JS SDK for more details. If you have an idea for new chain functionality, then you can suggest the feature or create a pull request to Subsocial node repo .


On Subsocial we allow for the creation of a user profile. This is a single identity that can be used in any community built on top of Subsocial. In the future, we believe this identity could be reused on other parachains.

User-owned social network

On current social networks we have very limited input on how the platform is governed partly because we have no ownership of the platform. The biggest social media companies make billions of dollars but don’t share the profits with the users and only some fraction with the content creators. Even as shareholders of the parent company, we are likely to have little input.

On Subsocial, users are the owners of the network. Token holders can participate in the overall governance of the Subsocial platform, but users can also participate in the governance of each space where they are a member. Each space is like a DAO (Decentralized Autonomous Organization) where members can have ownership and help to steer the way that a space is governed. Space governance is, of course, optional but we believe many spaces will choose to adopt this feature.

Not your keys – not your data

Publishing content to a website owned by a traditional social media company means that you have little rights over how the content is monetized or censored. Moreover, your login credentials are stored on their central database. You have to trust that these companies will be able to keep your private data safe and already we have seen many data breaches from largest Web 2.0 companies (including Facebook and Twitter). There is no way to verify that they are not selling your data.

The technologies powering the Web 3.0 paradigm allow users to retain the ownership of their own data. Rather than publishing content to a platform owned by a social media giant, you are now given the ability to publicize and monetize your content that can be fully independent of trusted third parties. Your login credentials are stored locally on your devices rather than in a centralized database.


Monetization is an important topic for all content creators, but more importantly is ensuring that creators get a fair deal when receiving payment for their work. This is where blockchain can help to extract only minimal fees for transfers (recording actions on-chain). However, payment hasn’t been a guarantee for most creators on the Internet. We think the barriers to making payments in the traditional world have hindered better pay for content creators.

Many of us have spent years blogging with little to show in terms of either audience royalties. Typically, blogging websites don’t have in-built monetization although we have seen that start to change with new sites that employ blockchain technology for payments. Most people will think of Steemit for incentivized blogging, and while Steemit can be recreated with Subsocial, that functionality is only a small portion of what is possible.


Tips can be paid per post, per comment, or per space. Not only post authors can get paid, but also good comments / replies can be rewarded too.

Similar to tips on YouTube’s Superchat – it is possible to use tips to highlight users’ comments. Highlighted comments stand out compared to the free comments such that content creators will notice those comments first. If the creators have thousands of comments per post as we see with people like PewDiePie, highlighting will make a user’s comment stand out.


One key feature that we haven’t seen with previous blockchain-powered blogging sites is the inclusion of subscriptions. This is a huge feature of monetizing content that we see on popular Web 2.0 platforms such as Patreon, SubStack, and OnlyFans.

The appearance of subscriptions into the ecosystem of content creation has allowed people to start working independently and connect much closer with their fans. While YouTube adverts offered something of a proxy before these sites came along, these sites went further in allowing private content for different tiers of subscribers.

The biggest downside is that these platforms can block or remove content that they don’t like, plus the creators trust the platform owners with their private content. How much free content does the team behind OnlyFans get to see? Removing points of trust is important for the blockchain ecosystem.

The technical part of adding subscriptions to the Subsocial chain is easy; however, there is still some research to be done with how to handle hosting for private content in a decentralized way while preserving creator privacy.

Sell or rent your content

Blockchain technology enables true ownership: you own your content, so you should be able to sell or re-sell your content. This dynamic isn’t really possible with web 2.0: your content may include your name but it is typically not cryptographically signed nor stored on a public ledger. Ownership in web 2.0 is less clear and requires legal contracts for enforcement.

However, with SubSocial it is possible to sell content as well as rent out your posts or spaces. You retain the ownership and receive some income, while the renter receives traffic from all the users who visit. Let’s provide an example:

If you wrote a popular post on some topic (e.g. e-commerce), and this post attracts thousands of views per month, then it is feasible to assume that another space-owner recognises that your post attracts a lot of traffic. On SubSocial, you would be able to rent your post to another space for a specific time and be able to collect royalties for your efforts.

Pay-Per-View (future feature)

A feature that we are currently exploring is Pay-Per-View (PPV). Preliminary research suggests this could be done using a Trusted Execution Environment as we see in the SubstraTEE project.

Smart Contracts

Users of Subsocial are not limited to the built-in monetization functionality that’s natively provided by the chain. Users can deploy smart contracts to express endless creativity in monetization of their content and reputation.

It is possible to create different monetization algorithms that are more advanced or tailored to your community. Let’s look at two examples that illustrate the high degree of customization offered by Subsocial when it comes to monetization:

  • A post could be owned by multiple authors and the payouts could be modified to factor in ownership shares, as well as the number of likes or replies.
  • A space could create unique weekly contests that would reward authors of the three most popular posts based on the number of likes and shares.

We hope to capture the same level of creativity as seen in the DeFi space on Ethereum. We recognise that without smart contracts Ethereum DeFi would not be possible. The interaction between many DeFi projects is an expression of the composability of smart contracts.

SoFi: when DeFi meets social networking

Social finance (SoFi) is our view of where blockchain technology can revolutionize payments for social networks. At Subsocial, we are building a SoFi toolkit of decentralized financial primitives that are optimized for social networking.

Not only is it important for creators to reap the benefit of their work, it is also important that the community be able to freely decide who to promote and reward. That much should be clear already from this paper. However, SoFi takes those core principles and then sets about enabling developer creativity to add advanced custom features.

With smart contracts enabled on Subsocial, the community is able to create their own composable SoFi primitives, much like we can see in DeFi space. The Subsocial team started building primitives during Hackusama such as tips and paid subscriptions. These will be available at launch. In the future we hope to add pay-per-view and NFTs in the runtime.

Social Tokens

Tokenize your Subsocial space with social tokens in order to help build and monetize your space. Your followers can co-own your space and, if desired, participate in governance. A co-owned space is essentially a DAO. This is something we will touch upon in a later section.

A built-in AMM DEX for social tokens, that’s native to Subsocial, will let users easily exchange social tokens without having to worry about trying to trade their own tokens from one person to another.

Given the power of Polkadot, it will be possible to trade your social tokens to DOT, KSM and other parachain tokens, including stablecoins such as those in development by Acala and Bandot.


Having a source of revenue (tips, paid subscriptions) that’s free of the extreme volatility that we see with cryptocurrencies is important. As mentioned in the previous sub-section, this will be easy with Polkadot.

Marketplace for social networking algorithms

The posts, tweets, and news that fill up our news feeds of the most popular social networking websites are controlled by unseen algorithms that have a huge impact on our life. Billions of people use social networks operated by few giant corporations, but no one can see how the algorithm works or choose a more appropriate algorithm that matches their tastes. This point is true across YouTube, Facebook, Twitter, Medium and we believe all Web 2.0 social platforms.

The curation of information is a sort of power that these companies hold over us. Their algorithms are  designed and constantly improved for their profits rather than the content we could be most interested in. A related problem is that of ad curation. There is a balance between the amount of ads per user session and irritation if too many ads are shown. Again, these algorithms are not public.

We have an idea to solve that: a marketplace for feed algorithms. This lets users choose between different curation algorithms such that content in the UI can appear in an order that best suits a user’s preference. Should one algorithm prove not to work, then it can be replaced by another.


One key mechanism that we are building is to enable reputation per space and per tag. Compare this to Reddit which only has one reputation system: general reputation for the whole website, rather than specific reputation per subreddit. This generic karma (reputation) does not accurately reflect where reputation is earnt. Experts in financial markets are unlikely to be experts in, say, football and surgery.

What we are planning is more like the split reputation on Stack Overflow (Stack Exchange). Taking this approach allows for advanced features using your specific reputation:

  • When casting a vote on a poll post, your per space reputation can be used to weight your vote.
  • When participating in a challenge or contest with incentivisation, reputation in a particular space can be used as a coefficient to determine a share in reward. Fair rewards require a specific reputation.

Given the customization that is enabled by smart contracts, spaces can extend or override the reputation system built into the base chain. Space owners or their community members can create alternative formulas for how to calculate reputation and how it is used.

Roles and Permissions

Subsocial natively offers four built-in and dynamic roles. Space owners can specify and then dynamically update the role for any Subsocial account, as well as designated which permissions are associated with that role.

The following is the four built-in roles:

  • Everyone – any account on the Subsocial blockchain.
  • None – no account can do this.
  • Follower – any account that follows a given space.
  • Space owner – a current owner of a given space.

The roles can assume different permissions as desired by the space owner or moderate. As with other social media platforms it is important to define the permissions by considering the following questions:

  • Who can create posts and comments in a space?
  • Is it possible to edit a post or comment?
  • Is it possible to delete a post or comment?
  • Is it possible to upvote, downvote or share a post?
  • … and much more.

Example: Twitter-like space

For example, if you want make your space similar to Twitter, you would implement permissions in your space as such:

  • Only the owner can write posts to a given space.
  • Disable editing of posts and comments.
  • Disable downvotes.

Roles and permissions allow a space to be flexible, personal and define granular access control. This helps with the management of your space when it represents a group of people such as a community, an organization, or a team.


One topic that is important for the decentralized technology ecosystem is how moderation is handled. Subsocial respects censorship resistance by not blocking content at the root level (on-chain); however, we also understand the necessity of being able to moderate your personal space in order to remove unrelated content, remove troll posts, or otherwise moderate inappropriate content.

A single set of moderation rules like Twitter is too rigid and pushes all users to adopt the same perspectives in order to avoid being censored. Moderation per space means “your space, your rules .” These rules are handled by the chain. In addition, it is possible to modify the UI to allow for greater control over the content displayed.

Different spaces can have different rules for moderation, but they all share the same blockchain. Subsocial is the glue for binding all the spaces together.

Advanced moderation feature

Here we will describe one advanced feature that we are working on.

One of the products of scale, is that a large community could have a lot of experience with moderation and maintaining a good blocklist of content. For a space dedicated to children, it would be important to block a lot of content which would be deemed highly undesirable.

At the other end of the scale, there can be thousands of small communities that only have a single moderator, or don’t have the same experience, or they don’t have the time to keep up with the latest content to block.

The solution to this is to allow communities to inherit the state of moderation from a larger space on Subsocial. This will relieve the burden on smaller communities and allow for effective management of undesirable content.

Spaces as DAOs

The functionality provided by the Roles & Permissions modules is reminiscent of a DAO’s characteristics. That is, a space on Subsocial could be run as a DAO. Subsocial allows multiple owners (via multisig) who can control and monetize the content.

Each space can have its own token, therefore space ownership can be represented as a stake in the space’s token. Similarly, each space could evolve by its own governance mechanism (including token holder governance). As a result of this, each space could have its own treasury that’s controlled by its token holders.

Governance can be used to modify space permissions, roles, elect moderators, or even collectively decide how to block unwanted content.

In order to make trading easier between the space tokens, it would be possible to exchange them for Subsocial tokens first.


Subsocial allows communities to create their own space on top of the Subsocial parachain, such that all communities share the same underlying blockchain. This provides shared network effects: users will be able to seamlessly join any community on Subsocial. In addition, anyone with a Polkadot or Kusama address can easily join a Subsocial community.

Communities are also able to deploy their own instance of the Subsocial blockchain for even greater scalability, but at the cost of decentralization and security. A far future idea would be to have Subsocial be a hub for social networking parachains. This could be possible with Polkadot 2.0, but it isn’t something we can promise now.


Substrate allows blockchains to be seamlessly upgraded without hardforks. We have already witnessed forkless upgrades in Polkadot and Kusama. The same on-chain governance and upgrade mechanisms are available to all Substrate-based blockchains.

This approach to blockchain technology is perfect for Subsocial. We believe that it isn’t possible to know everything upfront. Functionality and parameters the platform will have to be changed all the way as the community finds bugs or it becomes necessary to make improvements.


At its core our software is open source and modular in design. Subsocial allows for almost complete tailoring to a community’s needs. This is hopefully obvious from the previous sections, but it is worth having a summary of the many different ways in which our software can be used:

  • Customize the UI with our JS SDK,
  • Deploy smart contracts for new methods of monetization,
  • Inherit features from other spaces,
  • Customizable per-space governance processes,
  • Moderation options to suit audience tastes.
  • Launch your chain using our open source code.

Cross-chain interaction with parachains

One of the most exciting aspects of Polkadot is the ability for one parachain to trustlessly interact with another. This also means it should be possible to use any token on Polkadot to make payments on Subsocial. The primary interest for this is likely to be paying for subscriptions in either DOT, KSM, ACA, or the native SubSocial token.


In a previous section, we described how spaces owners have several options at their disposal for governing their own space. We have tried to make space governance flexible such that it is tailored to your requirements.

In addition, there is also a layer of governance for the Subsocial parachain. Just as we see for Polkadot, token holders of the Subsocial token will be able to vote on proposals that appear on-chain.

The governance of the chain will decide how the chain upgrades and how the treasury money is spent. Upgrades can be new modules that provide new functionality options for all spaces or whether Subsocial should include integrations with other social networks.


The Subsocial treasury is a chain-level pot of tokens that can be spent on community proposals to help further the project and its ecosystem. It is envisioned that the treasury could sponsor chain development, creating different web and mobile apps, alternative feed algorithms, growing the community, and marketing.

Where we see one area of improvement over, say Kusama’s treasury, is to have three councils to cover the three aforementioned aspects of treasury expenditure. Each council will ideally be made up of experts in that domain: technology, UX, and marketing.

**The Subsocial Token **

Our token allows users to pay for actions and participate in governance of the Subsocial chain. And is used to reward validators (block producers) for their work.

Genesis block

We propose the following distribution of tokens in the genesis block:

  • 20% Team & advisors.
  • 10-20% Private sale.
  • 20-30% Public sale.
  • 20% Dev grants, marketing, early adopters.
  • 20% Kusama PLO (parachain lease offering).

[Also need to think about how the funding from the genesis will be spent.]

The exact cost of a parachain slot is not known, but we will set aside an amount of funding in order to try and win the slot. Purchasing the slot without community help means that we do not need to overly inflate the token supply to reward depositors.

Parachain deposit
The cost of obtaining a parachain slot is dependent upon a market based mechanism, which means we can only estimate the total amount of funding required.

  • Polkadot probably costs $10m - $15m.
  • Kusama probably costs $1m - $1.5m.

We calculated our estimates in the following way:

If we assume 50% of dots are staked, then perhaps we will see 25 - 40% locked into parachain deposits. That leaves anything from 10% to 25% that are unlocked and liquid.

With say 30% dots in deposits, that’s around 300 million dots for 100 slots. So 3 million dots for a slot , on average. At $4 a dot, that’s $12 million for a Polkadot slot while Kusama is roughly one tenth of this price.


** On free actions (notes)**

  • Some amount of free actions available?
  • Provide 70% of block space for actions that come from the communities and it is up to those communities to decide what actions should be in a block. The remaining 30% of actions can be included by anyone who pays the fees (guaranteed inclusion).

How and Where to Buy Subsocial (SUB)?

You will have to first buy one of the major cryptocurrencies, usually either Bitcoin (BTC), Ethereum (ETH), Tether (USDT), Binance (BNB)…

We will use Binance Exchange here as it is one of the largest crypto exchanges that accept fiat deposits.

Binance is a popular cryptocurrency exchange which was started in China but then moved their headquarters to the crypto-friendly Island of Malta in the EU. Binance is popular for its crypto to crypto exchange services. Binance exploded onto the scene in the mania of 2017 and has since gone on to become the top crypto exchange in the world.

Once you finished the KYC process. You will be asked to add a payment method. Here you can either choose to provide a credit/debit card or use a bank transfer, and buy one of the major cryptocurrencies, usually either Bitcoin (BTC), Ethereum (ETH), Tether (USDT), Binance (BNB)…


Step by Step Guide : What is Binance | How to Create an account on Binance (Updated 2021)

After the deposit is confirmed you may then purchase SUB from the website:

Subsocial Network Interest Form ☞ HERE

There are a few popular crypto exchanges where they have decent daily trading volumes and a huge user base. This will ensure you will be able to sell your coins at any time and the fees will usually be lower. It is suggested that you also register on these exchanges since once SUB gets listed there it will attract a large amount of trading volumes from the users there, that means you will be having some great trading opportunities!

Top exchanges for token-coin trading. Follow instructions and make unlimited money

Find more information SUB

WebsiteSource CodeSocial ChannelSocial Channel 2Message BoardCoinmarketcap

🔺DISCLAIMER: The Information in the post is my OPINION and not financial advice, is intended FOR GENERAL INFORMATION PURPOSES ONLY. Trading Cryptocurrency is VERY risky. Make sure you understand these risks and that you are responsible for what you do with your money.

🔥 If you’re a beginner. I believe the article below will be useful to you

⭐ ⭐ ⭐ What You Should Know Before Investing in Cryptocurrency - For Beginner ⭐ ⭐ ⭐

I hope this post will help you. Don’t forget to leave a like, comment and sharing it with others. Thank you!

#blockchain #bitcoin #subsocial #sub

What is Subsocial (SUB) | What is Subsocial coin | What is SUB coin | Substrate on Polkadot
Deion  Hilpert

Deion Hilpert


How to use Sub Menu in Blazor

In this video we will learn how to use Sub Menu in Blazor. How to add sub menu in blazor default menu. Blazor Sub NavLink add. Expandable Sub Menu in Blazor

#blazor #sub

How to use Sub Menu in Blazor