- Notifications
You must be signed in to change notification settings - Fork8
Stellar transaction compiler
License
xdrpp/stc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
stc is a library and command-line tool for creating, editing, andmanipulating transactions for theStellarblockchain. It supports translating back and forth betweenhuman-readabletxrep format and Stellar's native binary XDRrepresentation, as well submitting transactions to the network,querying account status, and more. The library makes it easy to buildand submit transactions programmatically from go applications.
To install or upgrade this software if you don't plan to hack on it,run the following:
GOPROXY=direct go install github.com/xdrpp/stc/...@latest
TheGOPROXY
environment variable requests the latest version of thesoftware from github, instead of calling home to Google's module proxyand allowing Google to supply an incorrect or stale version of thesoftware (which unfortunately happened to the author).
Once this command completes, put the~/go/bin
directory on your pathand you should be able to runstc
.
For most purposes you can simply depend on the latest release.However, if you wish to install the latest development version fromwithin a go module (a directory with ago.mod
file), you will needto specify thego1
branch to get autogenerated files that are notavailable on themaster
branch. Do so by running:
rm -rf ~/go/src/github.com/xdrpp/stcGOPROXY=direct go get github.com/xdrpp/stc/...@go1
Assuming your GOPATH is in the default location of~/go
, therm
command is necessary when upgrading becausesomego get
limitation leaves yourtree in a detached state, so thatgo get -u
cannot pull from theremotego1
branch.
To usestc
within a containerised environment it is possible to runstc
using our Docker image. All transactions are generated insidethe container and are made available to the host system throughvolume mounts.
docker run -it --rm -v /etc/ssl/certs/:/etc/ssl/certs/ -v /tmp:/tmp -v $HOME/.config/stc:/root/.config/stc xdrpp-stc
To make containerised usage seamless you can also create a shell alias.
# Stellar Transaction Compileralias stc='docker run -it --rm -v /etc/ssl/certs/:/etc/ssl/certs/ -v /tmp:/tmp -v $HOME/.config/stc:/root/.config/stc xdrpp-stc'
Once the alias is setup you will be able to interact withstc
directlyfrom the host system or within Kubernetes.
stc transaction.xdr
See thestc(1) man page for the command-line tool. There'salso avideo of a presentation and demo of stc atthe 2020 Stellar Meridian conference.
Seepkg.go.dev fordocumentation of the go library.
Becausestc
requires autogenerated files, themaster
branch is notmeant to be compiled under$GOPATH
, but rather in a standalonedirectory withmake
.
Furthermore, to buildstc
from themaster
branch, you also need tohave thegoxdr
compiler. Becausestc
is codeveloped with goxdr, you may want to use a developmentversion ofgoxdr
, which you can do by placing a thegoxdr
sourcetree (or a symbolic link to it) incmd/goxdr
. If you don't want todo this, but are okay just using a snapshot ofgoxdr
, you can run:
make depend
Once you havegoxdr
, you can buildstc
by running:
make
To installstc
, you will also needpandoc toformat the man page.
When new features are added, the latest godoc documentation isavailablehere.
To build a version ofstc
supporting changes to the transactionformat that have not yet been merged intostellar-core
, you canfetch alternate XDR files with either of the commands:
./make-xdr
BRANCH
./make-xdr
REPOBRANCH
HereREPO is the git repository from which to pull the non-standardversion ofstellar-core
(defaulthttps://github.com/stellar/stellar-core.git), andBRANCH is eithera branch name in the remote repository or a github pull requestnumber. To revert to the standard XDR, simply run./make-xdr
withno arguments.
There is no warranty for the program, to the extent permitted byapplicable law. Except when otherwise stated in writing the copyrightholders and/or other parties provide the program "as is" withoutwarranty of any kind, either expressed or implied, including, but notlimited to, the implied warranties of merchantability and fitness fora particular purpose. The entire risk as to the quality andperformance of the program is with you. Should the program provedefective, you assume the cost of all necessary servicing, repair orcorrection.
In no event unless required by applicable law or agreed to in writingwill any copyright holder, or any other party who modifies and/orconveys the program as permitted above, be liable to you for damages,including any general, special, incidental or consequential damagesarising out of the use or inability to use the program (including butnot limited to loss of data or data being rendered inaccurate orlosses sustained by you or third parties or a failure of the programto operate with any other programs), even if such holder or otherparty has been advised of the possibility of such damages.
About
Stellar transaction compiler