Skip to content

totem-tech/totem-meccano-node

Repository files navigation

Totem Blockchain Runtime(s)

Contacts

Founder, Development Lead : Chris D’Costa

Co-Founder : Toufiqur Chowdhury

Co-Founder : Miro Svetlic

1. Description

Totem Live Accounting is built on the idea that accounting ledgers should be able to communicate directly with each other, anywhere in the world, in real-time.

To achieve this we are in the process of developing a custom built blockchain runtime and a peer-to-peer network, coupled with a full set of account posting recipes to create - what we believe to be - one of the first fully decentralised non-finance products for business and consumers anywhere.

You can think of Totem like a globally available, dedicated public network for accounting data with a modern, intuitive, usable front-end app.

Technically speaking, Totem is delivering a fully functional accounting ledger attached to every blockchain wallet on its network.

Having said that, it is however, a gross under-representation of the greater project goals which are outlined elsewhere on the interwebs.

1.1. Why is this important?

The communication flow in accounting and book-keeping is completely broken. Your email inbox is spammed full of accounting information like, invoices, Uber receipts, flight expenses, online orders, and there is no direct connection between those accounting documents the payment, the reasons for the transaction or, crucially, your accounting system.

Whichever way you try to manage this, it boils down to manual effort to gather and send the information to your accountant, who re-encodes it again and carries out much manual effort to reconcile it to business activities, payments, bank statements.

Businesses large and small suffer equally with this same problem, because there is no common accounting protocol on which to reconnect the pieces and this is the heart of the problem to be solved.

1.2. What we are working towards…​

In our view, when an invoice is created at (for example) Uber, it should automatically appear in your accounts. It should appear in the correct expense reporting, and it should already be flagged as settled, and the appropriate entries from your payment card, bank card should already have been made.

Sounds obvious right? It hasn’t been done before because there was no good peer-to-peer mechanism to build such a protocol for handling these postings. A blockchain solves this because by definition it is about communicating information peer-to-peer.

At Totem, we go one step further…​ this mechanism should not be dependent on a centrally controlled accounting software company, who will inevitably sell you licences and sell your data! This mechanism should be open to all, completely independent of accounting software vendors, and continue to operate, peer-to-peer, at all times, forever. Even when Totem no longer needs to exist.

This is the problem that Totem has solved. Once you see this ability in action, "much new thing possible".

1.3. Story so far

Totem is still an early stage product, as we started developing in earnest in December 2018 building on years of discovery and research, that evolved out of experimental projects in the blockchain and cryptocurrency space going back to 2013.

The idea behind Totem is simple however and makes sense in a connected world.

Even if you are not running a business, the business of "accounting records" touches everything you do, like it or not.

From the receipt for a new smartphone, to your regular groceries you are bombarded with accounting data you cannot easily make use of.

Imagine a world where you could, for example, see how much you paid for tomatoes last year? Or five years ago? Or shoes, or speeding fines…​ without you having to do anything special. Imagine that the information just existsed privately, for you to access any time you wanted. How could that change your life?

Honestly, we don’t know, but it will be a bonus side effect of what Totem are building.

Our main target market is the ever-expanding decentralised economy - as businesses employ less, and contract freelancers more, we are all moving towards a future where our accounting will be at the granular level of our identity.

1.4. The alternatives

  • Q: Can banks do this? A: No. The detail is lost in the transaction, and it’s not their business model to collect it.

  • Q: Can accounting software companies do this? A: Yes and no. There are too many competing players, the coverage would not be universal. Additionally it would destroy their licence-fee paying business model, and what would happen to your data if they went bust?

  • Q: Can any other business do this? A: probably. They need the vision to grasp the whole concept though otherwise they default to centralised services.

  • Q: Can Totem do this? A: Yes. Definitely. The Totem team demonstrated this capability in February 2019, connecting five random parties and three tax jurisdictions, posting accounting entries in all relevant accounts on a blockchain. This was a "Marconi moment" means the activity of accounting will not be dependant on Totem and can be universal.

We have been building out the full scale version ever since and Totem can already do many of the underlying communication tasks required to make this happen. We are still actively pushing new code every day.

2. Application Architecture

There are several key features of the Totem Architecture which are as follows:

  • the blockchain runtimes, accounting recipes, and on-chain storage,

  • full homomorphic encryption (FHE) for debit and credit entries, ensuring nobody (not even the blockchain itself) can see your accounting figures.

  • the Totem BOXKEYS on-chain public key registry,

  • the Totem BONSAI on-chain pre-authentication for off-chain distributed NoSQL databases,

  • the off-chain distributed NoSQL storage (using the Totem BONSAI protocol of course),

  • the off-chain global shared datasets (companies, products, places),

  • encrypted storage on- and off-chain,

  • the front-end UI service,

  • the p2p encrypted communication channels,

  • socially recoverable identities,

  • the 'transactions' faucet,

Most of the components are designed to allow businesses to participate in the global live accounting network, but they can also run their own private networks should they wish to do this, and still benefit from being able to communicate with other companies and exchange account posting information.

Whilst much of this is established in an early form, we are on course to complete development sometime in 2021, you can view the progress on our live network Totem Live Accounting

2.1. Privacy

The Totem Network will have privacy by default for all self-managed identities. The BOXKEYS is a key building-block in that process.

As the development progresses we will be introducing fully encrypted storage and end-to-end communication (hence the reason for developing BOXKEYS and BONSAI) to maintain data security and privacy for everyone using self-managed identities on any Totem network.

In the longer term we will be using Fully Homomorphic Encryption (FHE) for obvious reasons.

3. Totem Meccano

The current version of the Totem network is the Meccano TestNet. We do not plan a MainNet until we have a fully functional end-to-end product. This will likely be in later this year (2020 as of writing).

The purpose of this network is to begin wider engagement with the blockchain community, monitor performance and interactions in all parts of the architecture, adapt the economic model, and obviously upgrade, fix and battle-test the code. Please send us an email if you want to be part of the team.

You can already test and use much of the core communication and storage technology as well as the first modules which have already been built, including:

  • Identities,

  • Partners,

  • Activities,

  • Teams,

  • Timekeeping,

  • Transfers,

  • BOXKEY Server,

There is also a bleeding edge (read "sometimes broken") live development network here. If you are a developer, you can see our entire group of developments at various build stages here.

When using Totem Meccano via the links we recommend you experiment with friends, partners and other businesses (this is a peer-to-peer service after all) to get the general idea about how we are connecting and posting between parties.

If you come across any issues, or wish to make suggestions for develoment or user experience please take the time to post them here.

4. Trying out Totem Meccano

4.1. Running a node on the Meccano network

The code in this repository will enable you to join and support Meccano as a simple node.

If you wish to become a validator or authority on the network, please contact us at info@totemaccounting.com

We recommend you use on of the current binaries which can be found here. If you are running the binaries, skip to the Executing the binary section.

Otherwise if you would like to compile and run the code from source follow the instructions below.

4.2. Dependencies

Totem is built using the Rust languange, but you will need to prepare your environment first.

  • Linux:

    sudo apt-get update
    sudo apt install build-essential
    sudo apt install cmake pkg-config libssl-dev git clang libclang-dev
  • Mac:

    brew install cmake pkg-config openssl git llvm
  • Windows (PowerShell):

    # Install LLVM
    # Download and install the Pre Build Windows binaries
    # of LLVM  from http://releases.llvm.org/download.html
    
    # Install OpenSSL (through vcpkg)
    mkdir \Tools
    cd \Tools
    git clone https://github.com/Microsoft/vcpkg.git
    cd vcpkg
    .\bootstrap-vcpkg.bat
    .\vcpkg.exe install openssl:x64-windows-static
    
    $env:OPENSSL_DIR = 'C:\Tools\vcpkg\installed\x64-windows-static'
    $env:OPENSSL_STATIC = 'Yes'
    [System.Environment]::SetEnvironmentVariable('OPENSSL_DIR', $env:OPENSSL_DIR, [System.EnvironmentVariableTarget]::User)
    [System.Environment]::SetEnvironmentVariable('OPENSSL_STATIC', $env:OPENSSL_STATIC, [System.EnvironmentVariableTarget]::User)

Now you can install Rustup which installs Rust and its package manager Cargo. These commands also switch to the nightly rust toolchain and a special C compiler for wasm (WebAssembly).

curl https://sh.rustup.rs -sSf | sh
# on Windows download and run rustup-init.exe
# from https://rustup.rs instead

rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
rustup update stable
cargo install --git https://github.com/alexcrichton/wasm-gc

Then, clone this repo to get the Totem source code:

git clone https://gitlab.com/totem-tech/totem-substrate.git
cd totem-substrate

Then build the code:

./scripts/build.sh  		# Builds the WebAssembly binaries
cargo build --release 				# Builds all native code

Detailed logs may be shown by running the node with the following environment variables set: RUST_LOG=debug RUST_BACKTRACE=1 cargo run.

4.3. Joining the Totem Meccano network

Starting the runtime for the Totem network maybe slightly different depending on if you compiled the code or if you are executing the binary that you downloaded.

4.3.1. Executing the self-compiled code

Below we describe how to execute the code if you compiled the code from this repo.

Below is an example of some parameters you can use to start your node. These are not mandatory as the node will start without these if you execute either cargo run --release or ./target/release/totem-meccano you can also navigate directly to the node binary that you have compiled and execute

  cd /target/release/
  ./totem-meccano

Any of these will execute the binary.

4.3.2. Execution options

Because Totem is built on Parity’s Substrate framework, you can execute all the flags and options that you would expect with a Substrate blockchain. See the possibilities by appending --help. (For clarity Meccano is based on Substrate v1.0).

In the following example we are running a Totem node called Alice on TCP port of 30334 with her chain database stored locally at /tmp/alice.

cargo run --release \-- \
  --base-path /tmp/alice \
  --alice \
  --port 30334 \

4.3.3. Executing the binary

Once you have downloaded the binary all you have to do is navigate to the directory and execute the code:

  cd /target/release/
  ./totem-meccano

If you are running in a desktop you can also simply open the binary to begin execution. The options mentioned in Executing the self-compiled code only apply if you are running on the command line.

If you are successful, you will see your node syncing at https://telemetry.polkadot.io/#/Totem%20Meccano

5. License

Totem is building under the same license as the Substrate framework.

6. Contributing Guidelines

6.1. Contributor Code of Conduct