SkillAgentSearch skills...

Spacefold

๐ŸŒ“ A demo of instant cross-chain communication using Connext!

Install / Use

/learn @connext/Spacefold
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

alt text

Spacefold

Spacefold is a demo and reference implementation of instant cross-evm-chain communication using Connext! Spacefold was built as part of The Great Reddit Scaling Bake-Off in July 2020.

Here's our official submission to the /r/ethereum subreddit!

Quick Resources

Introduction: "Hold up, how does this meet the Reddit requirements outlined above"?

Great question! It doesn't and it's not supposed to.

Connext is the protocol for programmable p2p micropayments. Connext lets users make unbreakable commitments to each other using state channels - these commitments are effectively free to create and send, but must be backed by funds locked up on (any) chain. Unlike other scalability solutions to Ethereum, we're not a consensus system (a blockchain, rollup, etc.), but a point-to-point communication network that enables extremely high volume, private, ultra-cheap transfers (and other more complex commitments) baked directly into existing web paradigms like HTTP requests.

One consequence of the above is that all actions taken within Connext are private to each user. This means that, while we can enable a high volume of Reddit Community Point transfers at low cost, meeting Reddits requirements of scalably minting/burning their points can't be done in a way where subreddit users can actively monitor and interact with each others' balances. Those balances would be necessarily private.

The reality is that every solution has its tradeoffs. Rather than building a custom independent submission, we decided to experiment with mitigating these tradeoffs by combining different existing solutions to make something even better. The biggest vector for improvement we see is the usability and interoperability of new scale-by-more-chains-based approaches like rollups/plasma/sidechains/sharding.

Spacefold demonstrates how Connext can be used to build an internet-of-l2-chains/shards. Users can instantly and seamlessly transfer value between chains/shards, and eventually even make atomic cross-chain contract calls. Most importantly, this can happen in a way where users dont need to know what chain/rollup/shard they are on to begin with.

Table of Contents

  1. Compatibility with Other Chains

  2. Running it Yourself

    a. Setting Up the Demo Locally

    b. Running your own Connext Node on Multiple Chains

  3. How Does it Work?

    a. Background on Connext

    b. Cross-chain Transfers with Connext

    c. How Does it Scale?

  4. Demo Implementation Details

  5. Trust Assumptions and Other Considerations

Compatibility with Other Chains

In general, Connext can support any chain/l2/shard/rollup system that supports turing-complete computation. For limited cases, we may also be able to get away with non-turing-complete chains using a slightly different pattern for cross-chain transfers.

While the above is true, in the ideal case (to avoid custom work), it's best for Connext to work with Ethereum-like systems (that run the EVM and support Solidity). Running Connext on anything else would likely require lots of custom work.

To help with parsing out which solutions can and can't work with Connext, we've created a compatiblity table. Note this table is still a WIP while we get more information from teams. If you feel as though anything here was misrepresented, please submit an issue -- we're happy to amend!

| Name | Type | EVM Compatible | Supports Create2 | Included in demo | Notes | Verdict | | :-------: | :----------------: | :--------------: | :----------------: | :--------------: | --------------------------------------------------------------------------------------------------------------------- | ------- | | Matic | Plasma chain | โœ”๏ธ | โœ”๏ธ | โœ”๏ธ | | ๐Ÿ˜ | | Optimism | ORU | โœ”๏ธ | โœ”๏ธ | โœ”๏ธ | | ๐Ÿ˜ | | xDai | PoS Sidechain | โœ”๏ธ | โœ”๏ธ | โœ”๏ธ | | ๐Ÿ˜ | | SKALE | Elastic Sidechains | โœ”๏ธ | โœ”๏ธ | Coming soon | | ๐Ÿ˜ | | Arbitrum | ORU | โœ”๏ธ | โœ”๏ธ | Coming soon | | ๐Ÿ˜ | | OMG | Plasma chain | โœ”๏ธ | ๐Ÿคท | | No confirmation from OMG team yet - we're assuming based on most plasma constructions | ๐Ÿ™‚ | | Hubble | ORU | Can be supported | | | | ๐Ÿ™‚ | | Fuel | ORU | Planned for v2 | | | While not currently supported, the Fuel team expressed interest in building support potentially earlier than their v2 | ๐Ÿ™‚ | | Starkware | zkRU | โŒ | | | No confirmation from team yet, we're assuming based on current zkRU limitations | ๐Ÿคท/โ˜น๏ธ | | Loopring | zkRU | โŒ | | | No confirmation from team yet, we're assuming based on current zkRU limitations | ๐Ÿคท/โ˜น๏ธ | | zkSync | zkRU | โŒ | | | No confirmation from team yet, we're assuming based on current zkRU limitations | ๐Ÿคท/โ˜น๏ธ |

Run it Yourself

Running the Spacefold Demo Locally

The spacefold demo is pretty simple to run:

git clone git@github.com:connext/spacefold.git
cd spacefold

By default, the demo will point to a Connext node that we're hosting at https://node.spacefold.io.

You'll need a few environment variables to start the demo.

  1. NEXT_PUBLIC_CHAIN_PROVIDERS= -- JSON string to provide node URLs with chains, i.e. '{"4":"https://rinkeby.infura.io/v3/...","5":"https://goerli.infura.io/v3/...","42":"https://kovan.infura.io/v3/...","80001":"https://rpc-mumbai.matic.today"}'

Then,

yarn && yarn dev

Running your own Connext Node on Multiple Chains

Running your own Connext node locally is also pretty easy!

git clone git@github.com:connext/vector.git
cd vector
make # this will take a while
make start-trio

Please refer to our docs for more info, or ping us in our Discord!

How does it work?

A Quick Background on Connext

Connext is a network of state channels. The core concept behind a channel is very simple:

  • Suppose you're paying your friend Bob for a metered service at the rate of $1 every minute.
  • It would be silly to broadcast every transaction to the blockchain, you would incur lots of fees. At the same time, it also doesn't make sense to pay up front or pay at the end, as that would introduce new trust assumptions.
  • Instead, what you can do is send your funds to a 2/2 multisig controlled by you and Bob. Then, rather than sending onchain transactions, you can send Bob ever updating signatures which give Bob the ability to withdraw up to a certain amount from the multisig.
  • Because Bob can get his funds at any time using his unbreakable commitment from you, you complete a new payment to him every time you send a new signature.

alt text

Connext extends this concept in a couple of ways ways:

  1. Updates within the channel can have any arbitrary conditionalit

Related Skills

View on GitHub
GitHub Stars58
CategoryDevelopment
Updated11mo ago
Forks25

Languages

TypeScript

Security Score

92/100

Audited on Apr 13, 2025

No findings