Integrating with Agoric Network
The Agoric network builds a blockchain for smart contracts in JavaScript using the cosmos-sdk
. Cosmos-sdk is software that provides the widely-used Tendermint/CometBFT consensus and best-in-class support for chain operations like staking and governance. For simplicity of chain integration, the Agoric Network works identically to the Cosmos Hub, except using different parameters (e.g., ubld
instead of uatom
).
TL;DR for Cosmos-experienced
This section points at relevant reference documentation for the underlying cosmos-sdk
and CometBFT/Tendermint consensus engine, and summarizes the differences.
The Agoric Network currently uses cosmos-sdk
v0.45. The general Cosmos documentation for this version can be found here, including structure andgolang
documentation, and REST API documentation.
Use the v0.45.1 version of the REST API for accessing the chain. To use the "Try it out" functionality, change the Base URL to agoric-api.polkachu.com
:
The chain can also be accessed via JavaScript using the cosmjs
library (and associated tutorials), or using CosmosKit.
Chain resources
- The base network entry points for the Agoric chain are specified in the network config.
- Additional chain information, including tokens and their logos, gas fee information for wallets, additional entry points, and explorers is maintained in the Cosmos Chain Registry.
- The source code for the Agoric Network runtime and contracts is in the Agoric open source repository on GitHub.
- The base unit for staking is
ubld
(corresponding touatom
for Cosmos Hub) - The command utility of the agoric chain is
agd
(corresponding tosimd
for the Cosmos Hub).
Tools
Building agd
The agd
command line tool can be built by running the commands as below:
git clone -b community-dev https://github.com/Agoric/agoric-sdk
cd agoric-sdk
SKIP_DOWNLOAD=false ./bin/agd build
export PATH=$PWD/bin:$PATH
To confirm that agd
is in your $PATH
, execute
agd version --long
Unlike typical cosmos-sdk chains where the daemon is a single executable file, Agoric's use of cosmos-sdk depends on many components of agoric-sdk at runtime. Copying agd
to /usr/local/bin
or the like is unlikely to produce a working installation. For more detail, see #7825.
FAQ
- How are transactions encoded? Cosmos SDK v0.45 Docs - Encoding
- What data is needed to create a transaction (last block hash, nonce, sender public key, etc.)? Cosmos SDK v0.45 Docs - Transaction Generation
- What data is signed and how is that data obtained (for example truncated SHA256 of transaction data)? Cosmos SDK v0.45 Docs - Transaction Generation
- Do transactions expire? Transaction do not expire unless you specify --timeout-height: Cosmos SDK v0.45 Docs - Transaction Generation However they do have a sequence number and may be invalidated if another transaction with the same sequence number is processed by the chain
- How are addresses generated? Cosmos SDK v0.45 Docs - Accounts
- How is the blockchain queried? JSON-RPC, gRPC, REST Cosmos SDK v0.45 Docs - Interact with Node