Highly decentralized and censorship-resistant way to store key data

Overview

Beacon coin

Beacon coin is a Chia singelton coin that can store data that needs to be:

  • always available
  • censorship resistant
  • versioned
  • potentially immutable

You might want to use it for coordinating peers in a network, storing DNS information or whatever else you think of. (please share though). I wrote this mainly to learn more about Chialisp and explore smart coins in Chia Network (especially singletons). I used some general principles that could be expanded to implement a smart contract type of coin, with methods and state etc.

This code is still work in progress so please DO NOT USE it on mainnet. Use at your own risk.

Please note that I'm not affiliated with Chia Network. This means that I don't know if this is the right way to write smart coins and that it might contain some serious security issues until more people review it. Any feedback appreciated. Thanks!

How to use

For Unix/Macs

Clone this repo in a directory.

python3 -m venv venv
. ./venv/bin/activate
pip install .
beacon-coin --help

It should work on Windows too, although did't test:

py -m venv venv
./venv/Scripts/activate
pip install .
beacon-coin

You'll need a testnet chia node and wallet with some mojos. Once wallet and node are synced, you can start using beacon coin. Make sure CHIA_ROOT is set and pointing to the correct chia network (testnet!). More on that here: https://github.com/Chia-Network/chia-blockchain/wiki/How-to-connect-to-the-Testnet

Usage

Usage: beacon-coin [OPTIONS] COMMAND [ARGS]...

  Manage beacon coins on Chia network.

  They can be used to store key information in a decentralized and durable
  way.

Options:
  --config-path TEXT  Path to your Chia blockchain config (usually ~/.chia).
                      Defaults to fetching it from CHIA_ROOT env var.

  --fingerprint TEXT  Key fingerprint, will default to first one it finds if
                      not provided.

  -v, --verbose       Show more debugging info.
  --help              Show this message and exit.

Commands:
  add-pair      Add a pair of strings to coin data.
  change-owner  Change the owner, works on mutable and immutable coins.
  freeze        Freezing makes the coin immutable
  get-data      Returns a JSON of coin data and metadata Can be piped into...
  mint          Mint a new beacon coin, returns a LAUNCHER_ID.
  remove-pair   Remove a pair at a specifed index from coin data.

First you'll need to mint a beacon coin:

$ beacon-coin mint --fee=10 
Minted a new beacon coin with id: 3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12

Track transaction: 070d0ed91de0ce80c884f13ecad4db02d9d63ae028244e1e55dc69aac1b7904f     Fee: 10 mojos

NOTE: Store launcher_id somewhere safe as this wallet doesn't keep it anywhere yet.

Wait until transaction is processed.

You can use cdv mempool -txid 070d0ed91de0ce80c884f13ecad4db02d9d63ae028244e1e55dc69aac1b7904f

Let's check contents first:

$ beacon-coin get-data 0x3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12
{"version": 1, "data": []}

Ok, now let's add some data:

$ beacon-coin add-pair --fee=10 0x3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12 "some" "data"
Added pair ('some', 'data') using transaction: 364eeab9433f6bbf382f2659bdf5bc23c51ae862a765b3d3fdfcf56fe9c8bf1e

Wait again for node to process it.

And let's check content again:

$ beacon-coin get-data 0x3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12                       
{"version": 2, "data": [[0, ["some", "data"]]]}

Ok, we just stored some data on Chia blockchain.

Let's add more and test the removal.

$ beacon-coin add-pair --fee=10 0x3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12 "more" "data"
Added pair ('more', 'data') using transaction: 4e1ed3b76c474a73d68781d328b130d408bacd6650b4018d63231581655aac33
$ beacon-coin get-data 0x3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12                       
{"version": 3, "data": [[0, ["more", "data"]], [1, ["some", "data"]]]}
$ beacon-coin remove-pair --fee=15 0x3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12 0
Removed pair at 0 using transaction: efbbe9fbeadc78c0840f3bffbda57ea1f8d734cbb634992fcd5e4aa28c4a5ab1
$ beacon-coin get-data 0x3085341ed92faeda6887f5270b7cc049c024bd2bf1c27a9e8f33e1f902fbea12
{"version": 4, "data": [[0, ["some", "data"]]]}

Python API

beacon-coin is internally using python API to manage coins.

TODOs

  • refactor wallet and make it more DRY
  • publish tests (right now still in progress)
  • add soft linking between different coins, can enable things like having an immutable beacon coin that points to other mutable coins
Owner
Sebastjan Trepca
Sebastjan Trepca
TON Command Line Interface - easy smart contract manipulation

toncli The Open Network cross-platform smart contract command line interface. Easy to deploy and interact with TON smart contracts. Installation Toncl

Disintar IO 100 Dec 18, 2022
A bot written in Python to automatically buy tokens on the Binance Smart Chain as soon as liquidity is provided

A bot written in Python to automatically buy tokens on the Binance Smart Chain as soon as liquidity is provided. If you’ve found this bot useful and have profited from it please consider donating any

473 Dec 25, 2022
A curated list for getting up to speed on crypto and decentralized networks

crypto reading list A curated list for getting up to speed on crypto and decentralized networks. The content on the toplevel page contains what we con

Jump Crypto 1.1k Jan 07, 2023
The (Python-based) mining software required for the Game Boy mining project.

The (Python-based) mining software required for the Game Boy mining project.

Ghidra Ninja 31 Nov 04, 2022
Simple BRender SDK KeyGen.

Super Simple BRender KeyGen Simple BRender SDK KeyGen. Info This is just a super simple keygen for the BRender SDK installer coded in python. All test

1 Jan 15, 2022
SVSHI - Secure and Verified Smart Home Infrastructure

The SVSHI (Secure and Verified Smart Home Infrastructure) (pronounced like "sushi") project is a platform/runtime/toolchain for developing and running formally verified smart infrastructures, such as

Dependable Systems Laboratory 3 Oct 28, 2022
Modeval (or Modular Eval) is a modular and secure string evaluation library that can be used to create custom parsers or interpreters.

modeval Modeval (or Modular Eval) is a modular and secure string evaluation library that can be used to create custom parsers or interpreters. Basic U

2 Jan 01, 2022
Lottery by Ethereum Blockchain

Lottery by Ethereum Blockchain Set your web3 provider url in .env PROVIDER=https://mainnet.infura.io/v3/YOUR-INFURA-TOKEN Create your source file .

John Torres 3 Dec 23, 2021
E2EE disabling plugin for Synapse

E2EE disabling plugin for Synapse This Pluggable Module disables end-to-end encryption in a self-hosted Synapse servers. It works by stripping out req

Konstantin Sharlaimov 9 Nov 30, 2022
Accounting Cycle Program with Blockchain Component

In the first iteration of my accounting cycle program, I talked about adding in a blockchain component that allows the user to verify the inegrity of

J. Brandon Walker 1 Nov 29, 2021
Small utility to encrypt and decrypt messages

Safe Safe is a small utility to encrypt and decrypt messages using a pair of public and private keys. Installation You need to have GPG installed in y

Gustavo Eguez 2 Dec 21, 2021
Marketplace but with cryptocurrencies only.

MoneroMarket Marketplace but with cryptocurrencies only. MoneroMarket was created as a way to be able to use cryptocurrencies as an actual currency to

Janoher 35 Jan 01, 2023
BlockVis - Create beautiful visualizations of Bitcoin Blockheaders

BlockVis Create beautiful visualizations of Bitcoin Blockheaders How to run To r

Egge 2 Jan 05, 2022
Block Chain for RiceSupply Chain and Agriculture Traceability

Block Chain for RiceSupply Chain and Agriculture Traceability Project Under Development Folder: Building a BlockChain Basic blockchain structure using

Chandru S Raghavan 3 Jan 19, 2022
Gold(Gold) is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure

gold-blockchain (Gold) Gold(Gold) is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure. Here are some of

zcomputerwiz 3 Mar 09, 2022
Mina is a new cryptocurrency with a constant size blockchain, improving scaling while maintaining decentralization and security.

Mina Mina is the first cryptocurrency with a lightweight, constant-sized blockchain. This is the main source code repository for the Mina project. It

1.6k Jan 07, 2023
O BiscoitoDaSorte foi criado com o objetivo de estudar desenvolvimento de bots para Discord.

BiscoitoDaSorteBOT O BiscoitoDaSorte foi criado com o objetivo de estudar desenvolvimento de bots para Discord. BOT online e com o comando =sorte Requ

Jonas Carvalho 5 Mar 17, 2022
Tink is a multi-language, cross-platform, open source library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.

Tink A multi-language, cross-platform library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse. Ubuntu

Google 12.9k Jan 05, 2023
Enchpyter, is able to encrypt and decrypt words as you determine, of course, according to the alphabet.

Enchpyter Enchpyter is a program do encrypt and decrypt any word you want (just letters). You enter how many letters jumps and write the word, so, the

João Assalim 2 Oct 10, 2022