{"id":13577811,"url":"https://github.com/dtube/avalon","last_synced_at":"2026-03-17T12:06:57.841Z","repository":{"id":37082619,"uuid":"151441298","full_name":"dtube/avalon","owner":"dtube","description":"Blockchain for social distribution","archived":false,"fork":false,"pushed_at":"2023-02-14T11:22:06.000Z","size":35651,"stargazers_count":105,"open_issues_count":14,"forks_count":65,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-07-31T15:33:02.293Z","etag":null,"topics":["blockchain","dpos","social-network"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dtube.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-10-03T16:07:06.000Z","updated_at":"2025-07-23T13:03:12.000Z","dependencies_parsed_at":"2023-02-11T23:01:22.190Z","dependency_job_id":"337f8768-c123-467d-9b53-821a76c6ffd9","html_url":"https://github.com/dtube/avalon","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/dtube/avalon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtube%2Favalon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtube%2Favalon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtube%2Favalon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtube%2Favalon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dtube","download_url":"https://codeload.github.com/dtube/avalon/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtube%2Favalon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30623554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T11:26:08.186Z","status":"ssl_error","status_checked_at":"2026-03-17T11:24:37.311Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","dpos","social-network"],"created_at":"2024-08-01T15:01:24.544Z","updated_at":"2026-03-17T12:06:57.817Z","avatar_url":"https://github.com/dtube.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# AVALON\n\n## Get a node running\n\n#### Dependencies\n* [MongoDB](https://mongodb.com)\n* [NodeJS](https://nodejs.org/en/download/) **v14/16** (LTS)\n* [ntpd](https://linux.die.net/man/8/ntpd) or any NTP alternative for your system. ntpd comes pre-installed on most linux distributions\n\n## Install and run an Avalon node for Linux\n* `npm install` to install nodejs dependencies\n* `chmod +x scripts/start.sh`\n* `./scripts/start.sh`\n\n### Environment Variables\nThe `start.sh` shows the list of available environment variables you can set to make avalon behave slightly differently from the default install.\n\n## Install and run an Avalon node for Windows\n* `npm install` to install nodejs dependencies\n* Get your own keys with `node src/cli.js keypair`\n* Save your keys\n* Add your keys to `scripts/start.bat`\n* Define the path to your directory in `scripts/start.bat`\n* Run `scripts/start.bat`\n* Note: to restore a genesis.zip file you may need to download the [mongo databasetools](https://www.mongodb.com/try/download/database-tools?tck=docs_databasetools) and put the mongorestore.exe binary into your main directory.\n\n\n## [Syncing your node](./doc/syncing-your-node.md)\n## [Become a leader and produce blocks](./doc/leader-101.md)\n## [Debian 10 quick install procedure](./doc/debian-10.md)\n\n## Get helped\nWe have a discord channel dedicated to node owners (aka leaders), where you can get support to get set up. Join [discorg.gg/dtube](https://discord.gg/dtube) and go to `DTube Chain -\u003e #leader-candidates`\n\n## Using Avalon\nOnce you have a node running, there are many ways to interact with Avalon:\n\n### With the CLI tool\nYou can use the CLI tool to transact with Avalon. Simply try `node src/cli --help` or `node src/cli \u003ccommand\u003e --help` for a full help.\n\n### Using Javalon\n[Javalon](https://www.npmjs.com/package/javalon) is the javascript wrapper for Avalon's API. Working on both browser and nodejs.\n\n### HTTP API\nAvalon's API uses 100% JSON. The GET calls will allow you to fetch the public information which is already available through the d.tube UI.\n\nExamples:\n* Account data: /account/:username, i.e https://avalon.d.tube/account/rt-international\n* Video data: /content/:username/:link i.e. https://avalon.d.tube/content/rongibsonchannel/QmdjVMdeTtTEy1CJTDbtjuaiRKMP6H364Dv4n7FsWGpnPH\n\n### Full list of API endpoints\n[https://docs.google.com/spreadsheets/d/1ORoHjrdq5V5OkTChijTUOEYRzTujVXTzCyNYt-ysVhw/edit?usp=drive_web\u0026ouid=109732502499946497195](https://docs.google.com/spreadsheets/d/1ORoHjrdq5V5OkTChijTUOEYRzTujVXTzCyNYt-ysVhw/edit?usp=drive_web\u0026ouid=109732502499946497195)\n\nThis lists all the available API endpoints for Avalon. We also have recommended security practises if you want to open your node's API to the world. You can do it easily with nginx and [avalon-nginx-config](https://github.com/dtube/avalon-nginx-config).\n\n### Sending Transactions to the network (POST /transact)\nOnce you have an account and balance (if you don't, you can create one on [https://signup.d.tube](https://signup.d.tube), your account will start generating bandwidth and voting power (respectively the bw and vt fields in your account data). You can consume those resources by transacting.\n\nEvery transaction will have a bandwidth cost, calculated based on the number of bytes required for the storage of your transaction inside a block.\nCertain transaction types will require you to spend voting power, such as publishing a content, voting or tagging a content.\n\nTo transact, you need to use the /transact POST call of the Avalon API. All the examples here are for the CLI tool, but the same can be achieved with [Javalon](https://npmjs.org/javalon) in Javascript.\n\nNecessary for all transactions:\n* *key*: your private key\n* * Use -K MyKeyHere to use a plain-text key\n* * Or use -F file.json to use a key inside a file to sign (this will prevent your key from showing on the screen too much)\n* *user*: your username\n\n#### Vote for a leader\n* *target*: the node owner to approve\n```\nnode src/cli.js vote-leader -K \u003ckey\u003e -M \u003cuser\u003e \u003ctarget\u003e\n\n// alice votes for bob as a leader\nnode src/cli.js vote-leader -K 5DPwDJqTvMuykHimmZxThfKttPSNLzJjpbNtkGNnjPAf -M alice bob\n```\n\n#### Unvote a leader\n* *target*: the node owner to approve\n```\nnode src/cli.js vote-leader -K \u003ckey\u003e -M \u003cuser\u003e \u003ctarget\u003e\n\n// charlie does not want to vote for daniel as a leader anymore\nnode src/cli.js unvote-leader -F charlie_key.txt -M charlie daniel\n```\n\n#### Transfer tokens\n* *receiver*: username of the receiver of the transfer\n* *amount*: number of tokens to transfer to the receiver. Warning! 1 DTC in UI = 100 tokens\n* *memo*: arbitrary short text content\n```\nnode src/cli.js transfer -K \u003cbob_key\u003e -M \u003cuser\u003e \u003creceiver\u003e \u003camount\u003e \u003cmemo\u003e\n// bob sends 50 DTC to charles\nnode src/cli.js transfer -K HkUbQ5YpejWVSPt8Qgz8pkPGwkDrMn3XECd4Asn3ANB3 -M bob charles 50 'thank you'\n```\n\n#### Add a post / Commenting\n* *link*: a short string to be used as the index of the content\n* *parent_author*: the username of the author of the parent post\n* *parent_link*: the link of the parent post\n* *json*: arbitrary json input. example: `{\"string\":\"aye\", array:[1,2,3]}`\n* *tag*: arbitrary short text content\n* *weight* : the number of vote tokens to spend on this vote\n```\nnode src/cli.js comment -K \u003ckey\u003e -M \u003cuser\u003e \u003clink\u003e \u003cparent_author\u003e \u003cparent_link\u003e \u003cjson\u003e\n```\n\n#### Vote a post\n* *link*: the link of the post to vote on\n* *author*: the username of the author to vote on\n* *weight*: the number of vote tokens to spend on this vote\n* *tag*: arbitrary short text content\n```\nnode src/cli.js vote -K \u003ckey\u003e -M \u003cuser\u003e \u003clink\u003e \u003cauthor\u003e \u003cweight\u003e \u003ctag\u003e\n```\n\n#### Edit your user json object\n* *json*: arbitrary json input. example: `{\"string\":\"aye\", array:[1,2,3]}`\n```\nnode src/cli.js profile -K \u003ckey\u003e -M \u003cuser\u003e \u003cjson\u003e\n```\n\n#### Follow a user\n* *target*: the user to follow\n```\nnode src/cli.js follow -K \u003ckey\u003e -M \u003cuser\u003e \u003ctarget\u003e\n```\n\n#### Unfollow a user\n* *target*: the user to unfollow\n```\nnode src/cli.js unfollow -K \u003ckey\u003e -M \u003cuser\u003e \u003ctarget\u003e\n```\n\n#### Signing a raw transaction\n\nTo create a transaction and export it to a file, you can use the `sign` CLI tool\n```\nnode src/cli.js sign \u003cpriv_key\u003e \u003cuser\u003e \u003ctx\u003e \u003e tmptx.json\n```\nFor example to approve a node owner and publishing it only 5 seconds later:\n```\nnode src/cli.js sign -K 4L1C3553KRETK3Y -M alice '{\"type\":1,\"data\":{\"target\":\"miner1\"}}' \u003e tmptx.json\nsleep 5\ncurl -H \"Content-type:application/json\" --data @tmptx.json http://localhost:3001/transact\n```\n\n### Other POST Calls\n\n#### Mine Block\nWill force the node to try to produce a block even if it's unscheduled. Useful for block #1 and working on development\n```\ncurl  http://localhost:3001/mineBlock\n``` \n\n#### Add peer\nManually force connection to a peer without having to restart the node\n```\ncurl -H \"Content-type:application/json\" --data '{\"peer\" : \"ws://localhost:6001\"}' http://localhost:3001/addPeer\n```\n\n### Data storage\n\n### MongoDB\nAvalon saves the state of the chain into mongodb after each block. You can easily query mongodb directly to get any data you want, that wouldn't be provided by the API itself.\n```\nmongo \u003cdb_name\u003e\ndb.accounts.findOne({name:'master'})\ndb.blocks.findOne({_id: 0})\n```\nHowever be sure not to write to any collection used by avalon in this database (namely the accounts, blocks and contents). If you do, your node will irremediably fork sooner or later.\n\n### Elastic Search\nAvalon can also copy the accounts and contents into an elastic search database with [monstache](https://github.com/rwynn/monstache). A configuration file for monstache is provided in the root of this repository. Once running you can do text queries on accounts or contents like so: \n\n```\n# search contents\ncurl http://localhost:9200/avalon.contents/_search?q=football\n# search accounts\ncurl http://localhost:9200/avalon.accounts/_search?q=satoshi\n```\nPlease refer to Elastic Search documentation for more complex queries.\n\nD.Tube runs a public Elastic Search mirror of the current testnet on https://search.d.tube\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtube%2Favalon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdtube%2Favalon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtube%2Favalon/lists"}