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
You might also like...
A really, really bad way to encrypt your text

deoxyencryptingnucleicacids A really, really bad way to encrypt your text. A general description of the scheme Encoding: The ascii plaintext is first

Ethereum ETL lets you convert blockchain data into convenient formats like CSVs and relational databases.

Python scripts for ETL (extract, transform and load) jobs for Ethereum blocks, transactions, ERC20 / ERC721 tokens, transfers, receipts, logs, contracts, internal transactions.

Use this script to track the gains of cryptocurrencies using historical data and display it on a super-imposed chart in order to find the highest performing cryptocurrencies historically

crypto-performance-tracker Use this script to track the gains of cryptocurrencies using historical data and display it on a super-imposed chart in ord

Crypto Stats and Tweets Data Pipeline using Airflow

Crypto Stats and Tweets Data Pipeline using Airflow Introduction Project Overview This project was brought upon through Udacity's nanodegree program.

Aggregate real-time market data from cryptocurrency exchanges, filter, sort and format as TradingView watchlists.

tvbuddy Aggregate real-time market data from cryptocurrency exchanges, filter, sort and format as TradingView watchlists. Developed and tested on Pyth

A Python module to encrypt and decrypt data with AES-128 CFB mode.

cryptocfb A Python module to encrypt and decrypt data with AES-128 CFB mode. This module supports 8/64/128-bit CFB mode. It can encrypt and decrypt la

Hide secret data within a digital image using good ol' terminal
Hide secret data within a digital image using good ol' terminal

pystego Hide secret data within a digital image using good ol' terminal Installation The recommended way for installing this package is using, python

Python Steganography data hiding in image

Python-Steganography Python Steganography data hiding in image data encryption and decryption im here you have to import stepic module 1.open CMD 2.ty

Discord webhooks for alerting crypto currency price changes & historical data.

Crypto-Discord Discord Webhooks for alerting crypto currency price changes & historical data. Create virtual environment and install requirements. $ s

Owner
Sebastjan Trepca
Sebastjan Trepca
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 9, 2022
A Python library to wrap age and minisign to provide key management, encryption/decryption and signing/verification functionality.

A Python library to wrap age and minisign to provide key management, encryption/decryption and signing/verification functionality.

Vinay Sajip 3 Feb 1, 2022
theHasher Tool created for generate strong and unbreakable passwords by using Hash Functions.Generate Hashes and store them in txt files.Use the txt files as lists to execute Brute Force Attacks!

$theHasher theHasher is a Tool for generating hashes using some of the most Famous Hashes Functions ever created. You can save your hashes to correspo

SR18 6 Feb 2, 2022
⚡ Automatically decrypt encryptions without knowing the key or cipher, decode encodings, and crack hashes ⚡

⚡ Automatically decrypt encryptions without knowing the key or cipher, decode encodings, and crack hashes ⚡

null 11.2k Jan 9, 2023
En- and decrypting text-messages by creating a key with of the fibonacci-sequence

En- and decrypting text-messages by creating a key with of the fibonacci-sequence. This key helps to create mathematical functions, whose zeros should generates the encrypted message.

Pulsar 1 Feb 5, 2022
keyring MITkeyring (🥉27 · ⭐ 630) - Store and access your passwords safely. MIT

The Python keyring library provides an easy way to access the system keyring service from python. It can be used in any application that needs safe pa

Jason R. Coombs 948 Dec 18, 2022
Hyval will store your information encrypted and decrypt it when needed

Hyval will store your information encrypted and decrypt it when needed

soroush safari 3 Oct 31, 2021
Kyrie Eleison - The best and unique way to encrypt some data or a file safely

Encrypt your important data and files easily and safely with Kyrie Eleison.

Billy 39 Oct 27, 2022
A simple key-based text encryption process that encrypts a string based in a list of characteres pairs.

Simple Cipher Encrypter About | New Features | Exemple | How To Use | License ℹ️ About A simple key-based text encryption process that encrypts a stri

Guilherme Farrel 1 Oct 21, 2021
Simple encryption-at-rest with key rotation support for Python.

keyring Simple encryption-at-rest with key rotation support for Python. N.B.: keyring is not for encrypting passwords--for that, you should use someth

Dann Luciano 1 Dec 23, 2021