Imagine the general-purpose Layer-2 network that provides ability to send tokens
/ assets
/ IOU
/ binary data
/ etc to (almost) anyone participant of the network.
How should it be developed? We know it.
We already have a general purpose state channels network - GEO Protocol. All we need are middleware "connectors" for it to various environments. The role of the connector - atomic mirroring of the state from the network channels to the related environment.
The goal of this dirty hacked prototype is to provide PoC of L2 state channels, that are covered by different blockchain ecosystems (common Layer 2 for various blockchain ecosystems, (BTC/ETH/etc)).
- Architecure overview / ETH Contract;
- Middleware implementation;
- Forked and hacked GEO node repo (Specs);
- Some slides for high-level explanation;
Please, join:
ip: 104.248.47.57
ssh-port: 2277
user: ethBerlin
pass: berlin2018
ssh [email protected] -p 2277
- Build and deploy the contract to the net.
- Create 2 nodes. First node created would be "Alice", and second one would be "Bob".
curl -X POST private.localhost:2000/api/v1/nodes
curl -X POST private.localhost:2000/api/v1/nodes
This Requests would return you UUID of the nodes created.
You should remember which UUID belongs to which node.
In case if nodes are present - you may use already present pair of nodes.
- For Bob in
/home/nodes_handler/io/<bob_uuid>/
create filemiddleware.port
with5000
in it. - For Alice in
/home/nodes_handler/io/<alice_uuid>/
create filemiddleware.port
with5001
in it. - Stop both Alice and Bob middlewares:
killall -r "GeoEth*"
- Change corresponding
contract->address
, account address and PK in middlewares configurations (if needed) Alice:
nano middleware/ubuntu-x64-5001/publish/appsettings.json
Bob:
nano middleware/ubuntu-x64-5000/publish/appsettings.json
- Start corresponding middlewares:
~/middleware/ubuntu-x64-5000/publish$ nohup > /dev/null ./GeoEthereumMiddleware &
~/middleware/ubuntu-x64-5001/publish$ nohup > /dev/null ./GeoEthereumMiddleware &
- Update (if needed) ethereum address to the Alice and Bob config (conf.json) in
/home/nodes_handler/io/<node_uuid>/
. Example of result config:
{
"gateway": [1],
"network": {
"interface": "0.0.0.0",
"port": 8090
},
"uuid2address": {
"host": "0.0.0.0",
"port": 1500
},
"node": {
"uuid": "13e5cf8c-5834-4e52-b65b-f9281dd1ff90",
"ethereum": "234wrew534tgerger4eegrthrt"
}
}
- Start nodes handler:
sudo systemctl start handler.service
- Create TL from Bob to Alice
curl -X PUT private.localhost:2000/api/v1/nodes/{bob_uuid}/contractors/{alice_uuid}/trust-lines/1/?amount=500000&state-channel=1
- [optional] Create TL from Alice to Bob
curl -X PUT private.localhost:2000/api/v1/nodes/{alice_uuid}/contractors/{bob_uuid}/trust-lines/1/?amount=400000
- Send several payments in boths directions:
curl -X PUT private.localhost:2000/api/v1/nodes/{bob_uuid}/contractors/{alice_uuid}/transactions/1/?amount=500
...
curl -X PUT private.localhost:2000/api/v1/nodes/{alice_uuid}/contractors/{bob_uuid}/transactions/1/?amount=500
- Close channel via:
curl -X POST private.localhost:2000/api/v1/nodes/{alice_uuid}/contractors/{bob_uuid}/trust-lines-close-channel/1/
On the Bob's side channel would be closed utomatically.
-
Check nodes eth. wallets.
-
[Optional] nodes logs are accessible in
/home/nodes_handler/io/<node_uuid>/operations.log
.
Copyright 2018 ETH Berlin Hackaton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.