A general purpose blockchain highly compatible with Ethereum's ecosystem.
This is the first implementation written in golang.
Thor requires Go 1.17+ and C compiler to build. To install Go, follow this link.
Clone the Thor repo:
git clone https://github.com/vechain/thor.git
cd thorTo build the main app thor, just run
makeor build the full suite:
make allIf no errors are reported, all built executable binaries will appear in folder bin.
Connect to VeChain's mainnet:
bin/thor --network mainConnect to VeChain's testnet:
bin/thor --network testor startup a custom network
bin/thor --network <custom-net-genesis.json>An example genesis config file can be found at genesis/example.json.
To show usages of all command line options:
bin/thor -h--network valuethe network to join (main|test) or path to genesis file--data-dir valuedirectory for block-chain databases--cache valuemegabytes of ram allocated to internal caching (default: 2048)--beneficiary valueaddress for block rewards--target-gas-limit valuetarget block gas limit (adaptive if set to 0) (default: 0)--api-addr valueAPI service listening address (default: "localhost:8669")--api-cors valuecomma separated list of domains from which to accept cross origin requests to API--api-timeout valueAPI request timeout value in milliseconds (default: 10000)--api-call-gas-limit valuelimit contract call gas (default: 50000000)--api-backtrace-limit valuelimit the distance between 'position' and best block for subscriptions APIs (default: 1000)--verbosity valuelog verbosity (0-9) (default: 3)--max-peers valuemaximum number of P2P network peers (P2P network disabled if set to 0) (default: 25)--p2p-port valueP2P network listening port (default: 11235)--nat valueport mapping mechanism (any|none|upnp|pmp|extip:<IP>) (default: "none")--bootnode valuecomma separated list of bootnode IDs--skip-logsskip writing event|transfer logs (/logs API will be disabled)--pprofturn on go-pprof--disable-prunerdisable state pruner to keep all history--help, -hshow help--version, -vprint the version
soloclient runs in solo mode for test & dev
# create new block when there is pending transaction
bin/thor solo --on-demand
# save blockchain data to disk(default to memory)
bin/thor solo --persist
# two options can work together
bin/thor solo --persist --on-demandmaster-keymaster key management
# print the master address
bin/thor master-key
# export master key to keystore
bin/thor master-key --export > keystore.json
# import master key from keystore
cat keystore.json | bin/thor master-key --importDocker is one quick way for running a vechain node:
docker run -d\
-v {path-to-your-data-directory}/.org.vechain.thor:/home/thor/.org.vechain.thor\
-p 127.0.0.1:8669:8669 -p 11235:11235 -p 11235:11235/udp\
--name thor-node vechain/thor --network testDo not forget to add the --api-addr 0.0.0.0:8669 flag if you want other containers and/or hosts to have access to the RESTful API. Thor binds to localhost by default and it will not accept requests outside the container itself without the flag.
Release v2.0.4 changed the default user from root (UID: 0) to thor (UID: 1000). Ensure that UID 1000 has rwx permissions on the data directory of the docker host. You can do that with ACL sudo setfacl -R -m u:1000:rwx {path-to-your-data-directory}, or update ownership with sudo chown -R 1000:1000 {path-to-your-data-directory}.
- faucet.vecha.in by VeChain Foundation
Once thor has started, the online OpenAPI doc can be accessed in your browser. e.g. http://localhost:8669/ by default.
A special shout out to following projects:
Thank you so much for considering to help out with the source code! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes!
Please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base.
When you "Fork" the project, GitHub will make a copy of the project that is entirely yours; it lives in your namespace, and you can push to it.
Please check the following:
- Code must be adhere to the official Go Formatting guidelines.
- Get the branch up to date, by merging in any recent changes from the master branch.
- On the GitHub site, go to "Code". Then click the green "Compare and Review" button. Your branch is probably in the "Example Comparisons" list, so click on it. If not, select it for the "compare" branch.
- Make sure you are comparing your new branch to master. It probably won't be, since the front page is the latest release branch, rather than master now. So click the base branch and change it to master.
- Press Create Pull Request button.
- Provide a brief title.
- Explain the major changes you are asking to be code reviewed. Often it is useful to open a second tab in your browser where you can look through the diff yourself to remind yourself of all the changes you have made.
VeChain Thor is licensed under the GNU Lesser General Public License v3.0, also included in LICENSE file in repository.